about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2019-09-23 15:52:42 +0200
committerGitHub <noreply@github.com>2019-09-23 15:52:42 +0200
commit602282538bcccdbcdf9ba8af2ee520b240f5b28d (patch)
tree2b82c513ece2e2148b559a451fc71d44df972865 /pkgs/build-support
parent80ea4c2d6932bd7e188ba7a8ad7d3e57ddc749ec (diff)
parent3125ab3afea16fbbd2ed24c06820c8386c7edb8d (diff)
Merge pull request #69022 from mayflower/buildenv
buildEnv: check pathsToLink before checking collisions
Diffstat (limited to 'pkgs/build-support')
-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 b699d762d29c5..fc6ffce735cc3 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]};