about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T11·44+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T11·44+0000
commit03427e76f11fe1d918020d28bdb69b2fb348ee96 (patch)
treea9628150b6c2943e1fa99fd03f7fcf4b30ec7bf4 /src/libstore
parentb3c26180e33856f16e1e5ceea30b951065b4ebc1 (diff)
* querySubstitutablePathInfo: work properly when run via the daemon.
* --dry-run: print the paths that we don't know how to build/substitute.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/misc.cc14
-rw-r--r--src/libstore/misc.hh2
-rw-r--r--src/libstore/remote-store.cc11
-rw-r--r--src/libstore/worker-protocol.hh1
4 files changed, 20 insertions, 8 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index acf9346d4bdc..1759f521cc29 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -46,7 +46,7 @@ Path findOutput(const Derivation & drv, string id)
 
 
 void queryMissing(const PathSet & targets,
-    PathSet & willBuild, PathSet & willSubstitute)
+    PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown)
 {
     PathSet todo(targets.begin(), targets.end()), done;
 
@@ -57,7 +57,10 @@ void queryMissing(const PathSet & targets,
         done.insert(p);
 
         if (isDerivation(p)) {
-            if (!store->isValidPath(p)) continue;
+            if (!store->isValidPath(p)) {
+                unknown.insert(p);
+                continue;
+            }
             Derivation drv = derivationFromPath(p);
 
             bool mustBuild = false;
@@ -81,12 +84,11 @@ void queryMissing(const PathSet & targets,
         else {
             if (store->isValidPath(p)) continue;
             SubstitutablePathInfo info;
-            if (dynamic_cast<LocalStore *>(store.get())->querySubstitutablePathInfo(p, info)) {
+            if (store->querySubstitutablePathInfo(p, info)) {
                 willSubstitute.insert(p);
                 todo.insert(info.references.begin(), info.references.end());
-            }
-            /* Not substitutable and not buildable; should we flag
-               this? */
+            } else
+                unknown.insert(p);
         }
     }
 }
diff --git a/src/libstore/misc.hh b/src/libstore/misc.hh
index ad1ad80eb186..33d81ed4a07f 100644
--- a/src/libstore/misc.hh
+++ b/src/libstore/misc.hh
@@ -29,7 +29,7 @@ Path findOutput(const Derivation & drv, string id);
    derivations that will be built, and the set of output paths that
    will be substituted. */
 void queryMissing(const PathSet & targets,
-    PathSet & willBuild, PathSet & willSubstitute);
+    PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown);
 
 
 }
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index b7e60043d640..bc04c8adb9ab 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -216,7 +216,16 @@ bool RemoteStore::hasSubstitutes(const Path & path)
 bool RemoteStore::querySubstitutablePathInfo(const Path & path,
     SubstitutablePathInfo & info)
 {
-    throw Error("not implemented");
+    writeInt(wopQuerySubstitutablePathInfo, to);
+    writeString(path, to);
+    processStderr();
+    unsigned int reply = readInt(from);
+    if (reply == 0) return false;
+    info.deriver = readString(from);
+    if (info.deriver != "") assertStorePath(info.deriver);
+    info.references = readStorePaths(from);
+    info.downloadSize = readLongLong(from);
+    return true;
 }
 
 
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index d887ee59bd95..1146f9577025 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -33,6 +33,7 @@ typedef enum {
     wopQueryDeriver = 18,
     wopSetOptions = 19,
     wopCollectGarbage = 20,
+    wopQuerySubstitutablePathInfo = 21,
 } WorkerOp;