about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/buildenv/builder.pl
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/buildenv/builder.pl')
-rwxr-xr-xnixpkgs/pkgs/build-support/buildenv/builder.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/buildenv/builder.pl b/nixpkgs/pkgs/build-support/buildenv/builder.pl
index fc6ffce735cc..411b147cc58e 100755
--- a/nixpkgs/pkgs/build-support/buildenv/builder.pl
+++ b/nixpkgs/pkgs/build-support/buildenv/builder.pl
@@ -129,6 +129,15 @@ sub findFiles {
         return;
     }
 
+    # If target already exists and both targets resolves to the same path, skip
+    if (defined $oldTarget && $oldTarget ne "" && abs_path($target) eq abs_path($oldTarget)) {
+        # Prefer the target that is not a symlink, if any
+        if (-l $oldTarget && ! -l $target) {
+            $symlinks{$relName} = [$target, $priority];
+        }
+        return;
+    }
+
     # If target already exists as a symlink to a file (not a
     # directory) in a higher-priority package, skip.
     if (defined $oldTarget && $priority > $oldPriority && $oldTarget ne "" && ! -d $oldTarget) {