mirror of
https://github.com/NixOS/nix
synced 2025-06-30 15:48:00 +02:00
Merge remote-tracking branch 'origin/master' into flakes
This commit is contained in:
commit
cc218b15ba
26 changed files with 1295 additions and 59 deletions
|
@ -266,6 +266,12 @@ public:
|
|||
/* Set if at least one derivation had a timeout. */
|
||||
bool timedOut;
|
||||
|
||||
/* Set if at least one derivation fails with a hash mismatch. */
|
||||
bool hashMismatch;
|
||||
|
||||
/* Set if at least one derivation is not deterministic in check mode. */
|
||||
bool checkMismatch;
|
||||
|
||||
LocalStore & store;
|
||||
|
||||
std::unique_ptr<HookInstance> hook;
|
||||
|
@ -3213,6 +3219,7 @@ void DerivationGoal::registerOutputs()
|
|||
|
||||
/* Throw an error after registering the path as
|
||||
valid. */
|
||||
worker.hashMismatch = true;
|
||||
delayedException = std::make_exception_ptr(
|
||||
BuildError("hash mismatch in fixed-output derivation '%s':\n wanted: %s\n got: %s",
|
||||
dest, h.to_string(SRI), h2.to_string(SRI)));
|
||||
|
@ -3255,6 +3262,7 @@ void DerivationGoal::registerOutputs()
|
|||
if (!worker.store.isValidPath(path)) continue;
|
||||
auto info = *worker.store.queryPathInfo(path);
|
||||
if (hash.first != info.narHash) {
|
||||
worker.checkMismatch = true;
|
||||
if (settings.runDiffHook || settings.keepFailed) {
|
||||
Path dst = worker.store.toRealPath(path + checkSuffix);
|
||||
deletePath(dst);
|
||||
|
@ -3266,10 +3274,10 @@ void DerivationGoal::registerOutputs()
|
|||
buildUser ? buildUser->getGID() : getgid(),
|
||||
path, dst, drvPath, tmpDir);
|
||||
|
||||
throw Error(format("derivation '%1%' may not be deterministic: output '%2%' differs from '%3%'")
|
||||
throw NotDeterministic(format("derivation '%1%' may not be deterministic: output '%2%' differs from '%3%'")
|
||||
% drvPath % path % dst);
|
||||
} else
|
||||
throw Error(format("derivation '%1%' may not be deterministic: output '%2%' differs")
|
||||
throw NotDeterministic(format("derivation '%1%' may not be deterministic: output '%2%' differs")
|
||||
% drvPath % path);
|
||||
}
|
||||
|
||||
|
@ -4101,6 +4109,8 @@ Worker::Worker(LocalStore & store)
|
|||
lastWokenUp = steady_time_point::min();
|
||||
permanentFailure = false;
|
||||
timedOut = false;
|
||||
hashMismatch = false;
|
||||
checkMismatch = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4461,7 +4471,29 @@ void Worker::waitForInput()
|
|||
|
||||
unsigned int Worker::exitStatus()
|
||||
{
|
||||
return timedOut ? 101 : (permanentFailure ? 100 : 1);
|
||||
/*
|
||||
* 1100100
|
||||
* ^^^^
|
||||
* |||`- timeout
|
||||
* ||`-- output hash mismatch
|
||||
* |`--- build failure
|
||||
* `---- not deterministic
|
||||
*/
|
||||
unsigned int mask = 0;
|
||||
bool buildFailure = permanentFailure || timedOut || hashMismatch;
|
||||
if (buildFailure)
|
||||
mask |= 0x04; // 100
|
||||
if (timedOut)
|
||||
mask |= 0x01; // 101
|
||||
if (hashMismatch)
|
||||
mask |= 0x02; // 102
|
||||
if (checkMismatch) {
|
||||
mask |= 0x08; // 104
|
||||
}
|
||||
|
||||
if (mask)
|
||||
mask |= 0x60;
|
||||
return mask ? mask : 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue