diff options
author | Wael Nasreddine <wael.nasreddine@gmail.com> | 2019-06-13 07:12:38 -0700 |
---|---|---|
committer | Profpatsch <philip.patsch@tweag.io> | 2019-06-13 16:12:37 +0200 |
commit | bad7bc44db55912ca27a62362ed71f4dd6721f9c (patch) | |
tree | b4f18fd8f5e7d5d1f88403a467d671702688f813 /pkgs/development/tools/build-managers/bazel/default.nix | |
parent | 910b1795067bf7d5c99beb58fb0fb47a51995bda (diff) |
bazel: fix nix-hacks.patch with the latest version of Bazel (#63052)
* bazel: add a failing test for nix-hacks * fix the patch
Diffstat (limited to 'pkgs/development/tools/build-managers/bazel/default.nix')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/default.nix | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index 16c914349e781..1ea0fc049ba86 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -122,7 +122,7 @@ stdenv.mkDerivation rec { # bazel wants to extract itself into $install_dir/install every time it runs, # so let’s do that only once. - extracted = + extracted = bazelPkg: let install_dir = # `install_base` field printed by `bazel info`, minus the hash. # yes, this path is kinda magic. Sorry. @@ -130,7 +130,7 @@ stdenv.mkDerivation rec { in runLocal "bazel-extracted-homedir" { passthru.install_dir = install_dir; } '' export HOME=$(mktemp -d) touch WORKSPACE # yeah, everything sucks - install_base="$(${bazel}/bin/bazel info | grep install_base)" + install_base="$(${bazelPkg}/bin/bazel info | grep install_base)" # assert it’s actually below install_dir [[ "$install_base" =~ ${install_dir} ]] \ || (echo "oh no! $install_base but we are \ @@ -138,21 +138,23 @@ stdenv.mkDerivation rec { cp -R ${install_dir} $out ''; - bazelTest = { name, bazelScript, workspaceDir }: - runLocal name {} ( + bazelTest = { name, bazelScript, workspaceDir, bazelPkg }: + let + be = extracted bazelPkg; + in runLocal name {} ( # skip extraction caching on Darwin, because nobody knows how Darwin works (lib.optionalString (!stdenv.hostPlatform.isDarwin) '' # set up home with pre-unpacked bazel export HOME=$(mktemp -d) - mkdir -p ${extracted.install_dir} - cp -R ${extracted}/install ${extracted.install_dir} + mkdir -p ${be.install_dir} + cp -R ${be}/install ${be.install_dir} # https://stackoverflow.com/questions/47775668/bazel-how-to-skip-corrupt-installation-on-centos6 # Bazel checks whether the mtime of the install dir files # is >9 years in the future, otherwise it extracts itself again. # see PosixFileMTime::IsUntampered in src/main/cpp/util # What the hell bazel. - ${lr}/bin/lr -0 -U ${extracted.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {} + ${lr}/bin/lr -0 -U ${be.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {} '') + '' @@ -165,9 +167,13 @@ stdenv.mkDerivation rec { touch $out ''); + bazelWithNixHacks = bazel.override { enableNixHacks = true; }; in { - pythonBinPath = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; }; - bashTools = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; }; + pythonBinPathWithoutNixHacks = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; }; + bashToolsWithoutNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; }; + + pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; bazel = bazelWithNixHacks; }; + bashToolsWithNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; }; }; name = "bazel-${version}"; |