From a3f205b24954c7f0983a937b0b9b3d64c22a2fa7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 3 Oct 2012 10:38:09 -0400 Subject: 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. --- src/libstore/local-store.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index a4ad97331ad3..b55ab428421f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1673,11 +1673,27 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store, bool LocalStore::pathContentsGood(const Path & path) { + std::map::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; } -- cgit 1.4.1