From fa6c5c3dc76ae4428b9643b3f0ab05bb9049181e Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Wed, 19 Feb 2020 14:50:12 +0100 Subject: [PATCH] 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. --- pkgs/build-support/build-bazel-package/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix index 058f42aa8d5..47c72bf9260 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