* Put chroots in the Nix store. This ensures that we can create hard
links to the inputs.
This commit is contained in:
parent
0008b0006d
commit
92cb7c4dfe
2 changed files with 14 additions and 2 deletions
|
@ -811,6 +811,11 @@ void DerivationGoal::haveDerivation()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* `drvPath' should already be a root, but let's be on the safe
|
||||||
|
side: if the user forgot to make it a root, we wouldn't want
|
||||||
|
things being garbage collected while we're busy. */
|
||||||
|
worker.store.addTempRoot(drvPath);
|
||||||
|
|
||||||
assert(worker.store.isValidPath(drvPath));
|
assert(worker.store.isValidPath(drvPath));
|
||||||
|
|
||||||
/* Get the derivation. */
|
/* Get the derivation. */
|
||||||
|
@ -1669,8 +1674,10 @@ void DerivationGoal::startBuilder()
|
||||||
if (useChroot) {
|
if (useChroot) {
|
||||||
#if CHROOT_ENABLED
|
#if CHROOT_ENABLED
|
||||||
/* Create a temporary directory in which we set up the chroot
|
/* Create a temporary directory in which we set up the chroot
|
||||||
environment using bind-mounts. */
|
environment using bind-mounts. We put it in the Nix store
|
||||||
chrootRootDir = createTempDir("", "nix-chroot");
|
to ensure that we can create hard-links to non-directory
|
||||||
|
inputs in the fake Nix store in the chroot (see below). */
|
||||||
|
chrootRootDir = drvPath + ".chroot";
|
||||||
|
|
||||||
/* Clean up the chroot directory automatically. */
|
/* Clean up the chroot directory automatically. */
|
||||||
autoDelChroot = boost::shared_ptr<AutoDelete>(new AutoDelete(chrootRootDir));
|
autoDelChroot = boost::shared_ptr<AutoDelete>(new AutoDelete(chrootRootDir));
|
||||||
|
|
|
@ -565,6 +565,11 @@ static bool isLive(const Path & path, const PathSet & livePaths,
|
||||||
if (hasSuffix(path, ".lock") && tempRoots.find(string(path, 0, path.size() - 5)) != tempRoots.end())
|
if (hasSuffix(path, ".lock") && tempRoots.find(string(path, 0, path.size() - 5)) != tempRoots.end())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* Don't delete .chroot directories for derivations that are
|
||||||
|
currently being built. */
|
||||||
|
if (hasSuffix(path, ".chroot") && tempRoots.find(string(path, 0, path.size() - 7)) != tempRoots.end())
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue