diff options
author | 2011-03-20 18:57:57 +0000 | |
---|---|---|
committer | 2011-03-20 18:57:57 +0000 | |
commit | 42ed4b3ffb46932a7315c0b08a1cb27ad789a823 (patch) | |
tree | c4090aaf090c804ceba1c6c0cf68ee703fbd6669 /paludis/environments/paludis | |
parent | 8815d142c5245fd3969f547eb76c233b767ff6ce (diff) | |
download | paludis-42ed4b3ffb46932a7315c0b08a1cb27ad789a823.tar.gz paludis-42ed4b3ffb46932a7315c0b08a1cb27ad789a823.tar.xz |
Move env var names into header
Diffstat (limited to 'paludis/environments/paludis')
-rw-r--r-- | paludis/environments/paludis/bashable_conf.cc | 9 | ||||
-rw-r--r-- | paludis/environments/paludis/paludis_config.cc | 17 | ||||
-rw-r--r-- | paludis/environments/paludis/paludis_environment.cc | 11 |
3 files changed, 21 insertions, 16 deletions
diff --git a/paludis/environments/paludis/bashable_conf.cc b/paludis/environments/paludis/bashable_conf.cc index 53c69e04c..95f03941f 100644 --- a/paludis/environments/paludis/bashable_conf.cc +++ b/paludis/environments/paludis/bashable_conf.cc @@ -17,7 +17,8 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "bashable_conf.hh" +#include <paludis/environments/paludis/bashable_conf.hh> + #include <paludis/util/config_file.hh> #include <paludis/util/is_file_with_extension.hh> #include <paludis/util/stringify.hh> @@ -28,6 +29,8 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/options.hh> #include <paludis/util/fs_path.hh> +#include <paludis/util/env_var_names.hh> + #include <functional> using namespace paludis; @@ -58,7 +61,7 @@ paludis::paludis_environment::make_bashable_conf(const FSPath & f, const LineCon Process process(ProcessCommand({ "bash", stringify(f) })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr(f.basename() + "> ") .capture_stdout(s); int exit_status(process.run().wait()); @@ -92,7 +95,7 @@ paludis::paludis_environment::make_bashable_kv_conf(const FSPath & f, Process process(ProcessCommand({ "bash", stringify(f) })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr(f.basename() + "> ") .capture_stdout(s); for (Map<std::string, std::string>::ConstIterator i(predefined_variables->begin()), diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc index 1376648bb..decf0795f 100644 --- a/paludis/environments/paludis/paludis_config.cc +++ b/paludis/environments/paludis/paludis_config.cc @@ -51,6 +51,7 @@ #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/fs_error.hh> +#include <paludis/util/env_var_names.hh> #include <paludis/distribution.hh> #include <paludis/repository_factory.hh> @@ -225,7 +226,7 @@ namespace paludis suggestions_conf(std::make_shared<SuggestionsConf>(e)), has_general_conf(false), accept_all_breaks_portage(false), - reduced_username(getenv_with_default("PALUDIS_REDUCED_USERNAME", "paludisbuild")), + reduced_username(getenv_with_default(env_vars::reduced_username, "paludisbuild")), commandline_environment(std::make_shared<Map<std::string, std::string>>()) { } @@ -268,7 +269,7 @@ namespace paludis Process process(ProcessCommand({ "bash", stringify(FSPath(config_dir) / "general.bash") })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr("general.bash> ") .capture_stdout(s); int exit_status(process.run().wait()); @@ -308,7 +309,7 @@ namespace paludis Process process(ProcessCommand({ "bash", stringify(FSPath(config_dir) / "environment.bash") })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr("general.bash> ") .capture_stdout(s); int exit_status(process.run().wait()); @@ -417,7 +418,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s } } - _imp->local_config_dir = FSPath(getenv_with_default("PALUDIS_HOME", getenv_or_error("HOME"))) / + _imp->local_config_dir = FSPath(getenv_with_default(env_vars::home, getenv_or_error("HOME"))) / (".paludis" + local_config_suffix); FSPath old_config_dir(_imp->local_config_dir); @@ -700,7 +701,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s std::list<FSPath> files; files.push_back(_imp->local_config_dir / (dist->output_filename_part() + ".conf")); files.push_back(_imp->local_config_dir / (dist->output_filename_part() + ".bash")); - files.push_back(FSPath(getenv_with_default("PALUDIS_DEFAULT_OUTPUT_CONF", + files.push_back(FSPath(getenv_with_default(env_vars::default_output_conf, SHAREDIR "/paludis/environments/paludis/default_output.conf"))); if ((_imp->local_config_dir / (dist->output_filename_part() + ".conf.d")).stat().exists()) { @@ -931,7 +932,7 @@ PaludisConfig::repo_func_from_file(const FSPath & repo_file) Process process(ProcessCommand({ "bash", stringify(_imp->local_config_dir / (dist->repository_defaults_filename_part() + ".bash")) + "'" })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr(dist->repository_defaults_filename_part() + ".bash> ") .capture_stdout(s); int exit_status(process.run().wait()); @@ -953,7 +954,7 @@ PaludisConfig::repo_func_from_file(const FSPath & repo_file) Process process(ProcessCommand({ "bash", stringify(repo_file) })); process .setenv("PALUDIS_LOG_LEVEL", stringify(Log::get_instance()->log_level())) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")) + .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) .prefix_stderr(repo_file.basename() + "> ") .capture_stdout(s); int exit_status(process.run().wait()); @@ -1164,7 +1165,7 @@ PaludisConfig::distribution() const _imp->need_general_conf(); if (_imp->distribution.empty()) - _imp->distribution = getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION); + _imp->distribution = getenv_with_default(env_vars::distribution, DEFAULT_DISTRIBUTION); return _imp->distribution; } diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc index 900b952c4..5f0c6ba99 100644 --- a/paludis/environments/paludis/paludis_environment.cc +++ b/paludis/environments/paludis/paludis_environment.cc @@ -28,7 +28,6 @@ #include <paludis/environments/paludis/world.hh> #include <paludis/environments/paludis/suggestions_conf.hh> -#include <paludis/util/config_file.hh> #include <paludis/hooker.hh> #include <paludis/hook.hh> #include <paludis/set_file.hh> @@ -40,6 +39,7 @@ #include <paludis/repository_factory.hh> #include <paludis/standard_output_manager.hh> +#include <paludis/util/config_file.hh> #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/log.hh> #include <paludis/util/system.hh> @@ -58,6 +58,7 @@ #include <paludis/util/fs_stat.hh> #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_error.hh> +#include <paludis/util/env_var_names.hh> #include <functional> #include <algorithm> @@ -136,7 +137,7 @@ namespace paludis if (! done_hooks) { add_one_hook(c / "hooks", true); - if (getenv_with_default("PALUDIS_NO_GLOBAL_HOOKS", "").empty()) + if (getenv_with_default(env_vars::no_global_hooks, "").empty()) { add_one_hook(FSPath(LIBEXECDIR) / "paludis" / "hooks", false); add_one_hook(FSPath(DATADIR) / "paludis" / "hooks", true); @@ -255,7 +256,7 @@ PaludisEnvironment::fetchers_dirs() const result->push_back(FSPath(_imp->config->config_dir()) / "fetchers"); - if (getenv_with_default("PALUDIS_NO_GLOBAL_FETCHERS", "").empty()) + if (getenv_with_default(env_vars::no_global_fetchers, "").empty()) { std::shared_ptr<const FSPathSequence> r(EnvironmentImplementation::fetchers_dirs()); std::copy(r->begin(), r->end(), result->back_inserter()); @@ -271,7 +272,7 @@ PaludisEnvironment::syncers_dirs() const result->push_back(FSPath(_imp->config->config_dir()) / "syncers"); - if (getenv_with_default("PALUDIS_NO_GLOBAL_SYNCERS", "").empty()) + if (getenv_with_default(env_vars::no_global_syncers, "").empty()) { std::shared_ptr<const FSPathSequence> r(EnvironmentImplementation::syncers_dirs()); std::copy(r->begin(), r->end(), result->back_inserter()); @@ -546,7 +547,7 @@ PaludisEnvironment::populate_sets() const std::list<FSPath> sets_dirs; sets_dirs.push_back(FSPath(_imp->config->config_dir()) / "sets"); - if (getenv_with_default("PALUDIS_NO_GLOBAL_SETS", "").empty()) + if (getenv_with_default(env_vars::no_global_sets, "").empty()) { sets_dirs.push_back(FSPath(LIBEXECDIR) / "paludis" / "sets"); sets_dirs.push_back(FSPath(DATADIR) / "paludis" / "sets"); |