mirror of
https://github.com/NixOS/nix.git
synced 2025-12-14 13:01:05 +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
|
|
@ -652,16 +652,6 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
goal.worker.childTerminated(&goal);
|
||||
}
|
||||
|
||||
void noteHashMismatch() override
|
||||
{
|
||||
goal.worker.hashMismatch = true;
|
||||
}
|
||||
|
||||
void noteCheckMismatch() override
|
||||
{
|
||||
goal.worker.checkMismatch = true;
|
||||
}
|
||||
|
||||
void markContentsGood(const StorePath & path) override
|
||||
{
|
||||
goal.worker.markContentsGood(path);
|
||||
|
|
@ -818,6 +808,26 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
// N.B. cannot use `std::visit` with co-routine return
|
||||
if (auto * ste = std::get_if<0>(&res)) {
|
||||
outputLocks.unlock();
|
||||
// Allow selecting a subset of enum values
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wswitch-enum"
|
||||
switch (ste->status) {
|
||||
case BuildResult::HashMismatch:
|
||||
worker.hashMismatch = true;
|
||||
/* See header, the protocols don't know about `HashMismatch`
|
||||
yet, so change it to `OutputRejected`, which they expect
|
||||
for this case (hash mismatch is a type of output
|
||||
rejection). */
|
||||
ste->status = BuildResult::OutputRejected;
|
||||
break;
|
||||
case BuildResult::NotDeterministic:
|
||||
worker.checkMismatch = true;
|
||||
break;
|
||||
default:
|
||||
/* Other statuses need no adjusting */
|
||||
break;
|
||||
}
|
||||
# pragma GCC diagnostic pop
|
||||
co_return doneFailure(std::move(*ste));
|
||||
} else if (auto * builtOutputs = std::get_if<1>(&res)) {
|
||||
StorePathSet outputPaths;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue