about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-10-03T14·38-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-10-03T14·38-0400
commita3f205b24954c7f0983a937b0b9b3d64c22a2fa7 (patch)
tree245d2daa9ac4816507105bffb588fac38ad31fc3 /src/libstore/local-store.cc
parent2001895f3d2668549feb60a182aa624a7b6292eb (diff)
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.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index a4ad97331a..b55ab42842 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<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;
 }