diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-05-12 09:35:51 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-05-12 09:35:51 +0000 |
commit | 8c0b42f857b53993d95c5bc077e8f8a71028c5ac (patch) | |
tree | 8911f759371585a66cfd6b5ad604fff0a97779ba /src/libstore | |
parent | c8d3882cdc8f9e22c58af285c1996265c1af75d5 (diff) |
* An quick and dirty hack to support distributed builds.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/normalise.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc index 983d7d476..0c8a8057f 100644 --- a/src/libstore/normalise.cc +++ b/src/libstore/normalise.cc @@ -302,6 +302,7 @@ bool Normaliser::startBuild(Path nePath) /* Obtain locks on all output paths. The locks are automatically released when we exit this function or Nix crashes. */ + /* !!! BUG: this could block, which is not allowed. */ goal.outputLocks.lockPaths(goal.expr.derivation.outputs); /* Now check again whether there is a successor. This is because @@ -364,6 +365,25 @@ bool Normaliser::startBuild(Path nePath) return true; } + /* !!! Hack */ + Path buildHook = getEnv("NIX_BUILD_HOOK"); + if (buildHook != "") { + printMsg(lvlChatty, format("using build hook `%1%'") % buildHook); + int status = system((buildHook + " " + goal.nePath + " 1>&2").c_str()); + if (WIFEXITED(status)) { + int code = WEXITSTATUS(status); + if (code == 100) { /* == accepted */ + printMsg(lvlChatty, + format("build hook succesfully realised output paths")); + finishGoal(goal); + return true; + } else if (code != 101) /* != declined */ + throw Error( + format("build hook returned exit code %1%") % code); + } else throw Error( + format("build hook died with status %1%") % status); + } + /* Otherwise, start the build in a child process. */ startBuildChild(goal); @@ -660,7 +680,7 @@ void Normaliser::finishGoal(Goal & goal) { Path path = *i; if (!pathExists(path)) - throw Error(format("path `%1%' does not exist") % path); + throw Error(format("output path `%1%' does not exist") % path); nf.closure.roots.insert(path); makePathReadOnly(path); |