Merge staging-next into staging

This commit is contained in:
Frederik Rietdijk
2019-07-26 14:45:31 +02:00
38 changed files with 460 additions and 168 deletions
@@ -2,7 +2,7 @@
buildBazelPackage rec {
name = "bazel-deps-${version}";
version = "2019-02-01";
version = "2019-07-11";
meta = with stdenv.lib; {
homepage = "https://github.com/johnynek/bazel-deps";
@@ -10,13 +10,14 @@ buildBazelPackage rec {
license = licenses.mit;
maintainers = [ maintainers.uri-canva ];
platforms = platforms.all;
broken = true; # global variable '_common_attrs_for_plugin_bootstrapping' is referenced before assignment.
};
src = fetchFromGitHub {
owner = "johnynek";
repo = "bazel-deps";
rev = "6585033409e09028852403ec15ec0c77851234be";
sha256 = "0hypf7mcbpx2djqm92k82vn1k6pbnv564xbnazx8nw60f6ns0x87";
rev = "48fdf7f8bcf3aadfa07f9f7e6f0c9f4247cb0f58";
sha256 = "0wpn5anfgq5wfljfhpn8gbgdmgcp0claffjgqcnv5dh70ch7i0gi";
};
bazelTarget = "//src/scala/com/github/johnynek/bazel_deps:parseproject_deploy.jar";
@@ -24,49 +25,7 @@ buildBazelPackage rec {
buildInputs = [ git makeWrapper ];
fetchAttrs = {
preInstall = ''
# Remove all built in external workspaces, Bazel will recreate them when building
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker,embedded_jdk,\@embedded_jdk.marker,local_*,\@local_*}
# For each external workspace, remove all files that aren't referenced by Bazel
# Many of these files are non-hermetic (for example .git/refs/remotes/origin/HEAD)
files_to_delete=()
for workspace in $(find $bazelOut/external -maxdepth 2 -name "WORKSPACE" -print0 | xargs -0L1 dirname); do
workspaceOut="$NIX_BUILD_TOP/workspaces/$(basename workspace)/output"
workspaceUserRoot="$NIX_BUILD_TOP/workspaces/$(basename workspace)/tmp"
rm -rf $workspace/.git
if ! targets_and_files=$(cd "$workspace" && bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" query '//...:*' 2> /dev/null | sort -u); then
continue
fi
if ! targets=$(cd "$workspace" && bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" query '//...:all' 2> /dev/null | sort -u); then
continue
fi
mapfile -t referenced_files < <(comm -23 <(printf '%s' "$targets_and_files") <(printf '%s' "$targets") | sed -e 's,^//:,,g' | sed -e 's,^//,,g' | sed -e 's,:,/,g')
referenced_files+=( "WORKSPACE" )
for referenced_file in "''${referenced_files[@]}"; do
# Some of the referenced files are symlinks to non-referenced files.
# The symlink targets have deterministic contents, but non-deterministic
# paths. Copy them to the referenced path, which is deterministic.
if target=$(readlink "$workspace/$referenced_file"); then
rm "$workspace/$referenced_file"
cp -a "$target" "$workspace/$referenced_file"
fi
done
mapfile -t workspace_files_to_delete < <(find "$workspace" -type f -or -type l | sort -u | comm -23 - <(printf "$workspace/%s\n" "''${referenced_files[@]}" | sort -u))
for workspace_file_to_delete in "''${workspace_files_to_delete[@]}"; do
files_to_delete+=("$workspace_file_to_delete")
done
# We're running bazel in many different workspaces in a loop. Letting the
# daemon shut down on its own would leave several daemons alive at the
# same time, using up a lot of memory. Shut them down explicitly instead.
bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" shutdown 2> /dev/null
done
for file_to_delete in "''${files_to_delete[@]}"; do
rm "$file_to_delete"
done
find . -type d -empty -delete
'';
sha256 = "1yirrzhhrsmbgd27fg709plhrhyi8pzwqv84yg72sd3799kswh9m";
sha256 = "1r5qxsbw2cgww7vcg5psh7404l3jcxpvc0ndgl3k8vj1x8y93nkf";
};
buildAttrs = {
@@ -76,5 +76,6 @@ buildBazelPackage rec {
license = licenses.asl20;
maintainers = [ maintainers.uri-canva ];
platforms = platforms.darwin;
broken = true; # global variable '_layer' is referenced before assignment.
};
}
@@ -1,4 +1,5 @@
{ stdenv, callPackage, lib, fetchurl, fetchFromGitHub, runCommand, runCommandCC, makeWrapper
{ stdenv, callPackage, lib, fetchurl, fetchFromGitHub
, runCommand, runCommandCC, makeWrapper, recurseIntoAttrs
# this package (through the fixpoint glass)
, bazel
, lr, xe, zip, unzip, bash, writeCBin, coreutils
@@ -11,6 +12,8 @@
, buildJdk, runJdk
, buildJdkName
, runtimeShell
# Downstream packages for tests
, bazel-watcher
# Always assume all markers valid (don't redownload dependencies).
# Also, don't clean up environment variables.
, enableNixHacks ? false
@@ -221,10 +224,22 @@ stdenv.mkDerivation rec {
pythonBinPath = callPackage ./python-bin-path-test.nix { inherit runLocal bazelTest; };
bashToolsWithNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
cppWithNixHacks = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
javaWithNixHacks = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
protobufWithNixHacks = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
# downstream packages using buildBazelPackage
# fixed-output hashes of the fetch phase need to be spot-checked manually
downstream = recurseIntoAttrs ({
inherit bazel-watcher;
}
# dm-sonnet is only packaged for linux
// (lib.optionalAttrs stdenv.isLinux {
# TODO(timokau) dm-sonnet is broken currently
# dm-sonnet-linux = python3.pkgs.dm-sonnet;
}));
};
# update the list of workspace dependencies
@@ -37,13 +37,7 @@ let newPython = python3.override {
sha256 = "c0abe3218b86533cca287e7057a37481883c07acef7814b70583406938214cc8";
};
});
pyyaml = super.pyyaml.overridePythonAttrs (oldAttrs: rec {
version = "3.13";
src = oldAttrs.src.override {
inherit version;
sha256 = "3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf";
};
});
pyyaml = super.pyyaml_3;
};
};