mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
When repairing a derivation, check and repair the entire output closure
If we find a corrupted path in the output closure, we rebuild the derivation that produced that particular path.
This commit is contained in:
parent
2001895f3d
commit
a3f205b249
3 changed files with 91 additions and 6 deletions
|
|
@ -1673,11 +1673,27 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
|
|||
|
||||
bool LocalStore::pathContentsGood(const Path & path)
|
||||
{
|
||||
std::map<Path, bool>::iterator i = pathContentsGoodCache.find(path);
|
||||
if (i != pathContentsGoodCache.end()) return i->second;
|
||||
printMsg(lvlInfo, format("checking path `%1%'...") % 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;
|
||||
bool res;
|
||||
if (!pathExists(path))
|
||||
res = false;
|
||||
else {
|
||||
HashResult current = hashPath(info.hash.type, path);
|
||||
Hash nullHash(htSHA256);
|
||||
res = info.hash == nullHash || info.hash == current.first;
|
||||
}
|
||||
pathContentsGoodCache[path] = res;
|
||||
if (!res) printMsg(lvlError, format("path `%1%' is corrupted or missing!") % path);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void LocalStore::markContentsGood(const Path & path)
|
||||
{
|
||||
pathContentsGoodCache[path] = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue