aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-17 15:18:13 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-17 15:18:13 +0200
commitd37d0127742a7574d4f48860de2e82fb523e508a (patch)
treeae22136cc2fbca64a02d14fb47c596d4ea7d865f
parenteca29bd72de5fe814fd1ae8edc8c36351a0759d8 (diff)
Settings: Add bool get()
-rw-r--r--src/download-via-ssh/download-via-ssh.cc2
-rw-r--r--src/libstore/build.cc4
-rw-r--r--src/libstore/globals.cc8
-rw-r--r--src/libstore/globals.hh2
4 files changed, 13 insertions, 3 deletions
diff --git a/src/download-via-ssh/download-via-ssh.cc b/src/download-via-ssh/download-via-ssh.cc
index d221fa8b5..b64455eb1 100644
--- a/src/download-via-ssh/download-via-ssh.cc
+++ b/src/download-via-ssh/download-via-ssh.cc
@@ -108,7 +108,7 @@ int main(int argc, char * * argv)
/* Pass on the location of the daemon client's SSH
authentication socket. */
- string sshAuthSock = settings.get("ssh-auth-sock", "");
+ string sshAuthSock = settings.get("ssh-auth-sock", string(""));
if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
string host = settings.sshSubstituterHosts.front();
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 0d290d787..8e328bae3 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1792,8 +1792,8 @@ void DerivationGoal::startBuilder()
/* Bind-mount a user-configurable set of directories from the
host file system. */
- PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", DEFAULT_CHROOT_DIRS));
- PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", ""));
+ PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", string(DEFAULT_CHROOT_DIRS)));
+ PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string("")));
dirs.insert(dirs2.begin(), dirs2.end());
for (auto & i : dirs) {
size_t p = i.find('=');
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index b410cea2e..c5abeee28 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -136,6 +136,14 @@ Strings Settings::get(const string & name, const Strings & def)
}
+bool Settings::get(const string & name, bool def)
+{
+ bool res = def;
+ _get(res, name);
+ return res;
+}
+
+
void Settings::update()
{
_get(tryFallback, "build-fallback");
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 55f082e56..c17e10d7c 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -25,6 +25,8 @@ struct Settings {
Strings get(const string & name, const Strings & def);
+ bool get(const string & name, bool def);
+
void update();
string pack();