nix-store --verify: Add an option ‘--repair’ to repair all missing/corrupt paths

Also, return a non-zero exit code if errors remain after
verifying/repairing.
This commit is contained in:
Eelco Dolstra 2012-10-02 15:04:59 -04:00
parent 9958bd6992
commit 8e3a7bd712
4 changed files with 42 additions and 11 deletions

View file

@ -171,8 +171,9 @@ public:
/* Optimise a single store path. */
void optimisePath(const Path & path);
/* Check the integrity of the Nix store. */
void verifyStore(bool checkContents);
/* Check the integrity of the Nix store. Returns true if errors
remain. */
bool verifyStore(bool checkContents, bool repair);
/* Register the validity of a path, i.e., that `path' exists, that
the paths referenced by it exists, and in the case of an output
@ -250,7 +251,7 @@ private:
void invalidatePathChecked(const Path & path);
void verifyPath(const Path & path, const PathSet & store,
PathSet & done, PathSet & validPaths);
PathSet & done, PathSet & validPaths, bool repair, bool & errors);
void updatePathInfo(const ValidPathInfo & info);