diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-11-16T16·15+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-11-16T16·15+0000 |
commit | c370755583d7350f4b96136eb0a6a8a7b08551b1 (patch) | |
tree | 6e42f14440963847a4b71a142b4ace2a2523b279 /src/libstore | |
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/libstore')
-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 |
6 files changed, 15 insertions, 3 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 36e3b5e1dd8b..d46286713253 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 6c4944539d5e..eaea4b707eea 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 ea15da0e644b..f650cd1b79b5 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 4d866071b181..cc847c050484 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 79a15e11ef9d..01cac93a4ccb 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 22f5973a96ee..44db4ad9b141 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 { |