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

Give DerivationBuilderImpl::cleanupBuild bool arg

Do this to match `DerivationBuilder::deleteTmpDir`, which we'll want to
combine it with next.

Also chenge one caller from `deleteTmpDir(true)` to `cleanupBuild(true)`
now that this is done, because it will not make a difference.

This should be a pure refactor with no behavioral change.
This commit is contained in:
John Ericson 2025-08-28 12:18:40 -04:00
parent 8dd289099c
commit 4db6bf96b7
2 changed files with 10 additions and 7 deletions

View file

@ -166,9 +166,12 @@ struct ChrootDerivationBuilder : virtual DerivationBuilderImpl
return !needsHashRewrite() ? chrootRootDir + p : store.toRealPath(p); return !needsHashRewrite() ? chrootRootDir + p : store.toRealPath(p);
} }
void cleanupBuild() override void cleanupBuild(bool force) override
{ {
DerivationBuilderImpl::cleanupBuild(); DerivationBuilderImpl::cleanupBuild(force);
if (force)
return;
/* Move paths out of the chroot for easier debugging of /* Move paths out of the chroot for easier debugging of
build failures. */ build failures. */

View file

@ -350,7 +350,7 @@ public:
protected: protected:
virtual void cleanupBuild(); virtual void cleanupBuild(bool force);
private: private:
@ -480,7 +480,7 @@ SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
bool diskFull = decideWhetherDiskFull(); bool diskFull = decideWhetherDiskFull();
cleanupBuild(); cleanupBuild(false);
auto msg = auto msg =
fmt("Cannot build '%s'.\n" fmt("Cannot build '%s'.\n"
@ -508,14 +508,14 @@ SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
for (auto & i : redirectedOutputs) for (auto & i : redirectedOutputs)
deletePath(store.Store::toRealPath(i.second)); deletePath(store.Store::toRealPath(i.second));
deleteTmpDir(true); cleanupBuild(true);
return builtOutputs; return builtOutputs;
} }
void DerivationBuilderImpl::cleanupBuild() void DerivationBuilderImpl::cleanupBuild(bool force)
{ {
deleteTmpDir(false); deleteTmpDir(force);
} }
static void chmod_(const Path & path, mode_t mode) static void chmod_(const Path & path, mode_t mode)