From 174b68a2a2e9e58fa1a1a0036858a566c51684dc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 May 2017 12:16:29 +0200 Subject: build-hook: If there are no machines defined, quit permanently --- src/build-remote/build-remote.cc | 5 +++++ src/libstore/build.cc | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index acf571ff1563..388f1e04686a 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -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);) { diff --git a/src/libstore/build.cc b/src/libstore/build.cc index a9649ea378ca..e756d3377c34 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -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); -- cgit 1.4.1