aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-03-29 18:00:45 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-03-29 18:00:45 +0000
commit737423a89c4b5f666fb4daf61775764b66911cf1 (patch)
tree883fee6aebdc231a721f372753f21d44ba020226 /src/libstore/build.cc
parent47706e3924cf592a4e0085eb2e45f0e84b67f933 (diff)
* Use polling to wait for a remote build slot when using a build hook
(that is, call the build hook with a certain interval until it accepts the build). * build-remote.pl was totally broken: for all system types other than the local system type, it would send all builds to the *first* machine of the appropriate type.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc32
1 files changed, 1 insertions, 31 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 6c24a2746..d80c67358 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -52,9 +52,6 @@ namespace nix {
using std::map;
-/* !!! TODO derivationFromPath shouldn't be used here */
-
-
static string pathNullDevice = "/dev/null";
@@ -229,9 +226,6 @@ public:
/* Can we start another child process? */
bool canBuildMore();
- /* Can we postpone a build right now? */
- bool canPostpone();
-
/* Registers a running child process. `inBuildSlot' means that
the process counts towards the jobs limit. */
void childStarted(GoalPtr goal, pid_t pid,
@@ -247,10 +241,6 @@ public:
might be right away). */
void waitForBuildSlot(GoalPtr goal);
- /* Put `goal' to sleep until a child process terminates, i.e., a
- call is made to childTerminate(..., true). */
- void waitForChildTermination(GoalPtr goal);
-
/* Wait for any goal to finish. Pretty indiscriminate way to
wait for some resource that some other goal is holding. */
void waitForAnyGoal(GoalPtr goal);
@@ -1041,7 +1031,7 @@ void DerivationGoal::tryToBuild()
return;
case rpPostpone:
/* Not now; wait until at least one child finishes. */
- worker.waitForChildTermination(shared_from_this());
+ worker.waitForAWhile(shared_from_this());
outputLocks.unlock();
return;
case rpDecline:
@@ -1246,7 +1236,6 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
thisSystem.c_str(),
drv.platform.c_str(),
drvPath.c_str(),
- (worker.canPostpone() ? (string) "0" : "1").c_str(),
(format("%1%") % maxSilentTime).str().c_str(),
NULL);
@@ -2243,8 +2232,6 @@ void SubstitutionGoal::tryToRun()
logPipe.readSide.close();
- /* !!! close other handles */
-
commonChildInit(logPipe);
/* Fill in the arguments. */
@@ -2286,7 +2273,6 @@ void SubstitutionGoal::finished()
/* Since we got an EOF on the logger pipe, the substitute is
presumed to have terminated. */
- /* !!! this could block! */
pid_t savedPid = pid;
int status = pid.wait(true);
@@ -2469,12 +2455,6 @@ bool Worker::canBuildMore()
}
-bool Worker::canPostpone()
-{
- return children.size() != 0;
-}
-
-
void Worker::childStarted(GoalPtr goal,
pid_t pid, const set<int> & fds, bool inBuildSlot)
{
@@ -2527,16 +2507,6 @@ void Worker::waitForBuildSlot(GoalPtr goal)
}
-void Worker::waitForChildTermination(GoalPtr goal)
-{
- debug("wait for child termination");
- if (children.size() == 0)
- throw Error("waiting for a build slot, yet there are no running children - "
- "maybe the build hook gave an inappropriate `postpone' reply?");
- wantingToBuild.insert(goal);
-}
-
-
void Worker::waitForAnyGoal(GoalPtr goal)
{
debug("wait for any goal");