1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 10:21:47 +02:00

* Garbage collector: option `--max-freed' to stop after at least N

bytes have been freed, `--max-links' to stop when the Nix store
  directory has fewer than N hard links (the latter being important
  for very large Nix stores on filesystems with a 32000 subdirectories
  limit).
This commit is contained in:
Eelco Dolstra 2008-06-18 14:20:16 +00:00
parent a8f3b02092
commit d3aa183beb
6 changed files with 47 additions and 12 deletions

View file

@ -528,6 +528,8 @@ static void opGC(Strings opFlags, Strings opArgs)
else if (*i == "--print-live") options.action = GCOptions::gcReturnLive;
else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead;
else if (*i == "--delete") options.action = GCOptions::gcDeleteDead;
else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end());
else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end());
else throw UsageError(format("bad sub-operation `%1%' in GC") % *i);
PrintFreed freed(
@ -744,8 +746,12 @@ void run(Strings args)
}
else if (arg == "--indirect")
indirectRoot = true;
else if (arg[0] == '-')
else if (arg[0] == '-') {
opFlags.push_back(arg);
if (arg == "--max-freed" || arg == "--max-links") { /* !!! hack */
if (i != args.end()) opFlags.push_back(*i++);
}
}
else
opArgs.push_back(arg);