about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-06-27T20·58-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-06-27T20·58-0400
commit1aba0bf0fa831ffee628ae50730eade5b19a544f (patch)
tree802eb8026a8357d87123a73fc49282381b5fd734 /src/libstore/build.cc
parent42f5a2fc297f841d982f07062c653b27557a3cd5 (diff)
nix-store -r: do substitutions in parallel
I.e. when multiple non-derivation arguments are passed to ‘nix-store
-r’ to be substituted, do them in parallel.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 246e0d9da86b..d5bbd540b34d 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2275,6 +2275,8 @@ public:
     /* Callback used by the worker to write to the log. */
     void handleChildOutput(int fd, const string & data);
     void handleEOF(int fd);
+
+    Path getStorePath() { return storePath; }
 };
 
 
@@ -2938,7 +2940,7 @@ unsigned int Worker::exitStatus()
 //////////////////////////////////////////////////////////////////////
 
 
-void LocalStore::buildDerivations(const PathSet & drvPaths)
+void LocalStore::buildPaths(const PathSet & drvPaths)
 {
     startNest(nest, lvlDebug,
         format("building %1%") % showPaths(drvPaths));
@@ -2947,7 +2949,10 @@ void LocalStore::buildDerivations(const PathSet & drvPaths)
 
     Goals goals;
     foreach (PathSet::const_iterator, i, drvPaths)
-        goals.insert(worker.makeDerivationGoal(*i));
+        if (isDerivation(*i))
+            goals.insert(worker.makeDerivationGoal(*i));
+        else
+            goals.insert(worker.makeSubstitutionGoal(*i));
 
     worker.run(goals);
 
@@ -2955,8 +2960,8 @@ void LocalStore::buildDerivations(const PathSet & drvPaths)
     foreach (Goals::iterator, i, goals)
         if ((*i)->getExitCode() == Goal::ecFailed) {
             DerivationGoal * i2 = dynamic_cast<DerivationGoal *>(i->get());
-            assert(i2);
-            failed.insert(i2->getDrvPath());
+            if (i2) failed.insert(i2->getDrvPath());
+            else failed.insert(dynamic_cast<SubstitutionGoal *>(i->get())->getStorePath());
         }
             
     if (!failed.empty())