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
This commit is contained in:
Nikolay Amiantov 2019-08-19 11:21:37 +03:00
parent c9d957afc1
commit 3b3618ea3c
3 changed files with 12 additions and 3 deletions

View file

@ -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,")"

View file

@ -267,9 +267,9 @@ let
# cudaSupport causes fetch of ncclArchive, resulting in different hashes
sha256 = if cudaSupport then
"1rbzvir569ch33bpvm47byx954vr80rjnzrbgs4rg3bqww73hr3k"
"19ll3f1i5qzd7ngz3m2jbxzgcrdjx5sv6kv2j5mcb8g3xsws8j5x"
else
"1wnhma450zh72raiq7ddd9lyq3a056cjqiy6i7y4sidiy09ncvcg";
"0y9kw3k4yvrxwdy7zry7nip9mdiwyv35r6mx65g4w7qajiypfc7i";
};
buildAttrs = {

View file

@ -62,7 +62,7 @@ buildBazelPackage rec {
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
'';
sha256 = "1i3b6kn9kq70a34wkpm8zjqj1skawdxs3r01b7r6ws1rbdnfj6mp";
sha256 = "0g2y283glx2ykxxqc3vsg520a6s2w5d937wndhgpfajc5yjgiz43";
};
buildAttrs = {