mirror of
https://github.com/NixOS/nix
synced 2025-07-03 06:11:46 +02:00
Add a --repair flag to ‘nix-store -r’ to repair derivation outputs
With this flag, if any valid derivation output is missing or corrupt, it will be recreated by using a substitute if available, or by rebuilding the derivation. The latter may use hash rewriting if chroots are not available.
This commit is contained in:
parent
cf46f19444
commit
2001895f3d
7 changed files with 116 additions and 64 deletions
|
@ -93,9 +93,11 @@ static PathSet realisePath(const Path & path, bool build = true)
|
|||
static void opRealise(Strings opFlags, Strings opArgs)
|
||||
{
|
||||
bool dryRun = false;
|
||||
bool repair = false;
|
||||
|
||||
foreach (Strings::iterator, i, opFlags)
|
||||
if (*i == "--dry-run") dryRun = true;
|
||||
else if (*i == "--repair") repair = true;
|
||||
else throw UsageError(format("unknown flag `%1%'") % *i);
|
||||
|
||||
foreach (Strings::iterator, i, opArgs)
|
||||
|
@ -107,7 +109,7 @@ static void opRealise(Strings opFlags, Strings opArgs)
|
|||
|
||||
/* Build all paths at the same time to exploit parallelism. */
|
||||
PathSet paths(opArgs.begin(), opArgs.end());
|
||||
store->buildPaths(paths);
|
||||
store->buildPaths(paths, repair);
|
||||
|
||||
foreach (Paths::iterator, i, opArgs) {
|
||||
PathSet paths = realisePath(*i, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue