aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-13 16:32:34 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-13 16:32:34 +0000
commit2bd98ca1ec0962e7ca677fd32b6a8aec89c111e2 (patch)
tree550d0e5ff111714f3c3aeb324a469ac677953064
parent147cce38085919b5baf90c3fd200e6ea56f2cded (diff)
downloadpaludis-2bd98ca1ec0962e7ca677fd32b6a8aec89c111e2.tar.gz
paludis-2bd98ca1ec0962e7ca677fd32b6a8aec89c111e2.tar.xz
Support ${root} in environment.conf, for the world file.
-rw-r--r--NEWS6
-rw-r--r--doc/configuration/environment.html.part.in8
-rw-r--r--paludis/environments/paludis/paludis_config.cc8
3 files changed, 20 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c3cc318..87dd8b2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ News for Paludis
This file lists the major changes between versions. For a more detailed list
of every change, see the ChangeLog.
+trunk/:
+ * paludis now supports ${root} in environment.conf. This can be
+ used when defining the "world" key, so that the configuration
+ works when the filesystem is mounted as a chroot as a seperate
+ directory.
+
0.26.0_pre1:
* paludis now rebuilds the VDB names and provides caches
incrementally after each install and uninstall. This can give a
diff --git a/doc/configuration/environment.html.part.in b/doc/configuration/environment.html.part.in
index 8a44ac5..b3f096c 100644
--- a/doc/configuration/environment.html.part.in
+++ b/doc/configuration/environment.html.part.in
@@ -24,3 +24,11 @@ key=value configuration file, and may optionally be in bash format. Recognised k
<dd>If set, overrides the distribution used when distribution-specific defaults are used.</dd>
</dl>
+<p>The following keys are predefined. They should not be modified.</p>
+
+<dl>
+ <dt>root</dt>
+ <dd>The filesystem root. Relevant if <code>specpath.conf</code> is in use. Using this variable can create a
+ configuration system that works both inside and outside of a chroot (e.g. <code>world =
+ ${root}/var/db/pkg/world</code>).</dd>
+</dl>
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index f8969d6..810bdd8 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -145,10 +145,14 @@ namespace paludis
Context context("When loading environment.conf:");
tr1::shared_ptr<KeyValueConfigFile> kv;
+ tr1::shared_ptr<Map<std::string, std::string> > conf_vars(
+ new Map<std::string, std::string>);
+ conf_vars->insert("ROOT", root);
+ conf_vars->insert("root", root);
tr1::shared_ptr<FSEntry> world_file;
if ((FSEntry(config_dir) / "environment.conf").exists())
- kv.reset(new KeyValueConfigFile(FSEntry(config_dir) / "environment.conf", KeyValueConfigFileOptions()));
+ kv.reset(new KeyValueConfigFile(FSEntry(config_dir) / "environment.conf", KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
else if ((FSEntry(config_dir) / "environment.bash").exists())
{
std::stringstream s;
@@ -158,7 +162,7 @@ namespace paludis
.with_stderr_prefix("environment.bash> ")
.with_captured_stdout_stream(&s));
int exit_status(run_command(cmd));
- kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions()));
+ kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
if (exit_status != 0)
{