1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01: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:
Eelco Dolstra 2012-10-02 17:13:46 -04:00
parent cf46f19444
commit 2001895f3d
7 changed files with 116 additions and 64 deletions

View file

@ -1671,6 +1671,16 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
}
bool LocalStore::pathContentsGood(const Path & path)
{
ValidPathInfo info = queryPathInfo(path);
if (!pathExists(path)) return false;
HashResult current = hashPath(info.hash.type, path);
Hash nullHash(htSHA256);
return info.hash == nullHash || info.hash == current.first;
}
/* Functions for upgrading from the pre-SQLite database. */
PathSet LocalStore::queryValidPathsOld()