aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-15 18:35:00 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-15 18:35:00 +0000
commita4d8a6cefb1c6a7ea79d9e27a955bcd8e38ce96d (patch)
treea365133c56a2eda12ee395e72cdaa5bf5fa6596d
parent36be590659fb25103e4a97112aff02c67f4fd167 (diff)
downloadpaludis-a4d8a6cefb1c6a7ea79d9e27a955bcd8e38ce96d.tar.gz
paludis-a4d8a6cefb1c6a7ea79d9e27a955bcd8e38ce96d.tar.xz
Support ?: lines in sets.
-rw-r--r--NEWS3
-rw-r--r--doc/configuration/sets.html.part.in3
-rw-r--r--paludis/set_file.cc29
3 files changed, 35 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index ad08ec3..bbfe19b 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ trunk/:
* Set names can now be specified in .conf-style set files.
+ * Sets can now contain ?: entries, which are like ? entries but also
+ consider the slot part of the dependency specification.
+
0.26.0_pre1:
* paludis now rebuilds the VDB names and provides caches
incrementally after each install and uninstall. This can give a
diff --git a/doc/configuration/sets.html.part.in b/doc/configuration/sets.html.part.in
index 107ad72..7efdb82 100644
--- a/doc/configuration/sets.html.part.in
+++ b/doc/configuration/sets.html.part.in
@@ -51,5 +51,8 @@ specification or, for some operators, a set name. Permitted operators are:</p>
<dt><code>?</code></dt>
<dd>Indicates that the specification is part of the set if and only if a package whose name is equal to the name
part of the specification is installed. May not be used with a set name.</dd>
+
+ <dt><code>?:</code></dt>
+ <dd>Like <code>?</code>, but considers the slot part of the specification (if any) in addition to the name part.</dd>
</dl>
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index 92df58f..8602d85 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -231,6 +231,35 @@ namespace
Log::get_instance()->message(ll_warning, lc_context, "Line '" + stringify(line) +
"' uses ? operator but does not specify an unambiguous package");
}
+ else if ("?:" == tokens.at(0))
+ {
+ if (std::string::npos == tokens.at(1).find('/'))
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "?: operator may not be used with a set name");
+ return;
+ }
+
+ tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(params.parser(tokens.at(1))));
+ if (params.tag)
+ spec->set_tag(params.tag);
+
+ if (spec->package_ptr())
+ {
+ if (! params.environment)
+ Log::get_instance()->message(ll_warning, lc_context, "Line '" + stringify(line) +
+ "' uses ?: operator but no environment is available");
+ else if (! params.environment->package_database()->query(query::Matches(
+ make_package_dep_spec()
+ .package(*spec->package_ptr())
+ .slot_requirement(spec->slot_requirement_ptr())) &
+ query::InstalledAtRoot(params.environment->root()), qo_whatever)->empty())
+ result->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
+ new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ }
+ else
+ Log::get_instance()->message(ll_warning, lc_context, "Line '" + stringify(line) +
+ "' uses ? operator but does not specify an unambiguous package");
+ }
else
Log::get_instance()->message(ll_warning, lc_context, "Ignoring line '" + stringify(line) +
"' because it does not start with '?' or '*'");