diff options
author | 2011-03-20 18:57:57 +0000 | |
---|---|---|
committer | 2011-03-20 18:57:57 +0000 | |
commit | 42ed4b3ffb46932a7315c0b08a1cb27ad789a823 (patch) | |
tree | c4090aaf090c804ceba1c6c0cf68ee703fbd6669 | |
parent | 8815d142c5245fd3969f547eb76c233b767ff6ce (diff) | |
download | paludis-42ed4b3ffb46932a7315c0b08a1cb27ad789a823.tar.gz paludis-42ed4b3ffb46932a7315c0b08a1cb27ad789a823.tar.xz |
Move env var names into header
24 files changed, 218 insertions, 71 deletions
diff --git a/paludis/distribution.cc b/paludis/distribution.cc index 740f6e481..6f6c9d9f6 100644 --- a/paludis/distribution.cc +++ b/paludis/distribution.cc @@ -18,6 +18,7 @@ */ #include <paludis/distribution-impl.hh> + #include <paludis/util/config_file.hh> #include <paludis/util/destringify.hh> #include <paludis/util/hashes.hh> @@ -29,6 +30,8 @@ #include <paludis/util/strip.hh> #include <paludis/util/system.hh> #include <paludis/util/fs_iterator.hh> +#include <paludis/util/env_var_names.hh> + #include <unordered_map> using namespace paludis; @@ -53,7 +56,7 @@ namespace paludis { Context c("When loading distribution data:"); - for (FSIterator d(FSPath(getenv_with_default("PALUDIS_DISTRIBUTIONS_DIR", DATADIR "/paludis/distributions")), { }), d_end ; + for (FSIterator d(FSPath(getenv_with_default(env_vars::distributions_dir, DATADIR "/paludis/distributions")), { }), d_end ; d != d_end ; ++d) { if (! is_file_with_extension(*d, ".conf", { })) diff --git a/paludis/environment_factory.cc b/paludis/environment_factory.cc index 45462de76..f03071f03 100644 --- a/paludis/environment_factory.cc +++ b/paludis/environment_factory.cc @@ -18,6 +18,7 @@ */ #include <paludis/environment_factory.hh> + #include <paludis/util/singleton-impl.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/system.hh> @@ -26,10 +27,14 @@ #include <paludis/util/is_file_with_extension.hh> #include <paludis/util/set.hh> #include <paludis/util/wrapped_forward_iterator.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/distribution.hh> #include <paludis/about.hh> + #include <unordered_map> #include <list> + #include "config.h" using namespace paludis; @@ -101,7 +106,7 @@ EnvironmentFactory::create(const std::string & s) const if (key.empty()) key = (*DistributionData::get_instance()->distribution_from_string( - getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))).default_environment(); + getenv_with_default(env_vars::distribution, DEFAULT_DISTRIBUTION))).default_environment(); try { @@ -114,7 +119,7 @@ EnvironmentFactory::create(const std::string & s) const catch (const FallBackToAnotherFormatError &) { std::string f((*DistributionData::get_instance()->distribution_from_string( - getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))).fallback_environment()); + getenv_with_default(env_vars::distribution, DEFAULT_DISTRIBUTION))).fallback_environment()); if (s.empty() && ! f.empty()) { Keys::const_iterator i(_imp->keys.find(f)); diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc index c5236d636..dda236abf 100644 --- a/paludis/environment_implementation.cc +++ b/paludis/environment_implementation.cc @@ -21,6 +21,11 @@ #include <paludis/package_id.hh> #include <paludis/metadata_key.hh> #include <paludis/package_database.hh> +#include <paludis/hook.hh> +#include <paludis/distribution.hh> +#include <paludis/selection.hh> +#include <paludis/selection_cache.hh> + #include <paludis/util/log.hh> #include <paludis/util/save.hh> #include <paludis/util/set.hh> @@ -32,13 +37,12 @@ #include <paludis/util/wrapped_output_iterator.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/hook.hh> -#include <paludis/distribution.hh> -#include <paludis/selection.hh> -#include <paludis/selection_cache.hh> +#include <paludis/util/env_var_names.hh> + #include <algorithm> #include <map> #include <list> + #include "config.h" using namespace paludis; @@ -152,7 +156,7 @@ std::shared_ptr<const FSPathSequence> EnvironmentImplementation::fetchers_dirs() const { std::shared_ptr<FSPathSequence> result(std::make_shared<FSPathSequence>()); - std::string fetchers_dir(getenv_with_default("PALUDIS_FETCHERS_DIR", "")); + std::string fetchers_dir(getenv_with_default(env_vars::fetchers_dir, "")); if (fetchers_dir.empty()) { result->push_back(FSPath(DATADIR "/paludis/fetchers")); @@ -166,7 +170,7 @@ EnvironmentImplementation::fetchers_dirs() const std::string EnvironmentImplementation::distribution() const { - static const std::string result(getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)); + static const std::string result(getenv_with_default(env_vars::distribution, DEFAULT_DISTRIBUTION)); return result; } 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"); diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc index eb1ace491..980787c36 100644 --- a/paludis/environments/portage/portage_environment.cc +++ b/paludis/environments/portage/portage_environment.cc @@ -41,6 +41,7 @@ #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_error.hh> #include <paludis/util/make_null_shared_ptr.hh> +#include <paludis/util/env_var_names.hh> #include <paludis/standard_output_manager.hh> #include <paludis/hooker.hh> @@ -162,7 +163,7 @@ namespace paludis { if (! done_hooks) { - 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"); done_hooks = true; @@ -744,8 +745,8 @@ std::shared_ptr<const FSPathSequence> PortageEnvironment::bashrc_files() const { std::shared_ptr<FSPathSequence> result(std::make_shared<FSPathSequence>()); - if (! getenv_with_default("PALUDIS_PORTAGE_BASHRC", "").empty()) - result->push_back(FSPath(getenv_with_default("PALUDIS_PORTAGE_BASHRC", "")).realpath()); + if (! getenv_with_default(env_vars::portage_bashrc, "").empty()) + result->push_back(FSPath(getenv_with_default(env_vars::portage_bashrc, "")).realpath()); else result->push_back(FSPath(LIBEXECDIR) / "paludis" / "environments" / "portage" / "bashrc"); result->push_back(_imp->conf_dir / "make.globals"); diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc index d8fbc8abc..700f9a92c 100644 --- a/paludis/environments/test/test_environment.cc +++ b/paludis/environments/test/test_environment.cc @@ -18,6 +18,7 @@ */ #include <paludis/environments/test/test_environment.hh> + #include <paludis/util/pimp-impl.hh> #include <paludis/util/set.hh> #include <paludis/util/wrapped_forward_iterator.hh> @@ -28,6 +29,8 @@ #include <paludis/util/destringify.hh> #include <paludis/util/system.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/standard_output_manager.hh> #include <paludis/package_database.hh> #include <paludis/package_id.hh> @@ -35,6 +38,7 @@ #include <paludis/user_dep_spec.hh> #include <paludis/choice.hh> #include <paludis/literal_metadata_key.hh> + #include <functional> #include <unordered_map> #include <string> @@ -139,13 +143,13 @@ TestEnvironment::fetch_package_id(const QualifiedPackageName & q, uid_t TestEnvironment::reduced_uid() const { - return destringify<int>(getenv_with_default("PALUDIS_REDUCED_UID", stringify(getuid()))); + return destringify<int>(getenv_with_default(env_vars::reduced_uid, stringify(getuid()))); } gid_t TestEnvironment::reduced_gid() const { - return destringify<int>(getenv_with_default("PALUDIS_REDUCED_GID", stringify(getgid()))); + return destringify<int>(getenv_with_default(env_vars::reduced_gid, stringify(getgid()))); } std::shared_ptr<const MirrorsSequence> diff --git a/paludis/hooker.cc b/paludis/hooker.cc index f9555ed1d..88123e14d 100644 --- a/paludis/hooker.cc +++ b/paludis/hooker.cc @@ -18,11 +18,14 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "hooker.hh" -#include "config.h" +#include <paludis/hooker.hh> #include <paludis/environment.hh> #include <paludis/hook.hh> #include <paludis/package_database.hh> +#include <paludis/about.hh> +#include <paludis/output_manager.hh> +#include <paludis/metadata_key.hh> + #include <paludis/util/log.hh> #include <paludis/util/is_file_with_extension.hh> #include <paludis/util/system.hh> @@ -38,15 +41,15 @@ #include <paludis/util/process.hh> #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_stat.hh> -#include <paludis/about.hh> -#include <paludis/output_manager.hh> -#include <paludis/metadata_key.hh> +#include <paludis/util/env_var_names.hh> #include <list> #include <iterator> #include <dlfcn.h> #include <stdint.h> +#include "config.h" + using namespace paludis; template class Sequence<std::shared_ptr<HookFile> >; @@ -173,7 +176,7 @@ BashHookFile::run( .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_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")) .setenv("PALUDIS_REDUCED_GID", stringify(_env->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(_env->reduced_uid())) .setenv("PALUDIS_COMMAND", _env->paludis_command()); @@ -227,7 +230,7 @@ FancyHookFile::run(const Hook & hook, Log::get_instance()->message("hook.fancy.starting", ll_debug, lc_no_context) << "Starting hook script '" << file_name() << "' for '" << hook.name() << "'"; - Process process(ProcessCommand({ "sh", "-c", getenv_with_default("PALUDIS_HOOKER_DIR", LIBEXECDIR "/paludis") + + Process process(ProcessCommand({ "sh", "-c", getenv_with_default(env_vars::hooker_dir, LIBEXECDIR "/paludis") + "/hooker.bash '" + stringify(file_name()) + "' 'hook_run_" + stringify(hook.name()) + "'" })); process @@ -235,7 +238,7 @@ FancyHookFile::run(const Hook & hook, .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_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")) .setenv("PALUDIS_REDUCED_GID", stringify(_env->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(_env->reduced_uid())) .setenv("PALUDIS_COMMAND", _env->paludis_command()); @@ -289,14 +292,14 @@ FancyHookFile::auto_hook_names() const Log::get_instance()->message("hook.fancy.starting", ll_debug, lc_no_context) << "Starting hook script '" << file_name() << "' for auto hook names"; - Process process(ProcessCommand({ "sh", "-c", getenv_with_default("PALUDIS_HOOKER_DIR", LIBEXECDIR "/paludis") + + Process process(ProcessCommand({ "sh", "-c", getenv_with_default(env_vars::hooker_dir, LIBEXECDIR "/paludis") + "/hooker.bash '" + stringify(file_name()) + "' 'hook_auto_names'" })); process .setenv("ROOT", stringify(_env->preferred_root_key()->value())) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_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")) .setenv("PALUDIS_REDUCED_GID", stringify(_env->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(_env->reduced_uid())) .setenv("PALUDIS_COMMAND", _env->paludis_command()); @@ -346,7 +349,7 @@ FancyHookFile::_add_dependency_class(const Hook & hook, DirectedGraph<std::strin Log::get_instance()->message("hook.fancy.starting_dependencies", ll_debug, lc_no_context) << "Starting hook script '" << file_name() << "' for dependencies of '" << hook.name() << "'"; - Process process(ProcessCommand({ "sh", "-c", getenv_with_default("PALUDIS_HOOKER_DIR", LIBEXECDIR "/paludis") + + Process process(ProcessCommand({ "sh", "-c", getenv_with_default(env_vars::hooker_dir, LIBEXECDIR "/paludis") + "/hooker.bash '" + stringify(file_name()) + "' 'hook_" + (depend ? "depend" : "after") + "_" + stringify(hook.name()) + "'" })); @@ -355,7 +358,7 @@ FancyHookFile::_add_dependency_class(const Hook & hook, DirectedGraph<std::strin .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_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")) .setenv("PALUDIS_REDUCED_GID", stringify(_env->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(_env->reduced_uid())) .setenv("PALUDIS_COMMAND", _env->paludis_command()); @@ -582,7 +585,7 @@ Hooker::_find_hooks(const Hook & hook) const { std::map<std::string, std::shared_ptr<HookFile> > hook_files; std::set<std::string> ignore_hooks; - tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(getenv_with_default("PALUDIS_IGNORE_HOOKS_NAMED", ""), + tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(getenv_with_default(env_vars::ignore_hooks_named, ""), ":", "", std::inserter(ignore_hooks, ignore_hooks.begin())); { diff --git a/paludis/repositories/e/check_userpriv.cc b/paludis/repositories/e/check_userpriv.cc index d7a0bac46..5dd4d1a3e 100644 --- a/paludis/repositories/e/check_userpriv.cc +++ b/paludis/repositories/e/check_userpriv.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -18,11 +18,14 @@ */ #include <paludis/repositories/e/check_userpriv.hh> + #include <paludis/util/exception.hh> #include <paludis/util/system.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/stringify.hh> #include <paludis/util/log.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/environment.hh> using namespace paludis; @@ -33,7 +36,7 @@ paludis::erepository::check_userpriv(const FSPath & f, const Environment * env, { Context c("When checking permissions on '" + stringify(f) + "' for userpriv:"); - if (! getenv_with_default("PALUDIS_BYPASS_USERPRIV_CHECKS", "").empty()) + if (! getenv_with_default(env_vars::bypass_userpriv_checks, "").empty()) return false; FSStat f_stat(f); diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc index c6450968e..ab4c08d23 100644 --- a/paludis/repositories/e/eapi.cc +++ b/paludis/repositories/e/eapi.cc @@ -18,8 +18,10 @@ */ #include <paludis/repositories/e/eapi.hh> + #include <paludis/name.hh> #include <paludis/dep_spec.hh> + #include <paludis/util/is_file_with_extension.hh> #include <paludis/util/system.hh> #include <paludis/util/strip.hh> @@ -35,6 +37,8 @@ #include <paludis/util/hashes.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/fs_iterator.hh> +#include <paludis/util/env_var_names.hh> + #include <unordered_map> #include <map> #include <vector> @@ -370,7 +374,7 @@ namespace paludis { Context c("When loading EAPI data:"); - for (FSIterator d(FSPath(getenv_with_default("PALUDIS_EAPIS_DIR", DATADIR "/paludis/eapis")), { fsio_inode_sort }), d_end ; + for (FSIterator d(FSPath(getenv_with_default(env_vars::eapis_dir, DATADIR "/paludis/eapis")), { fsio_inode_sort }), d_end ; d != d_end ; ++d) { if (! is_file_with_extension(*d, ".conf", { })) diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc index e73b453fe..e14723b9d 100644 --- a/paludis/repositories/e/ebuild.cc +++ b/paludis/repositories/e/ebuild.cc @@ -39,6 +39,7 @@ #include <paludis/util/destringify.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/set.hh> +#include <paludis/util/env_var_names.hh> #include <paludis/about.hh> #include <paludis/environment.hh> @@ -118,7 +119,8 @@ EbuildCommand::operator() () { Context context("When running an ebuild command on '" + stringify(*params.package_id()) + "':"); - Process process(ProcessCommand(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") + "/ebuild.bash '" + ebuild_file() + "' " + commands())); + Process process(ProcessCommand(getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis") + "/ebuild.bash '" + + ebuild_file() + "' " + commands())); if (! params.package_id()->eapi()->supported()) throw InternalError(PALUDIS_HERE, "Tried to run EbuildCommand on an unsupported EAPI"); @@ -136,7 +138,7 @@ EbuildCommand::operator() () if (params.package_id()->eapi()->supported()->userpriv_cannot_use_root()) { if (0 == params.environment()->reduced_uid() || 0 == params.environment()->reduced_gid()) - if (getenv_with_default("PALUDIS_BYPASS_USERPRIV_CHECKS", "").empty()) + if (getenv_with_default(env_vars::bypass_userpriv_checks, "").empty()) throw ActionFailedError("Need to be able to use non-0 user and group for userpriv for '" + stringify(*params.package_id()) + "'"); } @@ -177,7 +179,7 @@ EbuildCommand::operator() () .setenv("PALUDIS_REDUCED_GID", stringify(params.environment()->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(params.environment()->reduced_uid())) .setenv("PALUDIS_EBUILD_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")) .setenv("PALUDIS_UTILITY_PATH_SUFFIXES", params.package_id()->eapi()->supported()->ebuild_options()->utility_path_suffixes()) .setenv("PALUDIS_EBUILD_MODULE_SUFFIXES", @@ -1008,7 +1010,7 @@ WriteVDBEntryCommand::operator() () { using namespace std::placeholders; - std::string ebuild_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") + + std::string ebuild_cmd(getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis") + "/write_vdb_entry.bash '" + stringify(params.output_directory()) + "' '" + stringify(params.environment_file()) + "'"); @@ -1034,7 +1036,7 @@ WriteVDBEntryCommand::operator() () .setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " ")) .setenv("PALUDIS_COMMAND", params.environment()->paludis_command()) .setenv("PALUDIS_EBUILD_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")) .setenv("PALUDIS_VDB_FROM_ENV_VARIABLES", params.package_id()->eapi()->supported()->ebuild_options()->vdb_from_env_variables()) .setenv("PALUDIS_VDB_FROM_ENV_UNLESS_EMPTY_VARIABLES", @@ -1092,7 +1094,7 @@ VDBPostMergeUnmergeCommand::operator() () if (! getenv_with_default("PALUDIS_NO_GLOBAL_HOOKS", "").empty()) return; - Process process(ProcessCommand({ getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") + "/utils/wrapped_ldconfig", + Process process(ProcessCommand({ getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis") + "/utils/wrapped_ldconfig", stringify(params.root()) })); if (0 != process.run().wait()) @@ -1252,7 +1254,7 @@ WriteBinaryEbuildCommand::operator() () throw ActionFailedError("Don't know how to write binary ebuilds using EAPI 'pbin-1+" + params.package_id()->eapi()->exported_name()); - std::string ebuild_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") + + std::string ebuild_cmd(getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis") + "/write_binary_ebuild.bash '" + stringify(params.binary_ebuild_location()) + "' '" + stringify(params.binary_distdir() / params.binary_dist_base()) + "' '" + @@ -1281,7 +1283,7 @@ WriteBinaryEbuildCommand::operator() () .setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " ")) .setenv("PALUDIS_COMMAND", params.environment()->paludis_command()) .setenv("PALUDIS_EBUILD_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")) .setenv("PALUDIS_BINARY_FROM_ENV_VARIABLES", params.package_id()->eapi()->supported()->ebuild_options()->binary_from_env_variables()) .setenv("PALUDIS_F_FUNCTION_PREFIX", diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc index 55e6b67a7..d5893a351 100644 --- a/paludis/repositories/e/fetch_visitor.cc +++ b/paludis/repositories/e/fetch_visitor.cc @@ -22,12 +22,16 @@ #include <paludis/repositories/e/e_repository_id.hh> #include <paludis/repositories/e/eapi.hh> #include <paludis/repositories/e/dep_parser.hh> + #include <paludis/dep_spec.hh> #include <paludis/environment.hh> #include <paludis/package_id.hh> #include <paludis/action.hh> #include <paludis/repository.hh> #include <paludis/about.hh> +#include <paludis/output_manager.hh> +#include <paludis/package_database.hh> + #include <paludis/util/system.hh> #include <paludis/util/process.hh> #include <paludis/util/pimp-impl.hh> @@ -38,8 +42,8 @@ #include <paludis/util/accept_visitor.hh> #include <paludis/util/fs_path.hh> #include <paludis/util/fs_stat.hh> -#include <paludis/output_manager.hh> -#include <paludis/package_database.hh> +#include <paludis/util/env_var_names.hh> + #include <algorithm> #include <list> @@ -240,7 +244,7 @@ FetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::T .setenv("PALUDIS_REDUCED_GID", stringify(_imp->env->reduced_gid())) .setenv("PALUDIS_REDUCED_UID", stringify(_imp->env->reduced_uid())) .setenv("PALUDIS_EBUILD_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")); if (_imp->safe_resume) fetch_process diff --git a/paludis/repositories/e/file_suffixes.cc b/paludis/repositories/e/file_suffixes.cc index c6d88b097..8a1be8b4a 100644 --- a/paludis/repositories/e/file_suffixes.cc +++ b/paludis/repositories/e/file_suffixes.cc @@ -18,6 +18,7 @@ */ #include <paludis/repositories/e/file_suffixes.hh> + #include <paludis/util/pimp-impl.hh> #include <paludis/util/singleton-impl.hh> #include <paludis/util/config_file.hh> @@ -25,6 +26,8 @@ #include <paludis/util/fs_path.hh> #include <paludis/util/log.hh> #include <paludis/util/options.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/name.hh> using namespace paludis; @@ -38,7 +41,7 @@ namespace paludis KeyValueConfigFile file; Imp() : - file(FSPath(getenv_with_default("PALUDIS_SUFFIXES_FILE", DATADIR "/paludis/ebuild_entries_suffixes.conf")), + file(FSPath(getenv_with_default(env_vars::suffixes_file, DATADIR "/paludis/ebuild_entries_suffixes.conf")), { }, &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation) { } diff --git a/paludis/repositories/e/pbin_merger.cc b/paludis/repositories/e/pbin_merger.cc index 134bb76b3..16a9c421d 100644 --- a/paludis/repositories/e/pbin_merger.cc +++ b/paludis/repositories/e/pbin_merger.cc @@ -18,12 +18,15 @@ */ #include <paludis/repositories/e/pbin_merger.hh> + #include <paludis/util/pimp-impl.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/system.hh> #include <paludis/util/join.hh> #include <paludis/util/log.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/hook.hh> #include <paludis/environment.hh> #include <paludis/package_id.hh> @@ -71,7 +74,7 @@ PbinMerger::PbinMerger(const PbinMergerParams & p) : n::install_under() = FSPath("/"), n::maybe_output_manager() = p.output_manager(), n::merged_entries() = p.merged_entries(), - n::no_chown() = ! getenv_with_default("PALUDIS_NO_CHOWN", "").empty(), + n::no_chown() = ! getenv_with_default(env_vars::no_chown, "").empty(), n::options() = p.options(), n::root() = p.root(), n::tar_file() = p.tar_file() diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc index ec9df37ad..0bba3f871 100644 --- a/paludis/repositories/e/vdb_merger.cc +++ b/paludis/repositories/e/vdb_merger.cc @@ -17,7 +17,8 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "vdb_merger.hh" +#include <paludis/repositories/e/vdb_merger.hh> + #include <paludis/util/log.hh> #include <paludis/util/tokeniser.hh> #include <paludis/util/system.hh> @@ -31,15 +32,19 @@ #include <paludis/util/make_named_values.hh> #include <paludis/util/enum_iterator.hh> #include <paludis/util/timestamp.hh> -#include <paludis/output_manager.hh> +#include <paludis/util/env_var_names.hh> #include <paludis/util/safe_ofstream.hh> #include <paludis/util/safe_ifstream.hh> +#include <paludis/util/env_var_names.hh> + +#include <paludis/output_manager.hh> #include <paludis/hook.hh> #include <paludis/package_id.hh> #include <paludis/util/md5.hh> #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/metadata_key.hh> + #include <iomanip> #include <list> @@ -89,7 +94,7 @@ VDBMerger::VDBMerger(const VDBMergerParams & p) : n::install_under() = FSPath("/"), n::maybe_output_manager() = p.output_manager(), n::merged_entries() = p.merged_entries(), - n::no_chown() = ! getenv_with_default("PALUDIS_NO_CHOWN", "").empty(), + n::no_chown() = ! getenv_with_default(env_vars::no_chown, "").empty(), n::options() = p.options(), n::root() = p.root() )), diff --git a/paludis/repositories/e/xml_things_handle.cc b/paludis/repositories/e/xml_things_handle.cc index 9c658a1f1..158026c70 100644 --- a/paludis/repositories/e/xml_things_handle.cc +++ b/paludis/repositories/e/xml_things_handle.cc @@ -18,16 +18,21 @@ */ #include <paludis/repositories/e/xml_things_handle.hh> -#include <paludis/about.hh> + #include <paludis/util/stringify.hh> #include <paludis/util/log.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/singleton-impl.hh> #include <paludis/util/system.hh> -#include "config.h" +#include <paludis/util/env_var_names.hh> + +#include <paludis/about.hh> + #include <dlfcn.h> #include <stdint.h> +#include "config.h" + using namespace paludis; using namespace paludis::erepository; @@ -58,7 +63,7 @@ namespace paludis cleanup(0) { #if ENABLE_XML - if (! getenv_with_default("PALUDIS_NO_XML", "").empty()) + if (! getenv_with_default(env_vars::no_xml, "").empty()) return; paludis_handle = ::dlopen(("libpaludis_" + stringify(PALUDIS_PC_SLOT) + ".so").c_str(), RTLD_NOW | RTLD_GLOBAL); diff --git a/paludis/set_file.cc b/paludis/set_file.cc index da71adfe3..bc62eb6cb 100644 --- a/paludis/set_file.cc +++ b/paludis/set_file.cc @@ -18,6 +18,7 @@ */ #include <paludis/set_file.hh> + #include <paludis/util/log.hh> #include <paludis/util/tokeniser.hh> #include <paludis/util/pimp-impl.hh> @@ -29,6 +30,8 @@ #include <paludis/util/safe_ofstream.hh> #include <paludis/util/process.hh> #include <paludis/util/make_null_shared_ptr.hh> +#include <paludis/util/env_var_names.hh> + #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/selection.hh> @@ -37,6 +40,7 @@ #include <paludis/filtered_generator.hh> #include <paludis/partially_made_package_dep_spec.hh> #include <paludis/metadata_key.hh> + #include <list> #include <vector> #include <algorithm> @@ -531,7 +535,7 @@ PaludisBashHandler::PaludisBashHandler(const SetFileParams & p) : .setenv("ROOT", _p.environment() ? stringify(_p.environment()->preferred_root_key()->value()) : "/") .setenv("SET", stringify(_p.file_name())) .setenv("SET_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")) .setenv("PALUDIS_COMMAND", _p.environment() ? _p.environment()->paludis_command() : "") .prefix_stderr(_p.file_name().basename() + "> ") .capture_stdout(s); diff --git a/paludis/syncer.cc b/paludis/syncer.cc index 9a6a26e1b..7eb67098c 100644 --- a/paludis/syncer.cc +++ b/paludis/syncer.cc @@ -19,8 +19,9 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "syncer.hh" +#include <paludis/syncer.hh> #include <paludis/environment.hh> + #include <paludis/util/fs_stat.hh> #include <paludis/util/log.hh> #include <paludis/util/system.hh> @@ -28,8 +29,11 @@ #include <paludis/util/tokeniser.hh> #include <paludis/util/join.hh> #include <paludis/util/wrapped_forward_iterator.hh> +#include <paludis/util/env_var_names.hh> #include <paludis/util/sequence.hh> + #include <paludis/output_manager.hh> + #include <list> using namespace paludis; @@ -105,7 +109,7 @@ DefaultSyncer::sync(const SyncOptions & opts) const .setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " ")) .setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " ")) .setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " ")) - .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")) .setenv("PALUDIS_SYNC_FILTER_FILE", stringify(opts.filter_file())) .capture_stderr(opts.output_manager()->stderr_stream()) .capture_stdout(opts.output_manager()->stdout_stream()) diff --git a/paludis/util/env_var_names.cc b/paludis/util/env_var_names.cc new file mode 100644 index 000000000..bd71fcb98 --- /dev/null +++ b/paludis/util/env_var_names.cc @@ -0,0 +1,23 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/util/env_var_names.hh> + +using namespace paludis; + diff --git a/paludis/util/env_var_names.hh b/paludis/util/env_var_names.hh new file mode 100644 index 000000000..e11014a0a --- /dev/null +++ b/paludis/util/env_var_names.hh @@ -0,0 +1,56 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ENV_VAR_NAMES_HH +#define PALUDIS_GUARD_PALUDIS_UTIL_ENV_VAR_NAMES_HH 1 + +#include <paludis/util/attributes.hh> +#include <string> + +namespace paludis +{ + namespace env_vars + { + const std::string bypass_userpriv_checks("PALUDIS_BYPASS_USERPRIV_CHECKS"); + const std::string default_output_conf("PALUDIS_DEFAULT_OUTPUT_CONF"); + const std::string distribution("PALUDIS_DISTRIBUTION"); + const std::string distributions_dir("PALUDIS_DISTRIBUTIONS_DIR"); + const std::string do_nothing_sandboxy("PALUDIS_DO_NOTHING_SANDBOXY"); + const std::string eapis_dir("PALUDIS_EAPIS_DIR"); + const std::string ebuild_dir("PALUDIS_EBUILD_DIR"); + const std::string fetchers_dir("PALUDIS_FETCHERS_DIR"); + const std::string home("PALUDIS_HOME"); + const std::string hooker_dir("PALUDIS_HOOKER_DIR"); + const std::string ignore_hooks_named("PALUDIS_IGNORE_HOOKS_NAMED"); + const std::string no_chown("PALUDIS_NO_CHOWN"); + const std::string no_global_fetchers("PALUDIS_NO_GLOBAL_FETCHERS"); + const std::string no_global_hooks("PALUDIS_NO_GLOBAL_HOOKS"); + const std::string no_global_sets("PALUDIS_NO_GLOBAL_SETS"); + const std::string no_global_syncers("PALUDIS_NO_GLOBAL_SYNCERS"); + const std::string no_xml("PALUDIS_NO_XML"); + const std::string portage_bashrc("PALUDIS_PORTAGE_BASHRC"); + const std::string python_dir("PALUDIS_PYTHON_DIR"); + const std::string reduced_gid("PALUDIS_REDUCED_GID"); + const std::string reduced_uid("PALUDIS_REDUCED_UID"); + const std::string reduced_username("PALUDIS_REDUCED_USERNAME"); + const std::string suffixes_file("PALUDIS_SUFFIXES_FILE"); + } +} + +#endif diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index c89083200..514280168 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -32,6 +32,7 @@ add(`elf_sections', `hh', `cc') add(`elf_symbol_section', `hh', `cc') add(`elf_types', `hh') add(`enum_iterator', `hh', `cc', `fwd', `gtest') +add(`env_var_names', `hh', `cc') add(`exception', `hh', `cc') add(`executor', `hh', `cc', `fwd') add(`extract_host_from_url', `hh', `cc', `fwd', `gtest') diff --git a/paludis/util/process.cc b/paludis/util/process.cc index eebf145ce..4e8e7fc06 100644 --- a/paludis/util/process.cc +++ b/paludis/util/process.cc @@ -27,6 +27,7 @@ #include <paludis/util/safe_ofstream.hh> #include <paludis/util/log.hh> #include <paludis/util/system.hh> +#include <paludis/util/env_var_names.hh> #include <iostream> #include <functional> @@ -917,7 +918,7 @@ Process::sandbox() if (can_use_sandbox) { - if (! getenv_with_default("PALUDIS_DO_NOTHING_SANDBOXY", "").empty()) + if (! getenv_with_default(env_vars::do_nothing_sandboxy, "").empty()) Log::get_instance()->message("util.system.nothing_sandboxy", ll_debug, lc_no_context) << "PALUDIS_DO_NOTHING_SANDBOXY is set, not using sandbox"; else if (! getenv_with_default("SANDBOX_ACTIVE", "").empty()) @@ -941,7 +942,7 @@ Process::sydbox() if (can_use_sydbox) { - if (! getenv_with_default("PALUDIS_DO_NOTHING_SANDBOXY", "").empty()) + if (! getenv_with_default(env_vars::do_nothing_sandboxy, "").empty()) Log::get_instance()->message("util.system.nothing_sandboxy", ll_debug, lc_no_context) << "PALUDIS_DO_NOTHING_SANDBOXY is set, not using sydbox"; else if (! getenv_with_default("SYDBOX_ACTIVE", "").empty()) diff --git a/src/clients/cave/cmd_sync_protocol_options.cc b/src/clients/cave/cmd_sync_protocol_options.cc index 4a089a0be..1c7a29754 100644 --- a/src/clients/cave/cmd_sync_protocol_options.cc +++ b/src/clients/cave/cmd_sync_protocol_options.cc @@ -21,14 +21,17 @@ #include <paludis/args/args.hh> #include <paludis/args/do_help.hh> + #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/repository.hh> + #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/log.hh> #include <paludis/util/process.hh> #include <paludis/util/system.hh> +#include <paludis/util/env_var_names.hh> #include <cstdlib> #include <iostream> @@ -105,7 +108,8 @@ SyncProtocolOptionsCommand::run( Process process(ProcessCommand({stringify(syncer), "--help"})); process .setenv("PALUDIS_FETCHERS_DIRS", join(syncer_dirs->begin(), syncer_dirs->end(), " ")) - .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")); + if (0 != process.run().wait()) Log::get_instance()->message("paludis.syncer_help.failure", ll_warning, lc_context) << "Syncer help command '" << syncer << " --help' failed"; |