aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-05 07:58:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-05 07:58:42 +0000
commit1156598c55fbf09a5ee96c0795d2224248913807 (patch)
tree88364105effa183cb4eb118618c27bb738fd45f5
parent684d9b7a39410886fd6be9719787159a50dd59ba (diff)
downloadpaludis-1156598c55fbf09a5ee96c0795d2224248913807.tar.gz
paludis-1156598c55fbf09a5ee96c0795d2224248913807.tar.xz
Set names can now be used in the atom column for package_mask.conf, package_unmask.conf, use.conf, keywords.conf, licenses.conf
-rw-r--r--NEWS5
-rw-r--r--doc/configuration.html.skel10
-rw-r--r--doc/sets.html.skel5
-rw-r--r--paludis/environment/default/default_config.cc270
-rw-r--r--paludis/environment/default/default_config.hh35
-rw-r--r--paludis/environment/default/default_environment.cc190
-rw-r--r--paludis/environment/default/use_config_entry.sr86
7 files changed, 583 insertions, 18 deletions
diff --git a/NEWS b/NEWS
index f762477..c0b5974 100644
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,10 @@ of every change, see the ChangeLog.
* qualudis now supports --archs and --exclude-archs.
- * Documentation on sets is now provided.
+ * Documentation on sets and hooks is now provided.
+
+ * Set names can now be used for the atom column in use.conf, keywords.conf,
+ licenses.conf, package_unmask.conf, package_mask.conf.
0.14.0:
* The merge and unmerge utilities are now called with an explicit path.
diff --git a/doc/configuration.html.skel b/doc/configuration.html.skel
index 5b76e2b..0047e06 100644
--- a/doc/configuration.html.skel
+++ b/doc/configuration.html.skel
@@ -67,7 +67,8 @@ used.</p>
<p>User <code>USE</code> preferences are controlled by the <code>use.conf</code>
file. The basic format of a line is <code>atom use use use ...</code>, where
-<code>atom</code> is a package depend atom or <code>*</code> for "all packages",
+<code>atom</code> is a package depend atom, <a href="sets.html">package set</a>
+or <code>*</code> for "all packages",
and <code>use use use ...</code> is one or more USE flag names, prefixed by
a minus if they are to be disabled.</p>
@@ -100,7 +101,7 @@ be considered, not just the best or last match.</p>
<p>Which <code>ARCH KEYWORDS</code> to accept is controlled by the
<code>keywords.conf</code> file. The format of a line is
<code>atom keyword1 keywords2 ...</code>, where <code>atom</code> is a package
-depend atom or <code>*</code> for "all packages" and
+depend atom, <a href="sets.html">set name</a> or <code>*</code> for "all packages" and
<code>keyword1 keyword2 ...</code> is one or more arch keywords. As with Portage,
accepting <code>~arch</code> does <em>not</em>
implicitly accept <code>arch</code>, however, if a package matches multiple lines,
@@ -125,7 +126,8 @@ package being masked, as the package is stabilised.</p>
<h3>The package_mask.conf File</h3>
<p>Packages can be masked through the use of the <code>package_mask.conf</code>
-file. The format of the file is one <code>atom</code> per line. For example:</p>
+file. The format of the file is one <code>atom</code> or <a href="sets.html">set name</a>
+per line. For example:</p>
<pre>
# Hide vim 7
@@ -140,7 +142,7 @@ app-editors/gvim
<p>Packages can be unmasked through the use of the
<code>package_unmask.conf</code> file. The format of the file is one
-<code>atom</code> per line. For example:</p>
+<code>atom</code> or <a href="sets.html">set name</a> per line. For example:</p>
<pre>
# I need banshee 0.11.0
diff --git a/doc/sets.html.skel b/doc/sets.html.skel
index ea60bc6..6436a95 100644
--- a/doc/sets.html.skel
+++ b/doc/sets.html.skel
@@ -75,8 +75,9 @@ user defined sets above.</p>
<h3>Using Sets</h3>
<p>Sets can currently be used as targets for <code>paludis --query</code> and
-<code>paludis --install</code>. In future they may be allowed in <code>use.conf</code> etc.,
-but this is currently unsupported.</p>
+<code>paludis --install</code>. They can also be used as the atom column in the
+<code>use.conf</code>, <code>keywords.conf</code>, <code>licenses.conf</code>,
+<code>package_mask.conf</code> and <code>package_unmask.conf</code>.</p>
@FOOTER@
</body>
diff --git a/paludis/environment/default/default_config.cc b/paludis/environment/default/default_config.cc
index 04ff3b2..5e2b09f 100644
--- a/paludis/environment/default/default_config.cc
+++ b/paludis/environment/default/default_config.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,6 +18,7 @@
*/
#include <paludis/environment/default/default_config.hh>
+#include <paludis/environment/default/default_environment.hh>
#include <paludis/config_file.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/compare.hh>
@@ -70,6 +71,8 @@ namespace paludis
std::string config_dir;
std::string bashrc_files;
+ mutable bool sets_expanded;
+
std::list<RepositoryConfigEntry> repos;
std::map<QualifiedPackageName, std::vector<
@@ -79,6 +82,8 @@ namespace paludis
std::vector<KeywordName> default_keywords;
+ mutable std::vector<SetKeywordConfigEntry> set_keywords;
+
std::map<QualifiedPackageName, std::vector<
std::pair<PackageDepAtom::ConstPointer, std::string> > > licenses;
@@ -86,14 +91,23 @@ namespace paludis
std::vector<std::string> default_licenses;
+ mutable std::vector<SetLicenseConfigEntry> set_licenses;
+
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_masks;
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_unmasks;
std::vector<PackageDepAtom::ConstPointer> empty_masks;
+ mutable std::vector<SetMaskConfigEntry> set_masks;
+ mutable std::vector<SetMaskConfigEntry> set_unmasks;
+
std::map<QualifiedPackageName, std::vector<UseConfigEntry> > use;
+ mutable std::vector<SetUseConfigEntry> set_use;
+
+ mutable std::vector<SetUseConfigMinusStarEntry> set_use_prefixes_that_have_minus_star;
+
std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > empty_use_prefixes;
std::map<QualifiedPackageName, std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > >
@@ -110,12 +124,122 @@ namespace paludis
std::vector<UseConfigEntry> forced_use_config;
Implementation();
+
+ void need_sets_expanded() const;
};
Implementation<DefaultConfig>::Implementation() :
paludis_command("paludis"),
- config_dir("(unset)")
+ config_dir("(unset)"),
+ sets_expanded(false)
+ {
+ }
+
+ void
+ Implementation<DefaultConfig>::need_sets_expanded() const
{
+ if (sets_expanded)
+ return;
+
+ {
+ Context context("When expanding set names from use.conf:");
+
+ for (std::vector<SetUseConfigEntry>::iterator s(set_use.begin()), s_end(set_use.end()) ;
+ s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+
+ for (std::vector<SetUseConfigMinusStarEntry>::iterator s(set_use_prefixes_that_have_minus_star.begin()),
+ s_end(set_use_prefixes_that_have_minus_star.end()) ; s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+ }
+
+ {
+ Context context("When expanding set names from keywords.conf:");
+
+ for (std::vector<SetKeywordConfigEntry>::iterator s(set_keywords.begin()), s_end(set_keywords.end()) ;
+ s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+ }
+
+ {
+ Context context("When expanding set names from licenses.conf:");
+
+ for (std::vector<SetLicenseConfigEntry>::iterator s(set_licenses.begin()), s_end(set_licenses.end()) ;
+ s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+ }
+
+ {
+ Context context("When expanding set names from package_unmask.conf:");
+
+ for (std::vector<SetMaskConfigEntry>::iterator s(set_unmasks.begin()), s_end(set_unmasks.end()) ;
+ s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+ }
+
+ {
+ Context context("When expanding set names from package_mask.conf:");
+
+ for (std::vector<SetMaskConfigEntry>::iterator s(set_masks.begin()), s_end(set_masks.end()) ;
+ s != s_end ; ++s)
+ if (! s->dep_atom)
+ {
+ s->dep_atom = DefaultEnvironment::get_instance()->package_set(s->set_name);
+ if (! s->dep_atom)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Set '" +
+ stringify(s->set_name) + "' doesn't exist");
+ s->dep_atom.assign(new AllDepAtom);
+ }
+ }
+ }
+
+ sets_expanded = true;
}
std::string Implementation<DefaultConfig>::config_suffix;
@@ -260,6 +384,13 @@ DefaultConfig::DefaultConfig() :
if ("*" == tokens.at(0))
std::copy(next(tokens.begin()), tokens.end(),
create_inserter<KeywordName>(std::back_inserter(_imp->default_keywords)));
+ else if (std::string::npos == tokens.at(0).find('/'))
+ {
+ for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ _imp->set_keywords.push_back(SetKeywordConfigEntry(
+ SetName(tokens.at(0)), DepAtom::Pointer(0), KeywordName(*t)));
+ }
else
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
@@ -331,8 +462,17 @@ DefaultConfig::DefaultConfig() :
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
- _imp->user_masks[a->package()].push_back(a);
+ if (line->empty())
+ continue;
+
+ if (std::string::npos == line->find('/'))
+ _imp->set_masks.push_back(SetMaskConfigEntry(SetName(*line),
+ DepAtom::ConstPointer(0)));
+ else
+ {
+ PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ _imp->user_masks[a->package()].push_back(a);
+ }
}
}
}
@@ -354,8 +494,17 @@ DefaultConfig::DefaultConfig() :
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
- _imp->user_unmasks[a->package()].push_back(a);
+ if (line->empty())
+ continue;
+
+ if (std::string::npos == line->find('/'))
+ _imp->set_unmasks.push_back(SetMaskConfigEntry(SetName(*line),
+ DepAtom::ConstPointer(0)));
+ else
+ {
+ PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ _imp->user_unmasks[a->package()].push_back(a);
+ }
}
}
}
@@ -413,6 +562,32 @@ DefaultConfig::DefaultConfig() :
prefix + *t), use_enabled));
}
}
+ else if (std::string::npos == tokens.at(0).find('/'))
+ {
+ for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ {
+ if ('-' == t->at(0))
+ {
+ if ("-*" == *t)
+ _imp->set_use_prefixes_that_have_minus_star.push_back(SetUseConfigMinusStarEntry(
+ SetName(tokens.at(0)), DepAtom::ConstPointer(0), prefix));
+ else
+ _imp->set_use.push_back(SetUseConfigEntry(SetName(tokens.at(0)),
+ DepAtom::ConstPointer(0), UseFlagName(prefix + t->substr(1)), use_disabled));
+ }
+ else if (':' == t->at(t->length() - 1))
+ {
+ prefix.clear();
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix),
+ &::tolower);
+ prefix.append("_");
+ }
+ else
+ _imp->set_use.push_back(SetUseConfigEntry(SetName(tokens.at(0)),
+ DepAtom::ConstPointer(0), UseFlagName(prefix + *t), use_enabled));
+ }
+ }
else
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
@@ -764,4 +939,87 @@ DefaultConfig::end_package_use_prefixes_with_minus_star(const QualifiedPackageNa
return PackageUseMinusStarIterator(_imp->empty_use_prefixes.end());
}
+DefaultConfig::SetUseMinusStarIterator
+DefaultConfig::begin_set_use_prefixes_with_minus_star() const
+{
+ _imp->need_sets_expanded();
+ return SetUseMinusStarIterator(_imp->set_use_prefixes_that_have_minus_star.begin());
+}
+
+DefaultConfig::SetUseMinusStarIterator
+DefaultConfig::end_set_use_prefixes_with_minus_star() const
+{
+ _imp->need_sets_expanded();
+ return SetUseMinusStarIterator(_imp->set_use_prefixes_that_have_minus_star.end());
+}
+
+DefaultConfig::SetUseConfigIterator
+DefaultConfig::begin_set_use_config() const
+{
+ _imp->need_sets_expanded();
+ return SetUseConfigIterator(_imp->set_use.begin());
+}
+
+DefaultConfig::SetUseConfigIterator
+DefaultConfig::end_set_use_config() const
+{
+ _imp->need_sets_expanded();
+ return SetUseConfigIterator(_imp->set_use.end());
+}
+
+DefaultConfig::SetKeywordsIterator
+DefaultConfig::begin_set_keywords() const
+{
+ _imp->need_sets_expanded();
+ return SetKeywordsIterator(_imp->set_keywords.begin());
+}
+
+DefaultConfig::SetKeywordsIterator
+DefaultConfig::end_set_keywords() const
+{
+ _imp->need_sets_expanded();
+ return SetKeywordsIterator(_imp->set_keywords.end());
+}
+
+DefaultConfig::SetLicensesIterator
+DefaultConfig::begin_set_licenses() const
+{
+ _imp->need_sets_expanded();
+ return SetLicensesIterator(_imp->set_licenses.begin());
+}
+
+DefaultConfig::SetLicensesIterator
+DefaultConfig::end_set_licenses() const
+{
+ _imp->need_sets_expanded();
+ return SetLicensesIterator(_imp->set_licenses.end());
+}
+
+DefaultConfig::UserMasksSetsIterator
+DefaultConfig::begin_user_masks_sets() const
+{
+ _imp->need_sets_expanded();
+ return UserMasksSetsIterator(_imp->set_masks.begin());
+}
+
+DefaultConfig::UserMasksSetsIterator
+DefaultConfig::end_user_masks_sets() const
+{
+ _imp->need_sets_expanded();
+ return UserMasksSetsIterator(_imp->set_masks.end());
+}
+
+DefaultConfig::UserMasksSetsIterator
+DefaultConfig::begin_user_unmasks_sets() const
+{
+ _imp->need_sets_expanded();
+ return UserMasksSetsIterator(_imp->set_unmasks.begin());
+}
+
+DefaultConfig::UserMasksSetsIterator
+DefaultConfig::end_user_unmasks_sets() const
+{
+ _imp->need_sets_expanded();
+ return UserMasksSetsIterator(_imp->set_unmasks.end());
+}
diff --git a/paludis/environment/default/default_config.hh b/paludis/environment/default/default_config.hh
index 4c273fe..a804b8b 100644
--- a/paludis/environment/default/default_config.hh
+++ b/paludis/environment/default/default_config.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -108,7 +108,7 @@ namespace paludis
///\}
- ///\name Iterate over our default and per-package keywords
+ ///\name Iterate over our default, set and per-package keywords
///\{
typedef libwrapiter::ForwardIterator<DefaultConfig,
@@ -124,9 +124,14 @@ namespace paludis
DefaultKeywordsIterator end_default_keywords() const;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, SetKeywordConfigEntry> SetKeywordsIterator;
+
+ SetKeywordsIterator begin_set_keywords() const;
+ SetKeywordsIterator end_set_keywords() const;
+
///\}
- ///\name Iterate over our default and per-package licenses
+ ///\name Iterate over our default, set and per-package licenses
///\{
typedef libwrapiter::ForwardIterator<DefaultConfig,
@@ -142,6 +147,11 @@ namespace paludis
DefaultLicensesIterator end_default_licenses() const;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, SetLicenseConfigEntry> SetLicensesIterator;
+
+ SetLicensesIterator begin_set_licenses() const;
+ SetLicensesIterator end_set_licenses() const;
+
///\}
///\name Iterate over our masks and unmasks
@@ -159,9 +169,16 @@ namespace paludis
UserUnmasksIterator end_user_unmasks(const QualifiedPackageName & d) const;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, SetMaskConfigEntry> UserMasksSetsIterator;
+
+ UserMasksSetsIterator begin_user_masks_sets() const;
+ UserMasksSetsIterator end_user_masks_sets() const;
+ UserMasksSetsIterator begin_user_unmasks_sets() const;
+ UserMasksSetsIterator end_user_unmasks_sets() const;
+
///\}
- ///\name Iterate over our default and per-package use flags
+ ///\name Iterate over our default and per-package and per-set use flags
///\{
typedef libwrapiter::ForwardIterator<DefaultConfig, const UseConfigEntry> UseConfigIterator;
@@ -188,6 +205,16 @@ namespace paludis
PackageUseMinusStarIterator begin_package_use_prefixes_with_minus_star(const QualifiedPackageName &) const;
PackageUseMinusStarIterator end_package_use_prefixes_with_minus_star(const QualifiedPackageName &) const;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const SetUseConfigEntry> SetUseConfigIterator;
+
+ SetUseConfigIterator begin_set_use_config() const;
+ SetUseConfigIterator end_set_use_config() const;
+
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const SetUseConfigMinusStarEntry> SetUseMinusStarIterator;
+
+ SetUseMinusStarIterator begin_set_use_prefixes_with_minus_star() const;
+ SetUseMinusStarIterator end_set_use_prefixes_with_minus_star() const;
+
///\}
/**
diff --git a/paludis/environment/default/default_environment.cc b/paludis/environment/default/default_environment.cc
index 7fbf96f..ada2505 100644
--- a/paludis/environment/default/default_environment.cc
+++ b/paludis/environment/default/default_environment.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -53,6 +53,76 @@ DefaultEnvironment::~DefaultEnvironment()
{
}
+namespace
+{
+ struct IsInSet :
+ DepAtomVisitorTypes::ConstVisitor,
+ std::unary_function<PackageDatabaseEntry, bool>
+ {
+ const Environment * const env;
+ DepAtom::ConstPointer set;
+ const PackageDatabaseEntry * dbe;
+ bool matched;
+
+ IsInSet(const Environment * const e, DepAtom::ConstPointer s) :
+ env(e),
+ set(s),
+ matched(false)
+ {
+ }
+
+ bool operator() (const PackageDatabaseEntry & e)
+ {
+ dbe = &e;
+ matched = false;
+ set->accept(this);
+ return matched;
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ if (matched)
+ return;
+
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const PackageDepAtom * const a)
+ {
+ if (matched)
+ return;
+
+ if (match_package(env, a, *dbe))
+ matched = true;
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ if (matched)
+ return;
+
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ if (matched)
+ return;
+
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const) PALUDIS_ATTRIBUTE((noreturn))
+ {
+ throw InternalError(PALUDIS_HERE, "Got PlainTextDepAtom?");
+ }
+ };
+}
+
bool
DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
@@ -151,6 +221,71 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
}
}
+ /* check use: set user config */
+ if (e)
+ {
+ UseFlagState s(use_unspecified);
+
+ for (DefaultConfig::SetUseConfigIterator
+ u(DefaultConfig::get_instance()->begin_set_use_config()),
+ u_end(DefaultConfig::get_instance()->end_set_use_config()) ;
+ u != u_end ; ++u)
+ {
+ if (f != u->flag_name)
+ continue;
+
+ IsInSet q(this, u->dep_atom);
+ if (! q(*e))
+ continue;
+
+ switch (u->flag_state)
+ {
+ case use_enabled:
+ s = use_enabled;
+ continue;
+
+ case use_disabled:
+ s = use_disabled;
+ continue;
+
+ case use_unspecified:
+ continue;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad state");
+ }
+
+ do
+ {
+ switch (s)
+ {
+ case use_enabled:
+ return true;
+
+ case use_disabled:
+ return false;
+
+ case use_unspecified:
+ continue;
+ }
+ throw InternalError(PALUDIS_HERE, "Bad state");
+ } while (false);
+
+ /* and the -* bit */
+ for (DefaultConfig::SetUseMinusStarIterator
+ i(DefaultConfig::get_instance()->begin_set_use_prefixes_with_minus_star()),
+ i_end(DefaultConfig::get_instance()->end_set_use_prefixes_with_minus_star()) ;
+ i != i_end ; ++i)
+ {
+ IsInSet q(this, i->dep_atom);
+ if (! q(*e))
+ continue;
+
+ if (0 == i->prefix.compare(0, i->prefix.length(), stringify(f), 0, i->prefix.length()))
+ return false;
+ }
+ }
+
/* check use: general user config */
do
{
@@ -237,6 +372,7 @@ DefaultEnvironment::accept_keyword(const KeywordName & keyword, const PackageDat
bool result(false);
if (d)
+ {
for (DefaultConfig::PackageKeywordsIterator
k(DefaultConfig::get_instance()->begin_package_keywords(d->name)),
k_end(DefaultConfig::get_instance()->end_package_keywords(d->name)) ;
@@ -248,6 +384,19 @@ DefaultEnvironment::accept_keyword(const KeywordName & keyword, const PackageDat
result |= k->second == keyword;
}
+ for (DefaultConfig::SetKeywordsIterator
+ k(DefaultConfig::get_instance()->begin_set_keywords()),
+ k_end(DefaultConfig::get_instance()->end_set_keywords()) ;
+ k != k_end ; ++k)
+ {
+ IsInSet q(this, k->dep_atom);
+ if (! q(*d))
+ continue;
+
+ result |= k->keyword == keyword;
+ }
+ }
+
result |= DefaultConfig::get_instance()->end_default_keywords() !=
std::find(DefaultConfig::get_instance()->begin_default_keywords(),
DefaultConfig::get_instance()->end_default_keywords(),
@@ -268,6 +417,7 @@ DefaultEnvironment::accept_license(const std::string & license, const PackageDat
bool result(false);
if (d)
+ {
for (DefaultConfig::PackageLicensesIterator
k(DefaultConfig::get_instance()->begin_package_licenses(d->name)),
k_end(DefaultConfig::get_instance()->end_package_licenses(d->name)) ;
@@ -280,6 +430,20 @@ DefaultEnvironment::accept_license(const std::string & license, const PackageDat
result |= k->second == "*";
}
+ for (DefaultConfig::SetLicensesIterator
+ k(DefaultConfig::get_instance()->begin_set_licenses()),
+ k_end(DefaultConfig::get_instance()->end_set_licenses()) ;
+ k != k_end ; ++k)
+ {
+ IsInSet q(this, k->dep_atom);
+ if (! q(*d))
+ continue;
+
+ result |= k->license == license;
+ result |= k->license == "*";
+ }
+ }
+
result |= DefaultConfig::get_instance()->end_default_licenses() !=
std::find(DefaultConfig::get_instance()->begin_default_licenses(),
DefaultConfig::get_instance()->end_default_licenses(),
@@ -307,6 +471,18 @@ DefaultEnvironment::query_user_masks(const PackageDatabaseEntry & d) const
return true;
}
+ for (DefaultConfig::UserMasksSetsIterator
+ k(DefaultConfig::get_instance()->begin_user_masks_sets()),
+ k_end(DefaultConfig::get_instance()->end_user_masks_sets()) ;
+ k != k_end ; ++k)
+ {
+ IsInSet q(this, k->dep_atom);
+ if (! q(d))
+ continue;
+
+ return true;
+ }
+
return false;
}
@@ -324,6 +500,18 @@ DefaultEnvironment::query_user_unmasks(const PackageDatabaseEntry & d) const
return true;
}
+ for (DefaultConfig::UserMasksSetsIterator
+ k(DefaultConfig::get_instance()->begin_user_unmasks_sets()),
+ k_end(DefaultConfig::get_instance()->end_user_unmasks_sets()) ;
+ k != k_end ; ++k)
+ {
+ IsInSet q(this, k->dep_atom);
+ if (! q(d))
+ continue;
+
+ return true;
+ }
+
return false;
}
diff --git a/paludis/environment/default/use_config_entry.sr b/paludis/environment/default/use_config_entry.sr
index 76cdbd8..f25028e 100644
--- a/paludis/environment/default/use_config_entry.sr
+++ b/paludis/environment/default/use_config_entry.sr
@@ -18,3 +18,89 @@ make_class_UseConfigEntry()
END
}
+make_class_SetUseConfigEntry()
+{
+ key set_name SetName
+ key dep_atom DepAtom::ConstPointer
+ key flag_name UseFlagName
+ key flag_state UseFlagState
+
+ doxygen_comment << "END"
+ /**
+ * Represents a DefaultConfig set use configuration entry.
+ *
+ * \see DefaultConfig
+ * \ingroup grpdefaultconfig
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_SetUseConfigMinusStarEntry()
+{
+ key set_name SetName
+ key dep_atom DepAtom::ConstPointer
+ key prefix std::string
+
+ doxygen_comment << "END"
+ /**
+ * Represents a DefaultConfig set -* use configuration entry.
+ *
+ * \see DefaultConfig
+ * \ingroup grpdefaultconfig
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_SetKeywordConfigEntry()
+{
+ key set_name SetName
+ key dep_atom DepAtom::ConstPointer
+ key keyword KeywordName
+
+ doxygen_comment << "END"
+ /**
+ * Represents a DefaultConfig set keywords configuration entry.
+ *
+ * \see DefaultConfig
+ * \ingroup grpdefaultconfig
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_SetLicenseConfigEntry()
+{
+ key set_name SetName
+ key dep_atom DepAtom::ConstPointer
+ key license std::string
+
+ doxygen_comment << "END"
+ /**
+ * Represents a DefaultConfig set licence configuration entry.
+ *
+ * \see DefaultConfig
+ * \ingroup grpdefaultconfig
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_SetMaskConfigEntry()
+{
+ key set_name SetName
+ key dep_atom DepAtom::ConstPointer
+
+ doxygen_comment << "END"
+ /**
+ * Represents a DefaultConfig set mask or unmask configuration entry.
+ *
+ * \see DefaultConfig
+ * \ingroup grpdefaultconfig
+ * \nosubgrouping
+ */
+END
+}
+
+