about summary refs log tree commit diff
path: root/src/libstore/normalise.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/normalise.cc')
-rw-r--r--src/libstore/normalise.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index b6746689e301..02089c929fdf 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -284,6 +284,9 @@ bool Normaliser::startBuild(Path nePath)
 {
     checkInterrupt();
 
+    if (maxBuildJobs > 0 && building.size() >= maxBuildJobs)
+        return false;
+
     Goals::iterator goalIt = goals.find(nePath);
     assert(goalIt != goals.end());
     Goal & goal(goalIt->second);
@@ -414,11 +417,6 @@ bool Normaliser::startBuild(Path nePath)
             format("build hook died with status %1%") % status);
     }
 
-    /* Right platform? */
-    if (goal.expr.derivation.platform != thisSystem)
-        throw Error(format("a `%1%' is required, but I am a `%2%'")
-		    % goal.expr.derivation.platform % thisSystem);
-
     /* Otherwise, start the build in a child process. */
     startBuildChild(goal);
 
@@ -428,6 +426,11 @@ bool Normaliser::startBuild(Path nePath)
 
 void Normaliser::startBuildChild(Goal & goal)
 {
+    /* Right platform? */
+    if (goal.expr.derivation.platform != thisSystem)
+        throw Error(format("a `%1%' is required, but I am a `%2%'")
+		    % goal.expr.derivation.platform % thisSystem);
+
     /* If any of the outputs already exist but are not registered,
        delete them. */
     for (PathSet::iterator i = goal.expr.derivation.outputs.begin();