summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/build-bazel-package
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-02-19 14:50:12 +0100
committerAndreas Rammhold <andreas@rammhold.de>2020-03-03 01:12:26 +0100
commitfa6c5c3dc76ae4428b9643b3f0ab05bb9049181e (patch)
treef90431eed11f5375c2ed1d00fbc08a9f35ef2095 /pkgs/build-support/build-bazel-package
parent398f9a2335ef8b8debd5003ebb56ee5facde2ea2 (diff)
buildBazelPackage: prime fixed output derivations
All bazel fixed output derivations should be specific to the bazel version that was used to generate them. There is not guarantee that the build will still succeed or reproduces (without the cached fixed output) if the fetch phase wasn't rerun with a different bazel version. In the past bazel had been bumped but not all those packages that have fixed outputs from bazel builds. This lead to compiling and somewhat working TF versions that couldn't be reproduced without the cached fixed outputs.
Diffstat (limited to 'pkgs/build-support/build-bazel-package')
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix
index 058f42aa8d5a..47c72bf92602 100644
--- a/pkgs/build-support/build-bazel-package/default.nix
+++ b/pkgs/build-support/build-bazel-package/default.nix
@@ -122,6 +122,8 @@ in stdenv.mkDerivation (fBuildAttrs // {
cp -r $bazelOut/external $out
+ echo '${bazel.name}' > $out/.nix-bazel-version
+
runHook postInstall
'';
@@ -143,6 +145,14 @@ in stdenv.mkDerivation (fBuildAttrs // {
preConfigure = ''
mkdir -p "$bazelOut"
+
+ test "${bazel.name}" = "$(<$deps/.nix-bazel-version)" || {
+ echo "fixed output derivation was built for a different bazel version" >&2
+ echo " got: $(<$deps/.nix-bazel-version)" >&2
+ echo "expected: ${bazel.name}" >&2
+ exit 1
+ }
+
cp -r $deps $bazelOut/external
chmod -R +w $bazelOut
find $bazelOut -type l | while read symlink; do