summary refs log tree commit diff
path: root/pkgs/build-support/build-bazel-package
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2019-08-19 11:21:37 +0300
committerNikolay Amiantov <ab@fmap.me>2019-08-19 11:23:17 +0300
commit3b3618ea3c8c29c65855681ce51b10a447264d0d (patch)
treec1d03068ad91cdbb486db9cee9684f032ed615ef /pkgs/build-support/build-bazel-package
parentc9d957afc181f41eeec5c218a156db32bb20e433 (diff)
downloadnixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar.gz
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar.bz2
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar.lz
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar.xz
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.tar.zst
nixpkgs-3b3618ea3c8c29c65855681ce51b10a447264d0d.zip
buildBazelPackage: remove top-level symlinks
They always can be regenerated during the actual build, and they are sometimes
random, e.g in Tensorflow;

platforms -> NIX_BUILD_TOP/tmp/install/35282f5123611afa742331368e9ae529/_embedded_binaries/platforms
Diffstat (limited to 'pkgs/build-support/build-bazel-package')
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix
index 32cec42160f..d4318b715ba 100644
--- a/pkgs/build-support/build-bazel-package/default.nix
+++ b/pkgs/build-support/build-bazel-package/default.nix
@@ -71,6 +71,15 @@ in stdenv.mkDerivation (fBuildAttrs // {
       rm -rf $(find $bazelOut/external -type d -name .svn)
       rm -rf $(find $bazelOut/external -type d -name .hg)
 
+      # Removing top-level symlinks along with their markers.
+      # This is needed because they sometimes point to temporary paths (?).
+      # For example, in Tensorflow-gpu build:
+      # platforms -> NIX_BUILD_TOP/tmp/install/35282f5123611afa742331368e9ae529/_embedded_binaries/platforms
+      find $bazelOut/external -maxdepth 1 -type l | while read symlink; do
+        name="$(basename "$symlink")"
+        rm "$symlink" "$bazelOut/external/@$name.marker"
+      done
+
       # Patching symlinks to remove build directory reference
       find $bazelOut/external -type l | while read symlink; do
         new_target="$(readlink "$symlink" | sed "s,$NIX_BUILD_TOP,NIX_BUILD_TOP,")"