aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-10-12 16:30:03 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-10-13 13:51:36 +0200
commit5b4b7a3ebb83a8c93d8f68ade7bf1242c8590256 (patch)
treeb3760d2ec586611a082ff8c2a34b437bec673170 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parentcd6d8ae312701694b0a3ff9d59fbf3e7720dfe0c (diff)
Fix local repository detection when the repository path is absolute.
Fixes #3874. Change-Id: Ibbe3ea27b77426f551e2f70f082478edb2234749 PiperOrigin-RevId: 171957230
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index 09fd17d974..3ffcc33b82 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -231,8 +231,14 @@ public class PackageLookupFunction implements SkyFunction {
// There is a repository mismatch, this is an error.
// The correct package path is the one originally given, minus the part that is the local
// repository.
- PathFragment packagePathUnderExecRoot = packageIdentifier.getPathUnderExecRoot();
- PathFragment remainingPath = packagePathUnderExecRoot.relativeTo(localRepository.getPath());
+ PathFragment pathToRequestedPackage = packageIdentifier.getPathUnderExecRoot();
+ PathFragment localRepositoryPath = localRepository.getPath();
+ if (localRepositoryPath.isAbsolute()) {
+ // We need the package path to also be absolute.
+ pathToRequestedPackage =
+ packagePathEntry.asFragment().getRelative(pathToRequestedPackage);
+ }
+ PathFragment remainingPath = pathToRequestedPackage.relativeTo(localRepositoryPath);
PackageIdentifier correctPackage =
PackageIdentifier.create(localRepository.getRepository(), remainingPath);
return PackageLookupValue.incorrectRepositoryReference(packageIdentifier, correctPackage);