diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-11-16 16:15:26 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-11-16 16:15:26 +0000 |
commit | c370755583d7350f4b96136eb0a6a8a7b08551b1 (patch) | |
tree | 6e42f14440963847a4b71a142b4ace2a2523b279 /src | |
parent | c05783ad67ee95b5dd76d160efedc23b3acb0905 (diff) |
* Flag `--no-build-hook' to disable distributed builds.
* queryDeriver in daemon mode: don't barf if the other side returns an
empty string (which means there is no deriver).
Diffstat (limited to 'src')
-rw-r--r-- | src/libmain/shared.cc | 2 | ||||
-rw-r--r-- | src/libstore/build.cc | 1 | ||||
-rw-r--r-- | src/libstore/globals.cc | 1 | ||||
-rw-r--r-- | src/libstore/globals.hh | 4 | ||||
-rw-r--r-- | src/libstore/remote-store.cc | 8 | ||||
-rw-r--r-- | src/libstore/remote-store.hh | 1 | ||||
-rw-r--r-- | src/libstore/worker-protocol.hh | 3 | ||||
-rw-r--r-- | src/nix-worker/nix-worker.cc | 7 |
8 files changed, 22 insertions, 5 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index a606f0dae..09841e45b 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -212,6 +212,8 @@ static void initAndRun(int argc, char * * argv) readOnlyMode = true; else if (arg == "--max-silent-time") maxSilentTime = getIntArg(arg, i, args.end()); + else if (arg == "--no-build-hook") + useBuildHook = false; else remaining.push_back(arg); } diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 36e3b5e1d..d46286713 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1247,6 +1247,7 @@ static string makeValidityRegistration(const PathSet & paths, DerivationGoal::HookReply DerivationGoal::tryBuildHook() { + if (!useBuildHook) return rpDecline; Path buildHook = getEnv("NIX_BUILD_HOOK"); if (buildHook == "") return rpDecline; buildHook = absPath(buildHook); diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 6c4944539..eaea4b707 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -26,6 +26,7 @@ bool readOnlyMode = false; string thisSystem = "unset"; unsigned int maxSilentTime = 0; Paths substituters; +bool useBuildHook = true; static bool settingsRead = false; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index ea15da0e6..f650cd1b7 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -72,6 +72,10 @@ extern unsigned int maxSilentTime; from a CD. */ extern Paths substituters; +/* Whether to use build hooks (for distributed builds). Sometimes + users want to disable this from the command-line. */ +extern bool useBuildHook; + Strings querySetting(const string & name, const Strings & def); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 4d866071b..cc847c050 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -59,7 +59,7 @@ RemoteStore::RemoteStore() unsigned int magic = readInt(from); if (magic != WORKER_MAGIC_2) throw Error("protocol mismatch"); - unsigned int daemonVersion = readInt(from); + daemonVersion = readInt(from); if (GET_PROTOCOL_MAJOR(daemonVersion) != GET_PROTOCOL_MAJOR(PROTOCOL_VERSION)) throw Error("Nix daemon protocol version not supported"); writeInt(PROTOCOL_VERSION, to); @@ -169,6 +169,8 @@ void RemoteStore::setOptions() writeInt(verbosity, to); writeInt(maxBuildJobs, to); writeInt(maxSilentTime, to); + if (GET_PROTOCOL_MINOR(daemonVersion) >= 2) + writeInt(useBuildHook, to); processStderr(); } @@ -230,7 +232,9 @@ Path RemoteStore::queryDeriver(const Path & path) writeInt(wopQueryDeriver, to); writeString(path, to); processStderr(); - return readStorePath(from); + Path drvPath = readString(from); + if (drvPath != "") assertStorePath(drvPath); + return drvPath; } diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 79a15e11e..01cac93a4 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -71,6 +71,7 @@ private: FdSink to; FdSource from; Pid child; + unsigned int daemonVersion; void processStderr(Sink * sink = 0, Source * source = 0); diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index 22f5973a9..44db4ad9b 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -8,8 +8,9 @@ namespace nix { #define WORKER_MAGIC_1 0x6e697863 #define WORKER_MAGIC_2 0x6478696f -#define PROTOCOL_VERSION 0x101 +#define PROTOCOL_VERSION 0x102 #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00) +#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff) typedef enum { diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index 9f387a4ec..5e261aa16 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -223,7 +223,8 @@ struct TunnelSource : Source }; -static void performOp(Source & from, Sink & to, unsigned int op) +static void performOp(unsigned int clientVersion, + Source & from, Sink & to, unsigned int op) { switch (op) { @@ -422,6 +423,8 @@ static void performOp(Source & from, Sink & to, unsigned int op) verbosity = (Verbosity) readInt(from); maxBuildJobs = readInt(from); maxSilentTime = readInt(from); + if (GET_PROTOCOL_MINOR(clientVersion) >= 2) + useBuildHook = readInt(from) != 0; startWork(); stopWork(); break; @@ -492,7 +495,7 @@ static void processConnection() opCount++; try { - performOp(from, to, op); + performOp(clientVersion, from, to, op); } catch (Error & e) { stopWork(false, e.msg()); } |