aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-27 13:12:38 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-27 13:12:38 +0100
commit87a36cc419099f6141ef0f0fa31e51df994ae1a5 (patch)
treea4e276fa575de96ec9cf74e9f555f1aa57d49af1
parenteb518df671b06ce805da858bf238493639cc6a2a (diff)
downloadpaludis-87a36cc419099f6141ef0f0fa31e51df994ae1a5.tar.gz
paludis-87a36cc419099f6141ef0f0fa31e51df994ae1a5.tar.xz
Allow ${ENV{FOO}} in paludis .conf files
-rw-r--r--doc/configuration/configfiles.html.part4
-rw-r--r--paludis/environments/paludis/output_conf.cc2
-rw-r--r--paludis/environments/paludis/paludis_config.cc20
3 files changed, 13 insertions, 13 deletions
diff --git a/doc/configuration/configfiles.html.part b/doc/configuration/configfiles.html.part
index d16fbaf..1477a0e 100644
--- a/doc/configuration/configfiles.html.part
+++ b/doc/configuration/configfiles.html.part
@@ -11,8 +11,8 @@ backslash are continuations.</p>
<h2>Key=Value Files</h2>
<p>Some configuration files use a key=value format. Keys are typically case sensitive. Variable expansion of previously
-set variables is supported via <code>$var</code> or <code>${var}</code>. Quoting with single or double quotes is usually
-supported but not usually required.</p>
+set variables is supported via <code>$var</code> or <code>${var}</code>, and environment variables may be obtained using
+<code>${ENV{NAME}}</code>. Quoting with single or double quotes is usually supported but not usually required.</p>
<h2>Bash Files</h2>
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index 21407d4..f490ed2 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -333,7 +333,7 @@ OutputConf::add(const FSPath & filename)
Context context("When adding source '" + stringify(filename) + "' as an output file:");
std::shared_ptr<KeyValueConfigFile> f(make_bashable_kv_conf(filename,
- _imp->predefined_variables, { kvcfo_allow_sections, kvcfo_allow_fancy_assigns }));
+ _imp->predefined_variables, { kvcfo_allow_sections, kvcfo_allow_fancy_assigns, kvcfo_allow_env }));
if (! f)
return;
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 8d50b18..1538c2f 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -251,7 +251,7 @@ namespace paludis
{
kv = std::make_shared<KeyValueConfigFile>(
FSPath(config_dir) / "general.conf",
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
}
@@ -267,7 +267,7 @@ namespace paludis
int exit_status(process.run().wait());
kv = std::make_shared<KeyValueConfigFile>(
s,
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
@@ -287,7 +287,7 @@ namespace paludis
kv = std::make_shared<KeyValueConfigFile>(
FSPath(config_dir) / "environment.conf",
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
}
@@ -307,7 +307,7 @@ namespace paludis
int exit_status(process.run().wait());
kv = std::make_shared<KeyValueConfigFile>(
s,
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
@@ -446,7 +446,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
{
specpath = std::make_shared<KeyValueConfigFile>(
local_config_dir / "specpath.conf",
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
}
@@ -455,7 +455,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
std::istringstream strm;
specpath = std::make_shared<KeyValueConfigFile>(
strm,
- KeyValueConfigFileOptions(),
+ KeyValueConfigFileOptions() + kvcfo_allow_env,
def_predefined,
&KeyValueConfigFile::no_transformation);
}
@@ -529,7 +529,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
if ((local_config_dir / (dist->repository_defaults_filename_part() + ".conf")).stat().exists())
{
_imp->predefined_conf_vars_func = std::bind(&from_kv, std::make_shared<KeyValueConfigFile>(
- local_config_dir / (dist->repository_defaults_filename_part() + ".conf"), KeyValueConfigFileOptions(),
+ local_config_dir / (dist->repository_defaults_filename_part() + ".conf"), KeyValueConfigFileOptions() + kvcfo_allow_env,
std::bind(&to_kv_func, _imp->predefined_conf_vars_func, std::placeholders::_1, std::placeholders::_2),
&KeyValueConfigFile::no_transformation),
std::placeholders::_1);
@@ -545,7 +545,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
.capture_stdout(s);
int exit_status(process.run().wait());
_imp->predefined_conf_vars_func = std::bind(&from_kv, std::make_shared<KeyValueConfigFile>(
- s, KeyValueConfigFileOptions(),
+ s, KeyValueConfigFileOptions() + kvcfo_allow_env,
std::bind(&to_kv_func, _imp->predefined_conf_vars_func, std::placeholders::_1, std::placeholders::_2),
&KeyValueConfigFile::no_transformation),
std::placeholders::_1);
@@ -867,7 +867,7 @@ PaludisConfig::repo_func_from_file(const FSPath & repo_file)
.prefix_stderr(repo_file.basename() + "> ")
.capture_stdout(s);
int exit_status(process.run().wait());
- kv = std::make_shared<KeyValueConfigFile>(s, KeyValueConfigFileOptions(),
+ kv = std::make_shared<KeyValueConfigFile>(s, KeyValueConfigFileOptions() + kvcfo_allow_env,
std::bind(&to_kv_func, _imp->predefined_conf_vars_func, std::placeholders::_1, std::placeholders::_2),
&KeyValueConfigFile::no_transformation);
@@ -879,7 +879,7 @@ PaludisConfig::repo_func_from_file(const FSPath & repo_file)
}
}
else
- kv = std::make_shared<KeyValueConfigFile>(repo_file, KeyValueConfigFileOptions(),
+ kv = std::make_shared<KeyValueConfigFile>(repo_file, KeyValueConfigFileOptions() + kvcfo_allow_env,
std::bind(&to_kv_func, _imp->predefined_conf_vars_func, std::placeholders::_1, std::placeholders::_2),
&KeyValueConfigFile::no_transformation);