summary refs log tree commit diff
path: root/pkgs/build-support/buildenv
diff options
context:
space:
mode:
authorJosé Romildo Malaquias <malaquias@gmail.com>2020-06-09 22:27:05 -0300
committerJosé Romildo Malaquias <malaquias@gmail.com>2020-06-10 06:42:48 -0300
commit4a1ef63c55a6dca0a06547c7738369c690ba6032 (patch)
tree8eada28f49427587ebcbc17978c34f13dfefa3a2 /pkgs/build-support/buildenv
parent168846fa8ec3a4649aefdc7cea9b7a65e5270ece (diff)
downloadnixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar.gz
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar.bz2
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar.lz
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar.xz
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.tar.zst
nixpkgs-4a1ef63c55a6dca0a06547c7738369c690ba6032.zip
buildenv: paths to link resolving to the same absolute path is not a conflict
When building an environment if two paths conflict but one or both are
symbolic links and they resolve to the same real path, the conflict is
discarded because the contents of both paths are the same. One of them
is chosen and there is no need to recur into them in order to build
deeper symbolic links.
Diffstat (limited to 'pkgs/build-support/buildenv')
-rwxr-xr-xpkgs/build-support/buildenv/builder.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index fc6ffce735c..411b147cc58 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/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) {