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

Move deleting redirected outputs in to cleanupBuild

It is only done in the `force = true` case, and the only
`cleanupBuild(true)` call is right after where it used to be, so this
has the exact same behavior as before.
This commit is contained in:
John Ericson 2025-08-29 16:10:25 -04:00
parent 76125f8eb1
commit d7ed86ceb1

View file

@ -542,10 +542,6 @@ SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
being valid. */ being valid. */
auto builtOutputs = registerOutputs(); auto builtOutputs = registerOutputs();
/* Delete unused redirected outputs (when doing hash rewriting). */
for (auto & i : redirectedOutputs)
deletePath(store.Store::toRealPath(i.second));
cleanupBuild(true); cleanupBuild(true);
return builtOutputs; return builtOutputs;
@ -1855,6 +1851,12 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
void DerivationBuilderImpl::cleanupBuild(bool force) void DerivationBuilderImpl::cleanupBuild(bool force)
{ {
if (force) {
/* Delete unused redirected outputs (when doing hash rewriting). */
for (auto & i : redirectedOutputs)
deletePath(store.Store::toRealPath(i.second));
}
if (topTmpDir != "") { if (topTmpDir != "") {
/* As an extra precaution, even in the event of `deletePath` failing to /* As an extra precaution, even in the event of `deletePath` failing to
* clean up, the `tmpDir` will be chowned as if we were to move * clean up, the `tmpDir` will be chowned as if we were to move