aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-15 16:00:31 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-15 16:00:31 +0000
commit5d772b93f057ee32959e9ae9344162514899590e (patch)
tree41d481804724aa9c9ef98b7d80647c9a8451f2e4
parent945c4efa654b56d005c59b80f7ce29286fad8a32 (diff)
downloadpaludis-5d772b93f057ee32959e9ae9344162514899590e.tar.gz
paludis-5d772b93f057ee32959e9ae9344162514899590e.tar.xz
Support set names in .conf sets.
-rw-r--r--NEWS2
-rw-r--r--doc/configuration/sets.html.part.in6
-rw-r--r--paludis/set_file.cc35
3 files changed, 28 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 87dd8b2..ad08ec3 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ trunk/:
works when the filesystem is mounted as a chroot as a seperate
directory.
+ * Set names can now be specified in .conf-style set files.
+
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 26dc7fc..107ad72 100644
--- a/doc/configuration/sets.html.part.in
+++ b/doc/configuration/sets.html.part.in
@@ -42,14 +42,14 @@ the file <code>sets/foo.conf</code>, which is a standard configuration file and
</div>
<p>Each line in a user set file consists of an operator, followed by whitespace, followed by a package dependency
-specification. Permitted operators are:</p>
+specification or, for some operators, a set name. Permitted operators are:</p>
<dl>
<dt><code>*</code></dt>
- <dd>Indicates that the specification is part of the set.</dd>
+ <dd>Indicates that the specification or set name is part of the set.</dd>
<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.</dd>
+ part of the specification is installed. May not be used with a set name.</dd>
</dl>
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index e118595..92df58f 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -185,23 +185,34 @@ namespace
{
Log::get_instance()->message(ll_warning, lc_context, "Line '" + stringify(line) +
"' should start with '?' or '*', assuming '*'");
-
- tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(params.parser(tokens.at(0))));
- if (params.tag)
- spec->set_tag(params.tag);
- result->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ tokens.insert(tokens.begin(), "*");
}
- else if ("*" == tokens.at(0))
+
+ if ("*" == tokens.at(0))
{
- tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(params.parser(tokens.at(1))));
- if (params.tag)
- spec->set_tag(params.tag);
- result->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ if (std::string::npos == tokens.at(1).find('/'))
+ {
+ tr1::shared_ptr<NamedSetDepSpec> spec(new NamedSetDepSpec(SetName(tokens.at(1))));
+ result->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, NamedSetDepSpec> >(
+ new TreeLeaf<SetSpecTree, NamedSetDepSpec>(spec)));
+ }
+ else
+ {
+ tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(params.parser(tokens.at(1))));
+ if (params.tag)
+ spec->set_tag(params.tag);
+ result->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
+ new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ }
}
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);