From 2001895f3d2668549feb60a182aa624a7b6292eb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Oct 2012 17:13:46 -0400 Subject: Add a --repair flag to ‘nix-store -r’ to repair derivation outputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/nix-store/nix-store.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nix-store/nix-store.cc') 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); -- cgit 1.4.1