diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-02T21·13-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-02T21·13-0400 |
commit | 2001895f3d2668549feb60a182aa624a7b6292eb (patch) | |
tree | f555841859d53cf821bf52dc89bd4d0fe9273186 /src/nix-store | |
parent | cf46f194445c9abc0398dae908295dff794fee98 (diff) |
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.
Diffstat (limited to 'src/nix-store')
-rw-r--r-- | src/nix-store/nix-store.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index b3f4ebdf568c..104e0b241c49 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -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); |