forked from lix-project/lix
nix-store --serve: pass on settings.keepFailed
from SSH store
When doing e.g. nix-build -A package --keep-failed --option \ builders \ 'ssh://mfhydra?remote-store=/home/bosch/store x86_64-linux - 10 4 big-parallel' this doesn't work properly because this build-setting is ignored. I changed this behavior by passing the `settings.keepFailed` through the serve-protocol to remote machines to make sure that I can introspect the build-directory (which is particularly helpful when I have to look at a `config.log` from a failed build for instance).
This commit is contained in:
parent
af94b54db3
commit
50edbc4ddf
|
@ -237,6 +237,10 @@ private:
|
||||||
conn.to
|
conn.to
|
||||||
<< settings.buildRepeat
|
<< settings.buildRepeat
|
||||||
<< settings.enforceDeterminism;
|
<< settings.enforceDeterminism;
|
||||||
|
|
||||||
|
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 7) {
|
||||||
|
conn.to << ((int) settings.keepFailed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace nix {
|
||||||
#define SERVE_MAGIC_1 0x390c9deb
|
#define SERVE_MAGIC_1 0x390c9deb
|
||||||
#define SERVE_MAGIC_2 0x5452eecb
|
#define SERVE_MAGIC_2 0x5452eecb
|
||||||
|
|
||||||
#define SERVE_PROTOCOL_VERSION (2 << 8 | 6)
|
#define SERVE_PROTOCOL_VERSION (2 << 8 | 7)
|
||||||
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
||||||
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
||||||
|
|
||||||
|
|
|
@ -801,6 +801,9 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
settings.enforceDeterminism = readInt(in);
|
settings.enforceDeterminism = readInt(in);
|
||||||
settings.runDiffHook = true;
|
settings.runDiffHook = true;
|
||||||
}
|
}
|
||||||
|
if (GET_PROTOCOL_MINOR(clientVersion) >= 7) {
|
||||||
|
settings.keepFailed = (bool) readInt(in);
|
||||||
|
}
|
||||||
settings.printRepeatedBuilds = false;
|
settings.printRepeatedBuilds = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,3 +53,16 @@ nix path-info --store $TEST_ROOT/machine3 --all \
|
||||||
| grep -v builder-build-remote-input-1.sh \
|
| grep -v builder-build-remote-input-1.sh \
|
||||||
| grep -v builder-build-remote-input-2.sh \
|
| grep -v builder-build-remote-input-2.sh \
|
||||||
| grep builder-build-remote-input-3.sh
|
| grep builder-build-remote-input-3.sh
|
||||||
|
|
||||||
|
# Behavior of keep-failed
|
||||||
|
out="$(nix-build 2>&1 failing.nix \
|
||||||
|
--builders "$(join_by '; ' "${builders[@]}")" \
|
||||||
|
--keep-failed \
|
||||||
|
--store $TEST_ROOT/machine0 \
|
||||||
|
-j0 \
|
||||||
|
--arg busybox $busybox)" || true
|
||||||
|
|
||||||
|
[[ "$out" =~ .*"note: keeping build directory".* ]]
|
||||||
|
|
||||||
|
build_dir="$(grep "note: keeping build" <<< "$out" | sed -E "s/^(.*)note: keeping build directory '(.*)'(.*)$/\2/")"
|
||||||
|
[[ "foo" = $(<"$build_dir"/bar) ]]
|
||||||
|
|
22
tests/failing.nix
Normal file
22
tests/failing.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ busybox }:
|
||||||
|
with import ./config.nix;
|
||||||
|
let
|
||||||
|
|
||||||
|
mkDerivation = args:
|
||||||
|
derivation ({
|
||||||
|
inherit system;
|
||||||
|
builder = busybox;
|
||||||
|
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
|
||||||
|
} // removeAttrs args ["builder" "meta"])
|
||||||
|
// { meta = args.meta or {}; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
failing = mkDerivation {
|
||||||
|
name = "failing";
|
||||||
|
buildCommand = ''
|
||||||
|
echo foo > bar
|
||||||
|
exit 1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue