mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Move autoDelChroot
This commit is contained in:
parent
9e2151d839
commit
c9b55fa3f0
2 changed files with 12 additions and 9 deletions
|
@ -110,12 +110,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
Path tmpDirInSandbox;
|
Path tmpDirInSandbox;
|
||||||
|
|
||||||
/**
|
|
||||||
* RAII object to delete the chroot directory.
|
|
||||||
*/
|
|
||||||
// FIXME: move
|
|
||||||
std::shared_ptr<AutoDelete> autoDelChroot;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sort of derivation we are building.
|
* The sort of derivation we are building.
|
||||||
*
|
*
|
||||||
|
@ -557,9 +551,6 @@ std::variant<std::pair<BuildResult::Status, Error>, SingleDrvOutputs> Derivation
|
||||||
for (auto & i : redirectedOutputs)
|
for (auto & i : redirectedOutputs)
|
||||||
deletePath(store.Store::toRealPath(i.second));
|
deletePath(store.Store::toRealPath(i.second));
|
||||||
|
|
||||||
/* Delete the chroot (if we were using one). */
|
|
||||||
autoDelChroot.reset(); /* this runs the destructor */
|
|
||||||
|
|
||||||
deleteTmpDir(true);
|
deleteTmpDir(true);
|
||||||
|
|
||||||
return std::move(builtOutputs);
|
return std::move(builtOutputs);
|
||||||
|
|
|
@ -175,6 +175,11 @@ struct LinuxDerivationBuilder : DerivationBuilderImpl
|
||||||
*/
|
*/
|
||||||
Path chrootRootDir;
|
Path chrootRootDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RAII object to delete the chroot directory.
|
||||||
|
*/
|
||||||
|
std::shared_ptr<AutoDelete> autoDelChroot;
|
||||||
|
|
||||||
PathsInChroot pathsInChroot;
|
PathsInChroot pathsInChroot;
|
||||||
|
|
||||||
LinuxDerivationBuilder(
|
LinuxDerivationBuilder(
|
||||||
|
@ -183,6 +188,13 @@ struct LinuxDerivationBuilder : DerivationBuilderImpl
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deleteTmpDir(bool force) override
|
||||||
|
{
|
||||||
|
autoDelChroot.reset(); /* this runs the destructor */
|
||||||
|
|
||||||
|
DerivationBuilderImpl::deleteTmpDir(force);
|
||||||
|
}
|
||||||
|
|
||||||
uid_t sandboxUid()
|
uid_t sandboxUid()
|
||||||
{
|
{
|
||||||
return usingUserNamespace ? (!buildUser || buildUser->getUIDCount() == 1 ? 1000 : 0) : buildUser->getUID();
|
return usingUserNamespace ? (!buildUser || buildUser->getUIDCount() == 1 ? 1000 : 0) : buildUser->getUID();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue