about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T13·15+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T13·15+0000
commit5adbb0aabe54479304453bf5e544f84b40ee7dd7 (patch)
treefd4fc6b57a3d9e7aa81ae5ad354e0cbce05304fd /src/libstore/local-store.cc
parent5b1052663a35940fc99ae6a8fcf6e707ae939fef (diff)
* build.cc: only use a substituter if it returns info for a path.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc58
1 files changed, 32 insertions, 26 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 141c7a8529..ccf1a51bc5 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -541,38 +541,44 @@ bool LocalStore::hasSubstitutes(const Path & path)
 }
 
 
-bool LocalStore::querySubstitutablePathInfo(const Path & path,
-    SubstitutablePathInfo & info)
+bool LocalStore::querySubstitutablePathInfo(const Path & substituter,
+    const Path & path, SubstitutablePathInfo & info)
 {
-    foreach (Paths::iterator, i, substituters) {
-        RunningSubstituter & run(runningSubstituters[*i]);
-        startSubstituter(*i, run);
+    RunningSubstituter & run(runningSubstituters[substituter]);
+    startSubstituter(substituter, run);
 
-        *run.to << "info\n" << path << "\n" << std::flush;
+    *run.to << "info\n" << path << "\n" << std::flush;
+        
+    string s;
 
-        string s;
+    int res;
+    getline(*run.from, s);
+    if (!string2Int(s, res)) abort();
 
-        int res;
-        getline(*run.from, s);
-        if (!string2Int(s, res)) abort();
-
-        if (res) {
-            getline(*run.from, info.deriver);
-            int nrRefs;
-            getline(*run.from, s);
-            if (!string2Int(s, nrRefs)) abort();
-            while (nrRefs--) {
-                Path p; getline(*run.from, p);
-                info.references.insert(p);
-            }
-            getline(*run.from, s);
-            long long size;
-            if (!string2Int(s, size)) abort();
-            info.downloadSize = size;
-            return true;
-        }
+    if (!res) return false;
+    
+    getline(*run.from, info.deriver);
+    int nrRefs;
+    getline(*run.from, s);
+    if (!string2Int(s, nrRefs)) abort();
+    while (nrRefs--) {
+        Path p; getline(*run.from, p);
+        info.references.insert(p);
     }
+    getline(*run.from, s);
+    long long size;
+    if (!string2Int(s, size)) abort();
+    info.downloadSize = size;
     
+    return true;
+}
+
+
+bool LocalStore::querySubstitutablePathInfo(const Path & path,
+    SubstitutablePathInfo & info)
+{
+    foreach (Paths::iterator, i, substituters)
+        if (querySubstitutablePathInfo(*i, path, info)) return true;
     return false;
 }