Skip to content

Commit

Permalink
build-hook: If there are no machines defined, quit permanently
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed May 2, 2017
1 parent 70581b6 commit 174b68a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/build-remote/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ int main (int argc, char * * argv)
auto machines = readConf();
debug("got %d remote builders", machines.size());

if (machines.empty()) {
std::cerr << "# decline-permanently\n";
return;
}

string drvPath;
string storeUri;
for (string line; getline(cin, line);) {
Expand Down
11 changes: 9 additions & 2 deletions src/libstore/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1598,8 +1598,15 @@ HookReply DerivationGoal::tryBuildHook()

debug(format("hook reply is ‘%1%’") % reply);

if (reply == "decline" || reply == "postpone")
return reply == "decline" ? rpDecline : rpPostpone;
if (reply == "decline")
return rpDecline;
else if (reply == "decline-permanently") {
settings.useBuildHook = false;
worker.hook = 0;
return rpDecline;
}
else if (reply == "postpone")
return rpPostpone;
else if (reply != "accept")
throw Error(format("bad hook reply ‘%1%’") % reply);

Expand Down

0 comments on commit 174b68a

Please sign in to comment.