diff options
author | 2011-02-28 21:08:58 +0000 | |
---|---|---|
committer | 2011-02-28 21:08:58 +0000 | |
commit | 60312306ef19d6700394c9cde7f168badcee6cdf (patch) | |
tree | e322bd0d224e5c868c50a122adec5acad51f2588 | |
parent | 8b7a424633050178d4cb98204281d4de22109283 (diff) | |
download | paludis-60312306ef19d6700394c9cde7f168badcee6cdf.tar.gz paludis-60312306ef19d6700394c9cde7f168badcee6cdf.tar.xz |
Allow sets in /usr
-rw-r--r-- | doc/configuration/envvars.html.part | 3 | ||||
-rw-r--r-- | misc/common-makefile.am | 1 | ||||
-rw-r--r-- | paludis/environments/paludis/paludis_environment.cc | 47 |
3 files changed, 34 insertions, 17 deletions
diff --git a/doc/configuration/envvars.html.part b/doc/configuration/envvars.html.part index 00c8b8341..d0bdbd464 100644 --- a/doc/configuration/envvars.html.part +++ b/doc/configuration/envvars.html.part @@ -43,6 +43,9 @@ can be dangerous and may break things; many of these variables exist mainly for <dt><code>PALUDIS_NO_GLOBAL_HOOKS</code></dt> <dd>If set to a non-empty string, global hooks will be ignored.</dd> + <dt><code>PALUDIS_NO_GLOBAL_SETS</code></dt> + <dd>If set to a non-empty string, global sets will be ignored.</dd> + <dt><code>PALUDIS_NO_GLOBAL_FETCHERS</code></dt> <dd>If set to a non-empty string, global fetchers will be ignored.</dd> diff --git a/misc/common-makefile.am b/misc/common-makefile.am index e5c6eb2a6..fe613032f 100644 --- a/misc/common-makefile.am +++ b/misc/common-makefile.am @@ -73,6 +73,7 @@ LOG_COMPILER = \ PALUDIS_HOOKER_DIR="$(top_srcdir)/paludis/" \ PALUDIS_NO_CHOWN="yupyup" \ PALUDIS_NO_GLOBAL_HOOKS="yes" \ + PALUDIS_NO_GLOBAL_SETS="yes" \ PALUDIS_NO_XML= \ PALUDIS_NO_XTERM_TITLES="yes" \ PALUDIS_OPTIONS="" \ diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc index 8ec4bc9eb..900b952c4 100644 --- a/paludis/environments/paludis/paludis_environment.cc +++ b/paludis/environments/paludis/paludis_environment.cc @@ -543,29 +543,42 @@ PaludisEnvironment::populate_sets() const Lock lock(_imp->sets_mutex); add_set(SetName("world"), SetName("world::environment"), std::bind(&make_world_set, _imp->config->world()), true); - FSPath sets_dir(FSPath(_imp->config->config_dir()) / "sets"); - Context context("When looking in sets directory '" + stringify(sets_dir) + "':"); + std::list<FSPath> sets_dirs; - if (! sets_dir.stat().exists()) - return; + sets_dirs.push_back(FSPath(_imp->config->config_dir()) / "sets"); + if (getenv_with_default("PALUDIS_NO_GLOBAL_SETS", "").empty()) + { + sets_dirs.push_back(FSPath(LIBEXECDIR) / "paludis" / "sets"); + sets_dirs.push_back(FSPath(DATADIR) / "paludis" / "sets"); + sets_dirs.push_back(FSPath(LIBDIR) / "paludis" / "sets"); + } - for (FSIterator d(sets_dir, { fsio_inode_sort }), d_end ; d != d_end ; ++d) + for (auto sets_dir(sets_dirs.begin()), sets_dir_end(sets_dirs.end()) ; + sets_dir != sets_dir_end ; ++ sets_dir) { - if (is_file_with_extension(*d, ".bash", { })) - { - SetName n(strip_trailing_string(d->basename(), ".bash")); - add_set(n, n, std::bind(&make_set, this, *d, n, sfsmo_natural, sft_paludis_bash), false); + Context context("When looking in sets directory '" + stringify(*sets_dir) + "':"); - SetName n_s(stringify(n) + "*"); - add_set(n_s, n_s, std::bind(&make_set, this, *d, n_s, sfsmo_star, sft_paludis_bash), false); - } - else if (is_file_with_extension(*d, ".conf", { })) + if (! sets_dir->stat().exists()) + continue; + + for (FSIterator d(*sets_dir, { fsio_inode_sort }), d_end ; d != d_end ; ++d) { - SetName n(strip_trailing_string(d->basename(), ".conf")); - add_set(n, n, std::bind(&make_set, this, *d, n, sfsmo_natural, sft_paludis_conf), false); + if (is_file_with_extension(*d, ".bash", { })) + { + SetName n(strip_trailing_string(d->basename(), ".bash")); + add_set(n, n, std::bind(&make_set, this, *d, n, sfsmo_natural, sft_paludis_bash), false); - SetName n_s(stringify(n) + "*"); - add_set(n_s, n_s, std::bind(&make_set, this, *d, n_s, sfsmo_star, sft_paludis_conf), false); + SetName n_s(stringify(n) + "*"); + add_set(n_s, n_s, std::bind(&make_set, this, *d, n_s, sfsmo_star, sft_paludis_bash), false); + } + else if (is_file_with_extension(*d, ".conf", { })) + { + SetName n(strip_trailing_string(d->basename(), ".conf")); + add_set(n, n, std::bind(&make_set, this, *d, n, sfsmo_natural, sft_paludis_conf), false); + + SetName n_s(stringify(n) + "*"); + add_set(n_s, n_s, std::bind(&make_set, this, *d, n_s, sfsmo_star, sft_paludis_conf), false); + } } } } |