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

Simplify local drv goal a bit more

- `chrootParentDir` can be a local variable instead of a class variable.

- `getChildStatus` can be inlined. Again, we have the `assert(!hook);`
  in the local building case, which makes for a simpler thing inlined.
This commit is contained in:
Las 2025-03-10 22:31:13 +00:00 committed by John Ericson
parent 4b521f14ac
commit a87589a035
4 changed files with 8 additions and 30 deletions

View file

@ -282,7 +282,7 @@ Goal::Co LocalDerivationGoal::tryLocalBuild()
to have terminated. In fact, the builder could also have
simply have closed its end of the pipe, so just to be sure,
kill it. */
int status = getChildStatus();
int status = pid.kill();
debug("builder process for '%s' finished", worker.store.printStorePath(drvPath));
@ -412,12 +412,6 @@ static void movePath(const Path & src, const Path & dst)
extern void replaceValidPath(const Path & storePath, const Path & tmpPath);
int LocalDerivationGoal::getChildStatus()
{
return hook ? DerivationGoal::getChildStatus() : pid.kill();
}
bool LocalDerivationGoal::cleanupDecideWhetherDiskFull()
{
bool diskFull = false;
@ -787,7 +781,7 @@ void LocalDerivationGoal::startBuilder()
environment using bind-mounts. We put it in the Nix store
so that the build outputs can be moved efficiently from the
chroot to their final location. */
chrootParentDir = worker.store.Store::toRealPath(drvPath) + ".chroot";
auto chrootParentDir = worker.store.Store::toRealPath(drvPath) + ".chroot";
deletePath(chrootParentDir);
/* Clean up the chroot directory automatically. */

View file

@ -71,13 +71,6 @@ struct LocalDerivationGoal : public DerivationGoal
*/
bool useChroot = false;
/**
* The parent directory of `chrootRootDir`. It has permission 700
* and is owned by root to ensure other users cannot mess with
* `chrootRootDir`.
*/
Path chrootParentDir;
/**
* The root of the chroot environment.
*/
@ -237,8 +230,6 @@ struct LocalDerivationGoal : public DerivationGoal
*/
void chownToBuilder(const Path & path);
int getChildStatus() override;
/**
* Run the builder's process.
*/