aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-14 13:07:09 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-14 13:07:09 +0000
commit6a8ef36fe62c1b53572b0cf64685ece6190b22e5 (patch)
tree67681e9dfe11eec25cb0a0f543a9b027eeb7f5ee /src/libstore
parentb0aba6ec2ac09d5ecdf0068b91010cdee1caae9d (diff)
* Global configuration option `env-keep-derivations' to store pointer
to derivations in user environments. Nice for developers (since it prevents build-time-only dependencies from being GC'ed, in conjunction with `gc-keep-outputs'). Turned off by default.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/gc.cc4
-rw-r--r--src/libstore/globals.cc12
-rw-r--r--src/libstore/globals.hh2
3 files changed, 15 insertions, 3 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 4d63d46ea..98b863314 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -306,7 +306,7 @@ void collectGarbage(GCAction action, PathSet & result)
{
result.clear();
- string gcKeepOutputs = querySetting("gc-keep-outputs", "false");
+ bool gcKeepOutputs = queryBoolSetting("gc-keep-outputs", false);
/* Acquire the global GC root. This prevents
a) New roots from being added.
@@ -330,7 +330,7 @@ void collectGarbage(GCAction action, PathSet & result)
for (PathSet::const_iterator i = roots.begin(); i != roots.end(); ++i)
computeFSClosure(canonPath(*i), livePaths);
- if (gcKeepOutputs == "true") {
+ if (gcKeepOutputs) {
/* Hmz, identical to storePathRequisites in nix-store. */
for (PathSet::iterator i = livePaths.begin();
i != livePaths.end(); ++i)
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 22820f2fe..4387c8acc 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -52,7 +52,7 @@ static void readSettings()
string name, sep, value;
is >> name >> sep >> value;
if (sep != "=" || !is)
- throw Error(format("illegal configuration line `%1%'") % line);
+ throw Error(format("illegal configuration line `%1%' in `%2%'") % line % settingsFile);
settings[name] = value;
};
@@ -67,3 +67,13 @@ string querySetting(const string & name, const string & def)
map<string, string>::iterator i = settings.find(name);
return i == settings.end() ? def : i->second;
}
+
+
+bool queryBoolSetting(const string & name, bool def)
+{
+ string value = querySetting(name, def ? "true" : "false");
+ if (value == "true") return true;
+ else if (value == "false") return false;
+ else throw Error(format("configuration option `%1%' should be either `true' or `false', not `%2%'")
+ % name % value);
+}
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 0e851fd74..e2ae2ed65 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -55,5 +55,7 @@ extern bool readOnlyMode;
string querySetting(const string & name, const string & def);
+bool queryBoolSetting(const string & name, bool def);
+
#endif /* !__GLOBALS_H */