diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-31 18:19:44 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-31 18:19:44 -0400 |
commit | 90d9c58d4dabb370849cd523fb9ee471e8140b76 (patch) | |
tree | caa1ed9ad85e20106df6ad2ab396e46524953b37 | |
parent | 89a8207029e7f6d5cfe3ab972c49ea46f5b9a784 (diff) |
Pass all --option flags to the daemon
-rw-r--r-- | src/libstore/globals.cc | 7 | ||||
-rw-r--r-- | src/libstore/globals.hh | 8 | ||||
-rw-r--r-- | src/libstore/remote-store.cc | 10 | ||||
-rw-r--r-- | src/nix-worker/nix-worker.cc | 8 |
4 files changed, 30 insertions, 3 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index f5f4f15f0..bfb40a07a 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -113,6 +113,7 @@ void Settings::loadConfFile() void Settings::set(const string & name, const string & value) { settings[name] = value; + overrides[name] = value; } @@ -193,4 +194,10 @@ string Settings::pack() } +Settings::SettingsMap Settings::getOverrides() +{ + return overrides; +} + + } diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 5783d9bf3..1fb196db2 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -10,6 +10,8 @@ namespace nix { struct Settings { + typedef std::map<string, string> SettingsMap; + Settings(); void processEnvironment(); @@ -22,6 +24,8 @@ struct Settings { string pack(); + SettingsMap getOverrides(); + /* The directory where we store sources and derived files. */ Path nixStore; @@ -172,9 +176,7 @@ struct Settings { bool envKeepDerivations; private: - typedef std::map<string, string> SettingsMap; - - SettingsMap settings; + SettingsMap settings, overrides; void get(string & res, const string & name); void get(bool & res, const string & name); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index c67e53bfb..56396541a 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -184,6 +184,7 @@ RemoteStore::~RemoteStore() void RemoteStore::setOptions() { writeInt(wopSetOptions, to); + writeInt(settings.keepFailed, to); writeInt(settings.keepGoing, to); writeInt(settings.tryFallback, to); @@ -202,6 +203,15 @@ void RemoteStore::setOptions() if (GET_PROTOCOL_MINOR(daemonVersion) >= 10) writeInt(settings.useSubstitutes, to); + if (GET_PROTOCOL_MINOR(daemonVersion) >= 12) { + Settings::SettingsMap overrides = settings.getOverrides(); + writeInt(overrides.size(), to); + foreach (Settings::SettingsMap::iterator, i, overrides) { + writeString(i->first, to); + writeString(i->second, to); + } + } + processStderr(); } diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index 84ad68904..8ccafca29 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -544,6 +544,14 @@ static void performOp(unsigned int clientVersion, settings.buildCores = readInt(from); if (GET_PROTOCOL_MINOR(clientVersion) >= 10) settings.useSubstitutes = readInt(from) != 0; + if (GET_PROTOCOL_MINOR(clientVersion) >= 12) { + unsigned int n = readInt(from); + for (unsigned int i = 0; i < n; i++) { + string name = readString(from); + string value = readString(from); + settings.set("untrusted-" + name, value); + } + } startWork(); stopWork(); break; |