summary refs log tree commit diff
path: root/pkgs/build-support/buildenv
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2019-09-16 18:00:30 +0200
committerLinus Heckemann <git@sphalerite.org>2019-09-18 15:13:50 +0200
commit3125ab3afea16fbbd2ed24c06820c8386c7edb8d (patch)
treee165af2bb221ea35ea8cc98c6f86542ae7830c6d /pkgs/build-support/buildenv
parenta95a53aadc3a84ff8c2660f44aa124c58da241cd (diff)
downloadnixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar.gz
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar.bz2
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar.lz
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar.xz
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.tar.zst
nixpkgs-3125ab3afea16fbbd2ed24c06820c8386c7edb8d.zip
buildEnv: check pathsToLink before checking collisions
Fixes #32683
Diffstat (limited to 'pkgs/build-support/buildenv')
-rwxr-xr-xpkgs/build-support/buildenv/builder.pl16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index b699d762d29..fc6ffce735c 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -26,6 +26,19 @@ sub isInPathsToLink {
     return 0;
 }
 
+# Returns whether a path in one of the linked packages may contain
+# files in one of the elements of pathsToLink.
+sub hasPathsToLink {
+    my $path = shift;
+    foreach my $elem (@pathsToLink) {
+        return 1 if
+            $path eq "" ||
+            (substr($elem, 0, length($path)) eq $path
+             && (($path eq $elem) || (substr($elem, length($path), 1) eq "/")));
+    }
+    return 0;
+}
+
 # Similar to `lib.isStorePath`
 sub isStorePath {
     my $path = shift;
@@ -103,7 +116,8 @@ sub findFiles {
         $relName =~ /info\/dir/ ||
         ( $relName =~ /^\/share\/mime\// && !( $relName =~ /^\/share\/mime\/packages/ ) ) ||
         $baseName eq "perllocal.pod" ||
-        $baseName eq "log";
+        $baseName eq "log" ||
+        ! (hasPathsToLink($relName) || isInPathsToLink($relName));
 
     my ($oldTarget, $oldPriority) = @{$symlinks{$relName} // [undef, undef]};