1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 20:16:03 +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,8 +169,10 @@ 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
also for other outputs. Filter down to just our output so as
not to leak info on unrelated things. */
for (auto it = buildResult.builtOutputs.begin(); it != buildResult.builtOutputs.end();) { for (auto it = buildResult.builtOutputs.begin(); it != buildResult.builtOutputs.end();) {
if (it->first != wantedOutput) { if (it->first != wantedOutput) {
it = buildResult.builtOutputs.erase(it); it = buildResult.builtOutputs.erase(it);
@ -181,6 +183,7 @@ Goal::Co DerivationGoal::haveDerivation()
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);
} }