1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 04:56:01 +01:00

DerivationBuilder

Move output result filtering logic and assert just into the branch where
it is not obviously a no op / meeting the assertion.

Add a comment too, while we are at it.
This commit is contained in:
John Ericson 2025-08-14 00:26:19 -04:00
parent 14441f9382
commit c940283750

View file

@ -169,18 +169,21 @@ Goal::Co DerivationGoal::haveDerivation()
So we want to make sure the ones that we wanted to check are So we want to make sure the ones that we wanted to check are
properly there. */ properly there. */
buildResult.builtOutputs = {{wantedOutput, assertPathValidity()}}; buildResult.builtOutputs = {{wantedOutput, assertPathValidity()}};
} } else {
/* Otherwise the builder will give us info for out output, but
for (auto it = buildResult.builtOutputs.begin(); it != buildResult.builtOutputs.end();) { also for other outputs. Filter down to just our output so as
if (it->first != wantedOutput) { not to leak info on unrelated things. */
it = buildResult.builtOutputs.erase(it); for (auto it = buildResult.builtOutputs.begin(); it != buildResult.builtOutputs.end();) {
} else { if (it->first != wantedOutput) {
++it; it = buildResult.builtOutputs.erase(it);
} else {
++it;
}
} }
}
if (buildResult.success()) if (buildResult.success())
assert(buildResult.builtOutputs.count(wantedOutput) > 0); assert(buildResult.builtOutputs.count(wantedOutput) > 0);
}
co_return amDone(g->exitCode, g->ex); co_return amDone(g->exitCode, g->ex);
} }