* nix-build: use an indirection scheme to make it easier for users to
get rid of GC roots. Nix-build places a symlink `result' in the current directory. Previously, removing that symlink would not remove the store path being linked to as a GC root. Now, the GC root created by nix-build is actually a symlink in `/nix/var/nix/gcroots/auto' to `result'. So if that symlink is removed the GC root automatically becomes invalid (since it can no longer be resolved). The root itself is not automatically removed - the garbage collector should delete dangling roots.
This commit is contained in:
parent
dcc37c236c
commit
630ae0c9d7
7 changed files with 101 additions and 50 deletions
|
|
@ -29,6 +29,7 @@ static Expr evalStdin(EvalState & state, bool parseOnly)
|
|||
|
||||
static Path gcRoot;
|
||||
static int rootNr = 0;
|
||||
static bool indirectRoot = false;
|
||||
|
||||
|
||||
/* Print out the paths of the resulting derivation(s). If the user
|
||||
|
|
@ -51,7 +52,8 @@ static void printDrvPaths(EvalState & state, Expr e)
|
|||
printGCWarning();
|
||||
else
|
||||
drvPath = addPermRoot(drvPath,
|
||||
makeRootName(gcRoot, rootNr));
|
||||
makeRootName(gcRoot, rootNr),
|
||||
indirectRoot);
|
||||
cout << format("%1%\n") % drvPath;
|
||||
return;
|
||||
}
|
||||
|
|
@ -110,8 +112,10 @@ void run(Strings args)
|
|||
else if (arg == "--add-root") {
|
||||
if (i == args.end())
|
||||
throw UsageError("`--add-root requires an argument");
|
||||
gcRoot = *i++;
|
||||
gcRoot = absPath(*i++);
|
||||
}
|
||||
else if (arg == "--indirect")
|
||||
indirectRoot = true;
|
||||
else if (arg[0] == '-')
|
||||
throw UsageError(format("unknown flag `%1%`") % arg);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue