Merge remote-tracking branch 'NixOS/master' into staging
This commit is contained in:
@@ -9,12 +9,9 @@ python.pkgs.buildPythonApplication rec {
|
||||
sha256 = "1mnh0h9m96p78b9ln1gbl4lw1mgl16qbyfi9fj2l13p3nxaq1sib";
|
||||
};
|
||||
|
||||
argparse = null;
|
||||
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = [
|
||||
python.pkgs.requests
|
||||
python.pkgs.argparse
|
||||
python.pkgs.pyyaml
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{ stdenv, writeText, runCommandCC, bazel }:
|
||||
|
||||
# Tests that certain executables are available in bazel-executed bash shells.
|
||||
|
||||
let
|
||||
WORKSPACE = writeText "WORKSPACE" ''
|
||||
workspace(name = "our_workspace")
|
||||
'';
|
||||
|
||||
fileIn = writeText "input.txt" ''
|
||||
one
|
||||
two
|
||||
three
|
||||
'';
|
||||
|
||||
fileBUILD = writeText "BUILD" ''
|
||||
genrule(
|
||||
name = "tool_usage",
|
||||
srcs = [ ":input.txt" ],
|
||||
outs = [ "output.txt" ],
|
||||
cmd = "cat $(location :input.txt) | gzip - | gunzip - | awk '/t/' > $@",
|
||||
)
|
||||
'';
|
||||
|
||||
runLocal = name: script: runCommandCC name { preferLocalBuild = true; } script;
|
||||
|
||||
workspaceDir = runLocal "our_workspace" ''
|
||||
mkdir $out
|
||||
cp ${WORKSPACE} $out/WORKSPACE
|
||||
cp ${fileIn} $out/input.txt
|
||||
cp ${fileBUILD} $out/BUILD
|
||||
'';
|
||||
|
||||
testBazel = runLocal "bazel-test-bash-tools" ''
|
||||
export HOME=$(mktemp -d)
|
||||
cp -r ${workspaceDir} wd && chmod +w wd && cd wd
|
||||
${bazel}/bin/bazel build :tool_usage
|
||||
cp bazel-genfiles/output.txt $out
|
||||
echo "Testing content" && [ "$(cat $out | wc -l)" == "2" ] && echo "OK"
|
||||
'';
|
||||
|
||||
in testBazel
|
||||
@@ -1,6 +1,6 @@
|
||||
{ stdenv, callPackage, lib, fetchurl, fetchpatch, runCommand, makeWrapper
|
||||
, jdk, zip, unzip, bash, writeCBin, coreutils
|
||||
, which, python, perl, gawk, gnused, gnugrep, findutils
|
||||
, which, python, perl, gawk, gnused, gnutar, gnugrep, gzip, findutils
|
||||
# Apple dependencies
|
||||
, cctools, clang, libcxx, CoreFoundation, CoreServices, Foundation
|
||||
# Allow to independently override the jdks used to build and run respectively
|
||||
@@ -23,7 +23,35 @@ let
|
||||
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
|
||||
'';
|
||||
|
||||
defaultShellPath = lib.makeBinPath [ bash coreutils findutils gawk gnugrep gnused which unzip ];
|
||||
defaultShellPath = lib.makeBinPath
|
||||
# Keep this list conservative. For more exotic tools, prefer to use
|
||||
# @rules_nixpkgs to pull in tools from the nix repository. Example:
|
||||
#
|
||||
# WORKSPACE:
|
||||
#
|
||||
# nixpkgs_git_repository(
|
||||
# name = "nixpkgs",
|
||||
# revision = "def5124ec8367efdba95a99523dd06d918cb0ae8",
|
||||
# )
|
||||
#
|
||||
# # This defines an external Bazel workspace.
|
||||
# nixpkgs_package(
|
||||
# name = "bison",
|
||||
# repositories = { "nixpkgs": "@nixpkgs//:default.nix" },
|
||||
# )
|
||||
#
|
||||
# some/BUILD.bazel:
|
||||
#
|
||||
# genrule(
|
||||
# ...
|
||||
# cmd = "$(location @bison//:bin/bison) -other -args",
|
||||
# tools = [
|
||||
# ...
|
||||
# "@bison//:bin/bison",
|
||||
# ],
|
||||
# )
|
||||
#
|
||||
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip ];
|
||||
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -38,9 +66,14 @@ stdenv.mkDerivation rec {
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
|
||||
# additional tests that check bazel’s functionality
|
||||
# Additional tests that check bazel’s functionality. Execute
|
||||
#
|
||||
# nix-build . -A bazel.tests
|
||||
#
|
||||
# in the nixpkgs checkout root to exercise them locally.
|
||||
passthru.tests = {
|
||||
python_bin_path = callPackage ./python-bin-path-test.nix {};
|
||||
pythonBinPath = callPackage ./python-bin-path-test.nix {};
|
||||
bashTools = callPackage ./bash-tools-test.nix {};
|
||||
};
|
||||
|
||||
name = "bazel-${version}";
|
||||
@@ -125,9 +158,11 @@ stdenv.mkDerivation rec {
|
||||
|
||||
genericPatches = ''
|
||||
# Substitute python's stub shebang to plain python path. (see TODO add pr URL)
|
||||
# See also `postFixup` where python is added to $out/nix-support
|
||||
substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt\
|
||||
--replace "/usr/bin/env python" "${python}/bin/python" \
|
||||
--replace "NIX_STORE_PYTHON_PATH" "${python}/bin/python" \
|
||||
|
||||
# substituteInPlace is rather slow, so prefilter the files with grep
|
||||
grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
|
||||
# If you add more replacements here, you must change the grep above!
|
||||
@@ -262,7 +297,10 @@ stdenv.mkDerivation rec {
|
||||
# Save paths to hardcoded dependencies so Nix can detect them.
|
||||
postFixup = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "${customBash} ${defaultShellPath}" > $out/nix-support/depends
|
||||
echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends
|
||||
# The templates get tar’d up into a .jar,
|
||||
# so nix can’t detect python is needed in the runtime closure
|
||||
echo "${python}" >> $out/nix-support/depends
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
|
||||
@@ -42,8 +42,10 @@ let
|
||||
|
||||
testBazel = runLocal "bazel-test-builtin-rules" ''
|
||||
export HOME=$(mktemp -d)
|
||||
cp -r ${workspaceDir}/* .
|
||||
${bazel}/bin/bazel --output_base=/tmp/bazel-tests/wd\
|
||||
# Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609
|
||||
# about why to create a subdir for the workspace.
|
||||
cp -r ${workspaceDir} wd && chmod u+w wd && cd wd
|
||||
${bazel}/bin/bazel \
|
||||
test \
|
||||
--test_output=errors \
|
||||
--host_javabase='@local_jdk//:jdk' \
|
||||
|
||||
@@ -7,8 +7,8 @@ in {
|
||||
version = "3.0.1";
|
||||
sha256 = "0wzid419mlwqw9llrg8gsx4nkzhqy16m4m40r0xnh6cwscw5wir4";
|
||||
};
|
||||
scons_3_0_3 = mkScons {
|
||||
version = "3.0.3";
|
||||
sha256 = "1wwn0534d83ryfxjihvqk2ncj8wh5210pi3jxjd2cvjqa9mpkv6q";
|
||||
scons_latest = mkScons {
|
||||
version = "3.0.4";
|
||||
sha256 = "06lv3pmdz5l23rx3kqsi1k712bdl36i942hgbjh209s94mpb7f72";
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user