about summary refs log tree commit diff
path: root/src/libstore/build.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/build.cc
parent5b1052663a35940fc99ae6a8fcf6e707ae939fef (diff)
* build.cc: only use a substituter if it returns info for a path.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 22f1c64ae3..33a53c148f 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2187,14 +2187,34 @@ void SubstitutionGoal::init()
         return;
     }
 
-    if (!worker.store.querySubstitutablePathInfo(storePath, info)) {
+    subs = substituters;
+    
+    tryNext();
+}
+
+
+void SubstitutionGoal::tryNext()
+{
+    trace("trying next substituter");
+
+    if (subs.size() == 0) {
+        /* None left.  Terminate this goal and let someone else deal
+           with it. */
         printMsg(lvlError,
-            format("path `%1%' is required, but there is no substituter that knows anything about it")
+            format("path `%1%' is required, but there is no substituter that can build it")
             % storePath);
         amDone(ecFailed);
         return;
     }
 
+    sub = subs.front();
+    subs.pop_front();
+
+    if (!worker.store.querySubstitutablePathInfo(sub, storePath, info)) {
+        tryNext();
+        return;
+    }
+
     /* To maintain the closure invariant, we first have to realise the
        paths referenced by this one. */
     foreach (PathSet::iterator, i, info.references)
@@ -2223,29 +2243,6 @@ void SubstitutionGoal::referencesValid()
         if (*i != storePath) /* ignore self-references */
             assert(worker.store.isValidPath(*i));
 
-    subs = substituters;
-
-    tryNext();
-}
-
-
-void SubstitutionGoal::tryNext()
-{
-    trace("trying next substituter");
-
-    if (subs.size() == 0) {
-        /* None left.  Terminate this goal and let someone else deal
-           with it. */
-        printMsg(lvlError,
-            format("path `%1%' is required, but there is no substituter that can build it")
-            % storePath);
-        amDone(ecFailed);
-        return;
-    }
-
-    sub = subs.front();
-    subs.pop_front();
-
     state = &SubstitutionGoal::tryToRun;
     worker.waitForBuildSlot(shared_from_this());
 }