mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 23:12:44 +01:00
Get rid of DerivationBuilder::note*Mismatch
It's fine to set these worker flags a little later in the control flow, since we'll be sure to reach those points in the error cases. And doing that is much nicer than having these tangled callbacks. I originally made the callbacks to meticulously recreate the exact behavior which I didn't quite understand. Now, thanks to cleaning up the error handling, I do understand what is going on, so I can be confident that this change is safe to make.
This commit is contained in:
parent
169033001d
commit
ff961fd9e2
4 changed files with 26 additions and 17 deletions
|
|
@ -1659,9 +1659,8 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||
if (wanted != got) {
|
||||
/* Throw an error after registering the path as
|
||||
valid. */
|
||||
miscMethods->noteHashMismatch();
|
||||
delayedException = std::make_exception_ptr(BuildError(
|
||||
BuildResult::OutputRejected,
|
||||
BuildResult::HashMismatch,
|
||||
"hash mismatch in fixed-output derivation '%s':\n specified: %s\n got: %s",
|
||||
store.printStorePath(drvPath),
|
||||
wanted.to_string(HashFormat::SRI, true),
|
||||
|
|
@ -1670,7 +1669,7 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||
if (!newInfo0.references.empty()) {
|
||||
auto numViolations = newInfo.references.size();
|
||||
delayedException = std::make_exception_ptr(BuildError(
|
||||
BuildResult::OutputRejected,
|
||||
BuildResult::HashMismatch,
|
||||
"fixed-output derivations must not reference store paths: '%s' references %d distinct paths, e.g. '%s'",
|
||||
store.printStorePath(drvPath),
|
||||
numViolations,
|
||||
|
|
@ -1746,7 +1745,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||
continue;
|
||||
ValidPathInfo oldInfo(*store.queryPathInfo(newInfo.path));
|
||||
if (newInfo.narHash != oldInfo.narHash) {
|
||||
miscMethods->noteCheckMismatch();
|
||||
if (settings.runDiffHook || settings.keepFailed) {
|
||||
auto dst = store.toRealPath(finalDestPath + ".check");
|
||||
deletePath(dst);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue