aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-28 21:08:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-28 21:08:58 +0000
commit60312306ef19d6700394c9cde7f168badcee6cdf (patch)
treee322bd0d224e5c868c50a122adec5acad51f2588
parent8b7a424633050178d4cb98204281d4de22109283 (diff)
downloadpaludis-60312306ef19d6700394c9cde7f168badcee6cdf.tar.gz
paludis-60312306ef19d6700394c9cde7f168badcee6cdf.tar.xz
Allow sets in /usr
-rw-r--r--doc/configuration/envvars.html.part3
-rw-r--r--misc/common-makefile.am1
-rw-r--r--paludis/environments/paludis/paludis_environment.cc47
3 files changed, 34 insertions, 17 deletions
diff --git a/doc/configuration/envvars.html.part b/doc/configuration/envvars.html.part
index 00c8b83..d0bdbd4 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 e5c6eb2..fe61303 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 8ec4bc9..900b952 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);
+ }
}
}
}