aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-02 23:56:53 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-02 23:56:53 +0000
commitaaaaed580a954078e9b6f8b6aaf6b5337f8979ee (patch)
treee9f52649f48ec97c8aa8f05d0bf823511e0e7817
parent69fa594051d412e9e7de0041085974a3188612c2 (diff)
downloadpaludis-aaaaed580a954078e9b6f8b6aaf6b5337f8979ee.tar.gz
paludis-aaaaed580a954078e9b6f8b6aaf6b5337f8979ee.tar.xz
Split up dep spec heirarchies some more. Fixes: ticket:381
-rw-r--r--doc/examples/example_dep_label.cc14
-rw-r--r--paludis/dep_list/condition_tracker.hh3
-rw-r--r--paludis/dep_list/dep_list-fwd.hh2
-rw-r--r--paludis/dep_list/dep_list_TEST.cc8
-rw-r--r--paludis/dep_list/override_functions.cc18
-rw-r--r--paludis/dep_list/range_rewriter.cc1
-rw-r--r--paludis/dep_list/range_rewriter.hh2
-rw-r--r--paludis/dep_spec-fwd.hh33
-rw-r--r--paludis/dep_spec.cc110
-rw-r--r--paludis/dep_spec.hh244
-rw-r--r--paludis/dep_spec_TEST.cc12
-rw-r--r--paludis/dep_spec_flattener.cc12
-rw-r--r--paludis/dep_spec_flattener.hh7
-rw-r--r--paludis/dep_tag.hh3
-rw-r--r--paludis/dep_tree-fwd.hh36
-rw-r--r--paludis/dep_tree.cc91
-rw-r--r--paludis/dep_tree.hh241
-rw-r--r--paludis/environment.hh1
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/formatter.hh7
-rw-r--r--paludis/match_package.hh3
-rw-r--r--paludis/metadata_key.cc5
-rw-r--r--paludis/metadata_key.hh16
-rw-r--r--paludis/package_id.hh9
-rw-r--r--paludis/repositories/cran/cran_dep_parser.hh2
-rw-r--r--paludis/repositories/cran/cran_package_id.cc22
-rw-r--r--paludis/repositories/cran/cran_package_id.hh6
-rw-r--r--paludis/repositories/cran/dep_spec_pretty_printer.hh3
-rw-r--r--paludis/repositories/cran/keys.cc20
-rw-r--r--paludis/repositories/cran/keys.hh15
-rw-r--r--paludis/repositories/e/aa_visitor.cc18
-rw-r--r--paludis/repositories/e/aa_visitor.hh18
-rw-r--r--paludis/repositories/e/aa_visitor_TEST.cc2
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc10
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh17
-rw-r--r--paludis/repositories/e/dep_parser.cc74
-rw-r--r--paludis/repositories/e/dep_parser.hh12
-rw-r--r--paludis/repositories/e/dep_parser_TEST.cc58
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc46
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.hh12
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer_TEST.cc28
-rw-r--r--paludis/repositories/e/e_key.cc110
-rw-r--r--paludis/repositories/e/e_key.hh41
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc8
-rw-r--r--paludis/repositories/e/e_repository_id.hh1
-rw-r--r--paludis/repositories/e/e_repository_profile.hh3
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc6
-rw-r--r--paludis/repositories/e/eapi.hh1
-rw-r--r--paludis/repositories/e/ebuild_entries.cc74
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc2
-rw-r--r--paludis/repositories/e/ebuild_id.cc20
-rw-r--r--paludis/repositories/e/ebuild_id.hh7
-rw-r--r--paludis/repositories/e/fetch_visitor.cc10
-rw-r--r--paludis/repositories/e/fetch_visitor.hh13
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc2
-rw-r--r--paludis/repositories/e/qa/extractors.cc20
-rw-r--r--paludis/repositories/e/qa/homepage_key.cc29
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc29
-rw-r--r--paludis/repositories/e/qa/visibility.cc3
-rw-r--r--paludis/repositories/e/vdb_id.cc18
-rw-r--r--paludis/repositories/e/vdb_id.hh5
-rw-r--r--paludis/repositories/e/vdb_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc65
-rw-r--r--paludis/repositories/fake/fake_package_id.hh25
-rw-r--r--paludis/repositories/gems/gem_specification.cc20
-rw-r--r--paludis/repositories/gems/gem_specification.hh6
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc6
-rw-r--r--paludis/repositories/virtuals/package_id.cc20
-rw-r--r--paludis/repositories/virtuals/package_id.hh6
-rw-r--r--paludis/repository.hh3
-rw-r--r--paludis/set_file.hh4
-rw-r--r--paludis/stringify_formatter-impl.hh26
-rw-r--r--paludis/stringify_formatter.cc50
-rw-r--r--paludis/stringify_formatter.hh14
-rw-r--r--paludis/stringify_formatter_TEST.cc1
-rw-r--r--paludis/tasks/uninstall_task.hh4
-rw-r--r--python/additional_tests.cc3
-rw-r--r--python/dep_spec.cc186
-rw-r--r--python/dep_spec.hh49
-rw-r--r--python/metadata_key.cc26
-rwxr-xr-xpython/metadata_key_TEST.py24
-rw-r--r--ruby/package_id.cc7
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc18
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh14
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc7
-rw-r--r--src/clients/instruo/instruo.cc18
-rw-r--r--src/clients/qualudis/qualudis.cc7
-rw-r--r--src/output/colour_formatter.cc18
-rw-r--r--src/output/colour_formatter.hh14
-rw-r--r--src/output/console_query_task.cc33
-rw-r--r--src/output/mask_displayer.cc8
91 files changed, 1488 insertions, 840 deletions
diff --git a/doc/examples/example_dep_label.cc b/doc/examples/example_dep_label.cc
index d416e75..ce701ba 100644
--- a/doc/examples/example_dep_label.cc
+++ b/doc/examples/example_dep_label.cc
@@ -84,7 +84,7 @@ namespace
* of the stack, since labels recurse into subblocks. When we encounter
* a label, we replace the top item of the stack. */
class DistfilesCollector :
- public ConstVisitor<URISpecTree>
+ public ConstVisitor<FetchableURISpecTree>
{
private:
ResultsMap & _results;
@@ -98,8 +98,8 @@ namespace
}
void visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
/* When we encounter an AllDepSpec, duplicate the top item of
* our restricted stack, and then recurse over all of its
@@ -110,8 +110,8 @@ namespace
}
void visit_sequence(const UseDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
/* Always recurse over a UseDepSpec's children. In real world
* code, we would more likely check whether the use flag is
@@ -121,9 +121,9 @@ namespace
_restricted.pop_back();
}
- void visit_leaf(const URIDepSpec & s)
+ void visit_leaf(const FetchableURIDepSpec & s)
{
- /* When we encounter a URIDepSpec, store its distfile name.
+ /* When we encounter a FetchableURIDepSpec, store its distfile name.
* We handle 'a -> b' style specs by taking 'b' as the
* distfile name. */
_results.insert(std::make_pair(s.filename(), _restricted.back()));
diff --git a/paludis/dep_list/condition_tracker.hh b/paludis/dep_list/condition_tracker.hh
index 8f9fece..aaf2263 100644
--- a/paludis/dep_list/condition_tracker.hh
+++ b/paludis/dep_list/condition_tracker.hh
@@ -23,7 +23,8 @@
#include <paludis/util/tr1_memory.hh>
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/visitor.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
+#include <paludis/dep_spec-fwd.hh>
namespace paludis
{
diff --git a/paludis/dep_list/dep_list-fwd.hh b/paludis/dep_list/dep_list-fwd.hh
index 038b025..9f0e0c4 100644
--- a/paludis/dep_list/dep_list-fwd.hh
+++ b/paludis/dep_list/dep_list-fwd.hh
@@ -22,7 +22,7 @@
#include <paludis/util/tr1_memory.hh>
#include <paludis/repository-fwd.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 4620016..109c038 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -1740,7 +1740,7 @@ namespace test_cases
cat_three_has_tag_from_cat_one = true;
TEST_CHECK_STRINGIFY_EQUAL(*tag->dependency(), "cat/three");
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
tag->conditions()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "cat/three");
}
@@ -1751,7 +1751,7 @@ namespace test_cases
{
cat_three_has_first_tag_from_cat_two = true;
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
tag->conditions()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "enabled? ( || ( <cat/three-1 ) )");
}
@@ -1759,7 +1759,7 @@ namespace test_cases
{
cat_three_has_second_tag_from_cat_two = true;
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
tag->conditions()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "enabled? ( || ( cat/three:0 ) )");
}
@@ -1786,7 +1786,7 @@ namespace test_cases
TEST_CHECK_EQUAL(deptag->short_text(), "cat/two-1:0::repo");
TEST_CHECK_STRINGIFY_EQUAL(*deptag->dependency(), "=cat/four-1");
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
deptag->conditions()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "enabled? ( || ( =cat/four-1 ) )");
diff --git a/paludis/dep_list/override_functions.cc b/paludis/dep_list/override_functions.cc
index cf9c2c3..15ddae0 100644
--- a/paludis/dep_list/override_functions.cc
+++ b/paludis/dep_list/override_functions.cc
@@ -77,7 +77,11 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
}
@@ -204,7 +208,11 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
}
@@ -356,7 +364,11 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
{
}
diff --git a/paludis/dep_list/range_rewriter.cc b/paludis/dep_list/range_rewriter.cc
index 4eefb58..a951257 100644
--- a/paludis/dep_list/range_rewriter.cc
+++ b/paludis/dep_list/range_rewriter.cc
@@ -19,6 +19,7 @@
#include "range_rewriter.hh"
#include <paludis/util/sequence.hh>
+#include <paludis/dep_spec.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
diff --git a/paludis/dep_list/range_rewriter.hh b/paludis/dep_list/range_rewriter.hh
index 81d1d2f..7d793f9 100644
--- a/paludis/dep_list/range_rewriter.hh
+++ b/paludis/dep_list/range_rewriter.hh
@@ -20,7 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_LIST_RANGE_REWRITER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_LIST_RANGE_REWRITER_HH 1
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
namespace paludis
{
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index 997f6ee..7eec2d2 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -23,9 +23,9 @@
#include <iosfwd>
#include <string>
#include <paludis/dep_label-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
#include <paludis/formatter-fwd.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/visitor.hh>
/** \file
* Forward declarations for paludis/dep_spec.hh .
@@ -38,7 +38,9 @@ namespace paludis
class DepSpec;
class PackageDepSpec;
class PlainTextDepSpec;
- class URIDepSpec;
+ class LicenseDepSpec;
+ class FetchableURIDepSpec;
+ class SimpleURIDepSpec;
class AllDepSpec;
class AnyDepSpec;
class UseDepSpec;
@@ -48,15 +50,6 @@ namespace paludis
typedef LabelsDepSpec<URILabelVisitorTypes> URILabelDepSpec;
typedef LabelsDepSpec<DependencyLabelVisitorTypes> DependencyLabelDepSpec;
- struct GenericSpecTree;
- struct LicenseSpecTree;
- struct URISpecTree;
- struct FlattenableSpecTree;
- struct ProvideSpecTree;
- struct RestrictSpecTree;
- struct DependencySpecTree;
- struct SetSpecTree;
-
#include <paludis/dep_spec-se.hh>
/**
@@ -97,11 +90,25 @@ namespace paludis
std::ostream & operator<< (std::ostream &, const BlockDepSpec &) PALUDIS_VISIBLE;
/**
- * A URIDepSpec can be written to an ostream.
+ * A SimpleURIDepSpec can be written to an ostream.
+ *
+ * \ingroup grpdepspecs
+ */
+ std::ostream & operator<< (std::ostream &, const SimpleURIDepSpec &) PALUDIS_VISIBLE;
+
+ /**
+ * A FetchableURIDepSpec can be written to an ostream.
+ *
+ * \ingroup grpdepspecs
+ */
+ std::ostream & operator<< (std::ostream &, const FetchableURIDepSpec &) PALUDIS_VISIBLE;
+
+ /**
+ * A LicenseDepSpec can be written to an ostream.
*
* \ingroup grpdepspecs
*/
- std::ostream & operator<< (std::ostream &, const URIDepSpec &) PALUDIS_VISIBLE;
+ std::ostream & operator<< (std::ostream &, const LicenseDepSpec &) PALUDIS_VISIBLE;
/**
* A UseDepSpec can be written to an ostream.
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 4ac1cfe..92762e7 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -25,10 +25,10 @@
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
#include <paludis/util/iterator.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/sequence.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <list>
@@ -42,63 +42,6 @@
using namespace paludis;
-template class ConstVisitor<GenericSpecTree>;
-template class ConstAcceptInterface<GenericSpecTree>;
-template class TreeLeaf<GenericSpecTree, PackageDepSpec>;
-template class TreeLeaf<GenericSpecTree, BlockDepSpec>;
-template class TreeLeaf<GenericSpecTree, PlainTextDepSpec>;
-template class TreeLeaf<GenericSpecTree, URIDepSpec>;
-template class ConstTreeSequence<GenericSpecTree, AllDepSpec>;
-template class ConstTreeSequence<GenericSpecTree, AnyDepSpec>;
-template class ConstTreeSequence<GenericSpecTree, UseDepSpec>;
-
-template class ConstVisitor<LicenseSpecTree>;
-template class ConstAcceptInterface<LicenseSpecTree>;
-template class TreeLeaf<LicenseSpecTree, PlainTextDepSpec>;
-template class ConstTreeSequence<LicenseSpecTree, AllDepSpec>;
-template class ConstTreeSequence<LicenseSpecTree, AnyDepSpec>;
-template class ConstTreeSequence<LicenseSpecTree, UseDepSpec>;
-
-template class ConstVisitor<URISpecTree>;
-template class ConstAcceptInterface<URISpecTree>;
-template class TreeLeaf<URISpecTree, URIDepSpec>;
-template class ConstTreeSequence<URISpecTree, AllDepSpec>;
-template class ConstTreeSequence<URISpecTree, UseDepSpec>;
-
-template class ConstVisitor<FlattenableSpecTree>;
-template class ConstAcceptInterface<FlattenableSpecTree>;
-template class TreeLeaf<FlattenableSpecTree, PackageDepSpec>;
-template class TreeLeaf<FlattenableSpecTree, BlockDepSpec>;
-template class TreeLeaf<FlattenableSpecTree, PlainTextDepSpec>;
-template class TreeLeaf<FlattenableSpecTree, URIDepSpec>;
-template class ConstTreeSequence<FlattenableSpecTree, AllDepSpec>;
-template class ConstTreeSequence<FlattenableSpecTree, UseDepSpec>;
-
-template class ConstVisitor<ProvideSpecTree>;
-template class ConstAcceptInterface<ProvideSpecTree>;
-template class TreeLeaf<ProvideSpecTree, PackageDepSpec>;
-template class ConstTreeSequence<ProvideSpecTree, AllDepSpec>;
-template class ConstTreeSequence<ProvideSpecTree, UseDepSpec>;
-
-template class ConstVisitor<RestrictSpecTree>;
-template class ConstAcceptInterface<RestrictSpecTree>;
-template class TreeLeaf<RestrictSpecTree, PlainTextDepSpec>;
-template class ConstTreeSequence<RestrictSpecTree, AllDepSpec>;
-template class ConstTreeSequence<RestrictSpecTree, UseDepSpec>;
-
-template class ConstVisitor<DependencySpecTree>;
-template class TreeLeaf<DependencySpecTree, PackageDepSpec>;
-template class TreeLeaf<DependencySpecTree, BlockDepSpec>;
-template class ConstTreeSequence<DependencySpecTree, AllDepSpec>;
-template class ConstTreeSequence<DependencySpecTree, AnyDepSpec>;
-template class ConstTreeSequence<DependencySpecTree, UseDepSpec>;
-template class ConstAcceptInterface<DependencySpecTree>;
-
-template class ConstVisitor<SetSpecTree>;
-template class ConstAcceptInterface<SetSpecTree>;
-template class TreeLeaf<SetSpecTree, PackageDepSpec>;
-template class ConstTreeSequence<SetSpecTree, AllDepSpec>;
-
#include <paludis/dep_spec-se.cc>
DepSpec::DepSpec()
@@ -647,6 +590,13 @@ paludis::operator<< (std::ostream & s, const PlainTextDepSpec & a)
}
std::ostream &
+paludis::operator<< (std::ostream & s, const LicenseDepSpec & a)
+{
+ s << a.text();
+ return s;
+}
+
+std::ostream &
paludis::operator<< (std::ostream & s, const BlockDepSpec & a)
{
s << "!" << *a.blocked_spec();
@@ -663,7 +613,7 @@ paludis::operator<< (std::ostream & s, const UseDepSpec & a)
}
std::ostream &
-paludis::operator<< (std::ostream & s, const URIDepSpec & p)
+paludis::operator<< (std::ostream & s, const FetchableURIDepSpec & p)
{
if (! p.renamed_url_suffix().empty())
s << p.original_url() << " -> " << p.renamed_url_suffix();
@@ -674,6 +624,13 @@ paludis::operator<< (std::ostream & s, const URIDepSpec & p)
}
std::ostream &
+paludis::operator<< (std::ostream & s, const SimpleURIDepSpec & p)
+{
+ s << p.text();
+ return s;
+}
+
+std::ostream &
paludis::operator<< (std::ostream & s, const PackageDepSpec & a)
{
if (a.version_requirements_ptr())
@@ -828,6 +785,29 @@ PlainTextDepSpec::clone() const
return tr1::shared_ptr<DepSpec>(new PlainTextDepSpec(text()));
}
+LicenseDepSpec::LicenseDepSpec(const std::string & s) :
+ StringDepSpec(s)
+{
+}
+
+tr1::shared_ptr<DepSpec>
+LicenseDepSpec::clone() const
+{
+ return tr1::shared_ptr<DepSpec>(new LicenseDepSpec(text()));
+}
+
+SimpleURIDepSpec::SimpleURIDepSpec(const std::string & s) :
+ StringDepSpec(s)
+{
+}
+
+tr1::shared_ptr<DepSpec>
+SimpleURIDepSpec::clone() const
+{
+ return tr1::shared_ptr<DepSpec>(new SimpleURIDepSpec(text()));
+}
+
+
namespace paludis
{
/**
@@ -1029,13 +1009,13 @@ BlockDepSpec::clone() const
return tr1::shared_ptr<DepSpec>(new BlockDepSpec(tr1::static_pointer_cast<PackageDepSpec>(_spec->clone())));
}
-URIDepSpec::URIDepSpec(const std::string & s) :
+FetchableURIDepSpec::FetchableURIDepSpec(const std::string & s) :
StringDepSpec(s)
{
}
std::string
-URIDepSpec::original_url() const
+FetchableURIDepSpec::original_url() const
{
std::string::size_type p(text().find(" -> "));
if (std::string::npos == p)
@@ -1045,7 +1025,7 @@ URIDepSpec::original_url() const
}
std::string
-URIDepSpec::renamed_url_suffix() const
+FetchableURIDepSpec::renamed_url_suffix() const
{
std::string::size_type p(text().find(" -> "));
if (std::string::npos == p)
@@ -1055,7 +1035,7 @@ URIDepSpec::renamed_url_suffix() const
}
std::string
-URIDepSpec::filename() const
+FetchableURIDepSpec::filename() const
{
std::string rus = renamed_url_suffix();
if (! rus.empty())
@@ -1070,9 +1050,9 @@ URIDepSpec::filename() const
}
tr1::shared_ptr<DepSpec>
-URIDepSpec::clone() const
+FetchableURIDepSpec::clone() const
{
- return tr1::shared_ptr<URIDepSpec>(new URIDepSpec(text()));
+ return tr1::shared_ptr<FetchableURIDepSpec>(new FetchableURIDepSpec(text()));
}
namespace paludis
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index ba7a902..54a0d29 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -20,23 +20,22 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_SPEC_HH
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_HH 1
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/dep_tag-fwd.hh>
-#include <paludis/dep_label.hh>
-#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/clone.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/visitor-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/version_requirements-fwd.hh>
+#include <paludis/util/tr1_memory.hh>
+
+#include <paludis/dep_label.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tag-fwd.hh>
+#include <paludis/name.hh>
#include <paludis/version_operator-fwd.hh>
+#include <paludis/version_requirements-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
-#include <paludis/util/tr1_memory.hh>
-
/** \file
* Declarations for the DepSpec classes.
*
@@ -46,189 +45,6 @@
namespace paludis
{
/**
- * A generic DepSpec heirarchy.
- *
- * \ingroup grpdepspecs
- */
- struct GenericSpecTree :
- VisitorTypes<
- GenericSpecTree,
- DepSpec,
- TreeLeaf<GenericSpecTree, PlainTextDepSpec>,
- TreeLeaf<GenericSpecTree, URIDepSpec>,
- TreeLeaf<GenericSpecTree, PackageDepSpec>,
- TreeLeaf<GenericSpecTree, BlockDepSpec>,
- TreeLeaf<GenericSpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
- TreeLeaf<GenericSpecTree, LabelsDepSpec<DependencyLabelVisitorTypes> >,
- ConstTreeSequence<GenericSpecTree, AllDepSpec>,
- ConstTreeSequence<GenericSpecTree, AnyDepSpec>,
- ConstTreeSequence<GenericSpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PlainTextDepSpec,
- URIDepSpec,
- PackageDepSpec,
- BlockDepSpec,
- LabelsDepSpec<URILabelVisitorTypes>,
- LabelsDepSpec<DependencyLabelVisitorTypes>
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for licenses.
- *
- * \ingroup grpdepspecs
- */
- struct LicenseSpecTree :
- VisitorTypes<
- LicenseSpecTree,
- DepSpec,
- TreeLeaf<LicenseSpecTree, PlainTextDepSpec>,
- ConstTreeSequence<LicenseSpecTree, AllDepSpec>,
- ConstTreeSequence<LicenseSpecTree, AnyDepSpec>,
- ConstTreeSequence<LicenseSpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PlainTextDepSpec
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for URIs.
- *
- * \ingroup grpdepspecs
- */
- struct URISpecTree :
- VisitorTypes<
- URISpecTree,
- DepSpec,
- TreeLeaf<URISpecTree, URIDepSpec>,
- TreeLeaf<URISpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
- ConstTreeSequence<URISpecTree, AllDepSpec>,
- ConstTreeSequence<URISpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- URIDepSpec,
- LabelsDepSpec<URILabelVisitorTypes>
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things that can be flattened.
- *
- * \ingroup grpdepspecs
- */
- struct FlattenableSpecTree :
- VisitorTypes<
- FlattenableSpecTree,
- DepSpec,
- TreeLeaf<FlattenableSpecTree, PlainTextDepSpec>,
- TreeLeaf<FlattenableSpecTree, URIDepSpec>,
- TreeLeaf<FlattenableSpecTree, PackageDepSpec>,
- TreeLeaf<FlattenableSpecTree, BlockDepSpec>,
- ConstTreeSequence<FlattenableSpecTree, AllDepSpec>,
- ConstTreeSequence<FlattenableSpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PlainTextDepSpec,
- URIDepSpec,
- PackageDepSpec,
- BlockDepSpec
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for provides.
- *
- * \ingroup grpdepspecs
- */
- struct ProvideSpecTree :
- VisitorTypes<
- ProvideSpecTree,
- DepSpec,
- TreeLeaf<ProvideSpecTree, PackageDepSpec>,
- ConstTreeSequence<ProvideSpecTree, AllDepSpec>,
- ConstTreeSequence<ProvideSpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PackageDepSpec
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for restricts.
- *
- * \ingroup grpdepspecs
- */
- struct RestrictSpecTree :
- VisitorTypes<
- RestrictSpecTree,
- DepSpec,
- TreeLeaf<RestrictSpecTree, PlainTextDepSpec>,
- ConstTreeSequence<RestrictSpecTree, AllDepSpec>,
- ConstTreeSequence<RestrictSpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PlainTextDepSpec
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for dependencies.
- *
- * \ingroup grpdepspecs
- */
- struct DependencySpecTree :
- VisitorTypes<
- DependencySpecTree,
- DepSpec,
- TreeLeaf<DependencySpecTree, PackageDepSpec>,
- TreeLeaf<DependencySpecTree, BlockDepSpec>,
- TreeLeaf<DependencySpecTree, LabelsDepSpec<DependencyLabelVisitorTypes> >,
- ConstTreeSequence<DependencySpecTree, AllDepSpec>,
- ConstTreeSequence<DependencySpecTree, AnyDepSpec>,
- ConstTreeSequence<DependencySpecTree, UseDepSpec>
- >
- {
- typedef Formatter<
- UseDepSpec,
- PackageDepSpec,
- BlockDepSpec,
- LabelsDepSpec<DependencyLabelVisitorTypes>
- > Formatter;
- };
-
- /**
- * A DepSpec heirarchy containing things meaningful for sets.
- *
- * \ingroup grpdepspecs
- */
- struct SetSpecTree :
- VisitorTypes<
- SetSpecTree,
- DepSpec,
- TreeLeaf<SetSpecTree, PackageDepSpec>,
- ConstTreeSequence<SetSpecTree, AllDepSpec>
- >
- {
- typedef Formatter<
- PackageDepSpec
- > Formatter;
- };
-
- /**
* Base class for a dependency spec.
*
* \ingroup grpdepspecs
@@ -570,19 +386,39 @@ namespace paludis
};
/**
- * A URIDepSpec represents a URI part.
+ * A LicenseDepSpec represents a license entry.
+ *
+ * \ingroup grpdepspecs
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE LicenseDepSpec :
+ public StringDepSpec
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ LicenseDepSpec(const std::string &);
+
+ ///\}
+
+ virtual tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
+ * A FetchableURIDepSpec represents a fetchable URI part.
*
* \ingroup grpdepspecs
* \nosubgrouping
*/
- class PALUDIS_VISIBLE URIDepSpec :
+ class PALUDIS_VISIBLE FetchableURIDepSpec :
public StringDepSpec
{
public:
///\name Basic operations
///\{
- URIDepSpec(const std::string &);
+ FetchableURIDepSpec(const std::string &);
///\}
@@ -594,6 +430,26 @@ namespace paludis
};
/**
+ * A SimpleURIDepSpec represents a simple URI part.
+ *
+ * \ingroup grpdepspecs
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE SimpleURIDepSpec :
+ public StringDepSpec
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ SimpleURIDepSpec(const std::string &);
+
+ ///\}
+
+ virtual tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
* Thrown if an invalid package dep spec specification is encountered.
*
* \ingroup grpexceptions
diff --git a/paludis/dep_spec_TEST.cc b/paludis/dep_spec_TEST.cc
index 73f6907..2e2e22a 100644
--- a/paludis/dep_spec_TEST.cc
+++ b/paludis/dep_spec_TEST.cc
@@ -192,26 +192,26 @@ namespace test_cases
}
} test_package_dep_spec;
- struct URIDepSpecTest : TestCase
+ struct FetchableURIDepSpecTest : TestCase
{
- URIDepSpecTest() : TestCase("uri dep spec") { }
+ FetchableURIDepSpecTest() : TestCase("fetchable uri dep spec") { }
void run()
{
- URIDepSpec a("foo");
+ FetchableURIDepSpec a("foo");
TEST_CHECK_EQUAL(a.original_url(), "foo");
TEST_CHECK_EQUAL(a.renamed_url_suffix(), "");
TEST_CHECK_EQUAL(a.filename(), "foo");
- URIDepSpec b("fnord -> bar");
+ FetchableURIDepSpec b("fnord -> bar");
TEST_CHECK_EQUAL(b.original_url(), "fnord");
TEST_CHECK_EQUAL(b.renamed_url_suffix(), "bar");
TEST_CHECK_EQUAL(b.filename(), "bar");
- URIDepSpec c("http://example.com/download/baz");
+ FetchableURIDepSpec c("http://example.com/download/baz");
TEST_CHECK_EQUAL(c.filename(), "baz");
}
- } test_uri_dep_spec;
+ } test_fetchable_uri_dep_spec;
struct PackageDepSpecUnspecificTest : TestCase
{
diff --git a/paludis/dep_spec_flattener.cc b/paludis/dep_spec_flattener.cc
index eac8fc6..42feef6 100644
--- a/paludis/dep_spec_flattener.cc
+++ b/paludis/dep_spec_flattener.cc
@@ -106,7 +106,17 @@ void DepSpecFlattener::visit_leaf(const BlockDepSpec & p)
_imp->specs.push_back(tr1::static_pointer_cast<const StringDepSpec>(p.clone()));
}
-void DepSpecFlattener::visit_leaf(const URIDepSpec & p)
+void DepSpecFlattener::visit_leaf(const SimpleURIDepSpec & p)
+{
+ _imp->specs.push_back(tr1::static_pointer_cast<const StringDepSpec>(p.clone()));
+}
+
+void DepSpecFlattener::visit_leaf(const LicenseDepSpec & p)
+{
+ _imp->specs.push_back(tr1::static_pointer_cast<const StringDepSpec>(p.clone()));
+}
+
+void DepSpecFlattener::visit_leaf(const FetchableURIDepSpec & p)
{
_imp->specs.push_back(tr1::static_pointer_cast<const StringDepSpec>(p.clone()));
}
diff --git a/paludis/dep_spec_flattener.hh b/paludis/dep_spec_flattener.hh
index 4768e2b..68a43b5 100644
--- a/paludis/dep_spec_flattener.hh
+++ b/paludis/dep_spec_flattener.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_FLATTENER_HH 1
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/attributes.hh>
@@ -69,7 +70,11 @@ namespace paludis
void visit_leaf(const BlockDepSpec &);
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const FetchableURIDepSpec &);
+
+ void visit_leaf(const SimpleURIDepSpec &);
+
+ void visit_leaf(const LicenseDepSpec &);
///}
diff --git a/paludis/dep_tag.hh b/paludis/dep_tag.hh
index 6f895b9..d98a197 100644
--- a/paludis/dep_tag.hh
+++ b/paludis/dep_tag.hh
@@ -27,7 +27,8 @@
*/
#include <paludis/dep_tag-fwd.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/instantiation_policy.hh>
diff --git a/paludis/dep_tree-fwd.hh b/paludis/dep_tree-fwd.hh
new file mode 100644
index 0000000..567a992
--- /dev/null
+++ b/paludis/dep_tree-fwd.hh
@@ -0,0 +1,36 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_TREE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_TREE_FWD_HH 1
+
+namespace paludis
+{
+ struct GenericSpecTree;
+ struct LicenseSpecTree;
+ struct FetchableURISpecTree;
+ struct SimpleURISpecTree;
+ struct FlattenableSpecTree;
+ struct ProvideSpecTree;
+ struct RestrictSpecTree;
+ struct DependencySpecTree;
+ struct SetSpecTree;
+}
+
+#endif
diff --git a/paludis/dep_tree.cc b/paludis/dep_tree.cc
new file mode 100644
index 0000000..d68a758
--- /dev/null
+++ b/paludis/dep_tree.cc
@@ -0,0 +1,91 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/dep_tree.hh>
+#include <paludis/util/visitor-impl.hh>
+
+using namespace paludis;
+
+template class ConstVisitor<GenericSpecTree>;
+template class ConstAcceptInterface<GenericSpecTree>;
+template class TreeLeaf<GenericSpecTree, PackageDepSpec>;
+template class TreeLeaf<GenericSpecTree, BlockDepSpec>;
+template class TreeLeaf<GenericSpecTree, PlainTextDepSpec>;
+template class TreeLeaf<GenericSpecTree, SimpleURIDepSpec>;
+template class TreeLeaf<GenericSpecTree, FetchableURIDepSpec>;
+template class TreeLeaf<GenericSpecTree, LicenseDepSpec>;
+template class ConstTreeSequence<GenericSpecTree, AllDepSpec>;
+template class ConstTreeSequence<GenericSpecTree, AnyDepSpec>;
+template class ConstTreeSequence<GenericSpecTree, UseDepSpec>;
+
+template class ConstVisitor<LicenseSpecTree>;
+template class ConstAcceptInterface<LicenseSpecTree>;
+template class TreeLeaf<LicenseSpecTree, LicenseDepSpec>;
+template class ConstTreeSequence<LicenseSpecTree, AllDepSpec>;
+template class ConstTreeSequence<LicenseSpecTree, AnyDepSpec>;
+template class ConstTreeSequence<LicenseSpecTree, UseDepSpec>;
+
+template class ConstVisitor<FetchableURISpecTree>;
+template class ConstAcceptInterface<FetchableURISpecTree>;
+template class TreeLeaf<FetchableURISpecTree, FetchableURIDepSpec>;
+template class ConstTreeSequence<FetchableURISpecTree, AllDepSpec>;
+template class ConstTreeSequence<FetchableURISpecTree, UseDepSpec>;
+
+template class ConstVisitor<SimpleURISpecTree>;
+template class ConstAcceptInterface<SimpleURISpecTree>;
+template class TreeLeaf<SimpleURISpecTree, SimpleURIDepSpec>;
+template class ConstTreeSequence<SimpleURISpecTree, AllDepSpec>;
+template class ConstTreeSequence<SimpleURISpecTree, UseDepSpec>;
+
+template class ConstVisitor<FlattenableSpecTree>;
+template class ConstAcceptInterface<FlattenableSpecTree>;
+template class TreeLeaf<FlattenableSpecTree, PackageDepSpec>;
+template class TreeLeaf<FlattenableSpecTree, BlockDepSpec>;
+template class TreeLeaf<FlattenableSpecTree, PlainTextDepSpec>;
+template class TreeLeaf<FlattenableSpecTree, SimpleURIDepSpec>;
+template class TreeLeaf<FlattenableSpecTree, FetchableURIDepSpec>;
+template class TreeLeaf<FlattenableSpecTree, LicenseDepSpec>;
+template class ConstTreeSequence<FlattenableSpecTree, AllDepSpec>;
+template class ConstTreeSequence<FlattenableSpecTree, UseDepSpec>;
+
+template class ConstVisitor<ProvideSpecTree>;
+template class ConstAcceptInterface<ProvideSpecTree>;
+template class TreeLeaf<ProvideSpecTree, PackageDepSpec>;
+template class ConstTreeSequence<ProvideSpecTree, AllDepSpec>;
+template class ConstTreeSequence<ProvideSpecTree, UseDepSpec>;
+
+template class ConstVisitor<RestrictSpecTree>;
+template class ConstAcceptInterface<RestrictSpecTree>;
+template class TreeLeaf<RestrictSpecTree, PlainTextDepSpec>;
+template class ConstTreeSequence<RestrictSpecTree, AllDepSpec>;
+template class ConstTreeSequence<RestrictSpecTree, UseDepSpec>;
+
+template class ConstVisitor<DependencySpecTree>;
+template class TreeLeaf<DependencySpecTree, PackageDepSpec>;
+template class TreeLeaf<DependencySpecTree, BlockDepSpec>;
+template class ConstTreeSequence<DependencySpecTree, AllDepSpec>;
+template class ConstTreeSequence<DependencySpecTree, AnyDepSpec>;
+template class ConstTreeSequence<DependencySpecTree, UseDepSpec>;
+template class ConstAcceptInterface<DependencySpecTree>;
+
+template class ConstVisitor<SetSpecTree>;
+template class ConstAcceptInterface<SetSpecTree>;
+template class TreeLeaf<SetSpecTree, PackageDepSpec>;
+template class ConstTreeSequence<SetSpecTree, AllDepSpec>;
+
diff --git a/paludis/dep_tree.hh b/paludis/dep_tree.hh
new file mode 100644
index 0000000..3442bc3
--- /dev/null
+++ b/paludis/dep_tree.hh
@@ -0,0 +1,241 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_TREE_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_TREE_HH 1
+
+#include <paludis/dep_tree-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/util/visitor.hh>
+
+namespace paludis
+{
+ /**
+ * A generic DepSpec heirarchy.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct GenericSpecTree :
+ VisitorTypes<
+ GenericSpecTree,
+ DepSpec,
+ TreeLeaf<GenericSpecTree, PlainTextDepSpec>,
+ TreeLeaf<GenericSpecTree, SimpleURIDepSpec>,
+ TreeLeaf<GenericSpecTree, FetchableURIDepSpec>,
+ TreeLeaf<GenericSpecTree, LicenseDepSpec>,
+ TreeLeaf<GenericSpecTree, PackageDepSpec>,
+ TreeLeaf<GenericSpecTree, BlockDepSpec>,
+ TreeLeaf<GenericSpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
+ TreeLeaf<GenericSpecTree, LabelsDepSpec<DependencyLabelVisitorTypes> >,
+ ConstTreeSequence<GenericSpecTree, AllDepSpec>,
+ ConstTreeSequence<GenericSpecTree, AnyDepSpec>,
+ ConstTreeSequence<GenericSpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ PlainTextDepSpec,
+ SimpleURIDepSpec,
+ FetchableURIDepSpec,
+ LicenseDepSpec,
+ PackageDepSpec,
+ BlockDepSpec,
+ LabelsDepSpec<URILabelVisitorTypes>,
+ LabelsDepSpec<DependencyLabelVisitorTypes>
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for licenses.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct LicenseSpecTree :
+ VisitorTypes<
+ LicenseSpecTree,
+ DepSpec,
+ TreeLeaf<LicenseSpecTree, LicenseDepSpec>,
+ ConstTreeSequence<LicenseSpecTree, AllDepSpec>,
+ ConstTreeSequence<LicenseSpecTree, AnyDepSpec>,
+ ConstTreeSequence<LicenseSpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ LicenseDepSpec
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for fetchable URIs.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct FetchableURISpecTree :
+ VisitorTypes<
+ FetchableURISpecTree,
+ DepSpec,
+ TreeLeaf<FetchableURISpecTree, FetchableURIDepSpec>,
+ TreeLeaf<FetchableURISpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
+ ConstTreeSequence<FetchableURISpecTree, AllDepSpec>,
+ ConstTreeSequence<FetchableURISpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ FetchableURIDepSpec,
+ LabelsDepSpec<URILabelVisitorTypes>
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for simple URIs.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct SimpleURISpecTree :
+ VisitorTypes<
+ SimpleURISpecTree,
+ DepSpec,
+ TreeLeaf<SimpleURISpecTree, SimpleURIDepSpec>,
+ ConstTreeSequence<SimpleURISpecTree, AllDepSpec>,
+ ConstTreeSequence<SimpleURISpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ SimpleURIDepSpec
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things that can be flattened.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct FlattenableSpecTree :
+ VisitorTypes<
+ FlattenableSpecTree,
+ DepSpec,
+ TreeLeaf<FlattenableSpecTree, PlainTextDepSpec>,
+ TreeLeaf<FlattenableSpecTree, SimpleURIDepSpec>,
+ TreeLeaf<FlattenableSpecTree, FetchableURIDepSpec>,
+ TreeLeaf<FlattenableSpecTree, PackageDepSpec>,
+ TreeLeaf<FlattenableSpecTree, BlockDepSpec>,
+ TreeLeaf<FlattenableSpecTree, LicenseDepSpec>,
+ ConstTreeSequence<FlattenableSpecTree, AllDepSpec>,
+ ConstTreeSequence<FlattenableSpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ PlainTextDepSpec,
+ SimpleURIDepSpec,
+ FetchableURIDepSpec,
+ LicenseDepSpec,
+ PackageDepSpec,
+ BlockDepSpec
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for provides.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct ProvideSpecTree :
+ VisitorTypes<
+ ProvideSpecTree,
+ DepSpec,
+ TreeLeaf<ProvideSpecTree, PackageDepSpec>,
+ ConstTreeSequence<ProvideSpecTree, AllDepSpec>,
+ ConstTreeSequence<ProvideSpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ PackageDepSpec
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for restricts.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct RestrictSpecTree :
+ VisitorTypes<
+ RestrictSpecTree,
+ DepSpec,
+ TreeLeaf<RestrictSpecTree, PlainTextDepSpec>,
+ ConstTreeSequence<RestrictSpecTree, AllDepSpec>,
+ ConstTreeSequence<RestrictSpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ PlainTextDepSpec
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for dependencies.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct DependencySpecTree :
+ VisitorTypes<
+ DependencySpecTree,
+ DepSpec,
+ TreeLeaf<DependencySpecTree, PackageDepSpec>,
+ TreeLeaf<DependencySpecTree, BlockDepSpec>,
+ TreeLeaf<DependencySpecTree, LabelsDepSpec<DependencyLabelVisitorTypes> >,
+ ConstTreeSequence<DependencySpecTree, AllDepSpec>,
+ ConstTreeSequence<DependencySpecTree, AnyDepSpec>,
+ ConstTreeSequence<DependencySpecTree, UseDepSpec>
+ >
+ {
+ typedef Formatter<
+ UseDepSpec,
+ PackageDepSpec,
+ BlockDepSpec,
+ LabelsDepSpec<DependencyLabelVisitorTypes>
+ > Formatter;
+ };
+
+ /**
+ * A DepSpec heirarchy containing things meaningful for sets.
+ *
+ * \ingroup grpdepspecs
+ */
+ struct SetSpecTree :
+ VisitorTypes<
+ SetSpecTree,
+ DepSpec,
+ TreeLeaf<SetSpecTree, PackageDepSpec>,
+ ConstTreeSequence<SetSpecTree, AllDepSpec>
+ >
+ {
+ typedef Formatter<
+ PackageDepSpec
+ > Formatter;
+ };
+}
+
+#endif
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 0d7c85b..9186bf8 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -28,6 +28,7 @@
#include <paludis/hook-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/mask-fwd.hh>
diff --git a/paludis/files.m4 b/paludis/files.m4
index a5d5b2c..9e8c7e1 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -14,6 +14,7 @@ add(`contents', `hh', `cc', `fwd')
add(`dep_label', `hh', `cc', `fwd')
add(`dep_spec', `hh', `cc', `se', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
+add(`dep_tree', `hh', `cc', `fwd')
add(`dep_tag', `hh', `cc', `fwd', `sr')
add(`distribution', `hh', `cc', `fwd', `sr')
add(`environment', `hh', `fwd', `cc', `se')
diff --git a/paludis/formatter.hh b/paludis/formatter.hh
index d4ec9f3..e38a500 100644
--- a/paludis/formatter.hh
+++ b/paludis/formatter.hh
@@ -23,15 +23,12 @@
#include <paludis/formatter-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/attributes.hh>
#include <string>
namespace paludis
{
- class PlainTextDepSpec;
- class UseDepSpec;
- class PackageDepSpec;
-
namespace format
{
struct Plain
@@ -110,7 +107,7 @@ namespace paludis
};
template <>
- struct CategorySelector<PlainTextDepSpec>
+ struct CategorySelector<LicenseDepSpec>
{
typedef AcceptableRoles Category;
};
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 8558e70..f6234bd 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -15,7 +15,8 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/tr1_memory.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index a5b0fde..210a6b0 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -122,7 +122,7 @@ MetadataSpecTreeKey<C_>::MetadataSpecTreeKey(const std::string & r, const std::s
{
}
-MetadataSpecTreeKey<URISpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+MetadataSpecTreeKey<FetchableURISpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
MetadataKey(r, h, t)
{
}
@@ -137,5 +137,6 @@ template class MetadataSpecTreeKey<LicenseSpecTree>;
template class MetadataSpecTreeKey<ProvideSpecTree>;
template class MetadataSpecTreeKey<DependencySpecTree>;
template class MetadataSpecTreeKey<RestrictSpecTree>;
-template class MetadataSpecTreeKey<URISpecTree>;
+template class MetadataSpecTreeKey<FetchableURISpecTree>;
+template class MetadataSpecTreeKey<SimpleURISpecTree>;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 0cbcc12..92c6e41 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -24,7 +24,8 @@
#include <paludis/mask-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/contents-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/formatter-fwd.hh>
@@ -49,7 +50,8 @@ namespace paludis
MetadataSetKey<PackageIDSequence>,
MetadataSpecTreeKey<DependencySpecTree>,
MetadataSpecTreeKey<LicenseSpecTree>,
- MetadataSpecTreeKey<URISpecTree>,
+ MetadataSpecTreeKey<FetchableURISpecTree>,
+ MetadataSpecTreeKey<SimpleURISpecTree>,
MetadataSpecTreeKey<ProvideSpecTree>,
MetadataSpecTreeKey<RestrictSpecTree>,
MetadataStringKey,
@@ -208,21 +210,21 @@ namespace paludis
};
template <>
- class PALUDIS_VISIBLE MetadataSpecTreeKey<URISpecTree> :
+ class PALUDIS_VISIBLE MetadataSpecTreeKey<FetchableURISpecTree> :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<URISpecTree> >
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<FetchableURISpecTree> >
{
protected:
MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
public:
- virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ virtual const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print_flat(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual const tr1::shared_ptr<const URILabel> initial_label() const
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 3eecf76..9b835d5 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -30,12 +30,15 @@
#include <paludis/action-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree-fwd.hh>
#include <paludis/mask-fwd.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/version_spec-fwd.hh>
+#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
+
namespace paludis
{
class PackageDatabase;
@@ -77,10 +80,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const = 0;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const = 0;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const = 0;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const = 0;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const = 0;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const = 0;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const = 0;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const = 0;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const = 0;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const = 0;
diff --git a/paludis/repositories/cran/cran_dep_parser.hh b/paludis/repositories/cran/cran_dep_parser.hh
index 0b33838..c3e93f9 100644
--- a/paludis/repositories/cran/cran_dep_parser.hh
+++ b/paludis/repositories/cran/cran_dep_parser.hh
@@ -21,7 +21,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_CRAN_DEP_PARSER_HH
#define PALUDIS_GUARD_PALUDIS_CRAN_DEP_PARSER_HH 1
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <string>
namespace paludis
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index aaa840a..a77d2ef 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -64,7 +64,7 @@ namespace paludis
VersionSpec version;
tr1::shared_ptr<FSLocationKey> fs_location_key;
- tr1::shared_ptr<URIKey> homepage_key;
+ tr1::shared_ptr<SimpleURIKey> homepage_key;
tr1::shared_ptr<StringKey> short_description_key;
tr1::shared_ptr<StringKey> long_description_key;
tr1::shared_ptr<PackageIDKey> contained_in_key;
@@ -153,7 +153,7 @@ CRANPackageID::CRANPackageID(const Environment * const env, const tr1::shared_pt
if (! file.get("URL").empty())
{
Context local_context("When handling URL: key:");
- _imp->homepage_key.reset(new URIKey("URL", "URL", file.get("URL"), mkt_significant));
+ _imp->homepage_key.reset(new SimpleURIKey("URL", "URL", file.get("URL"), mkt_significant));
add_metadata_key(_imp->homepage_key);
}
@@ -368,25 +368,13 @@ CRANPackageID::suggested_dependencies_key() const
return tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >
-CRANPackageID::restrict_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
CRANPackageID::src_uri_key() const
{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-CRANPackageID::bin_uri_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
+ return tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
CRANPackageID::homepage_key() const
{
return _imp->homepage_key;
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index 7bb6658..e982900 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -66,10 +66,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
diff --git a/paludis/repositories/cran/dep_spec_pretty_printer.hh b/paludis/repositories/cran/dep_spec_pretty_printer.hh
index 765210d..594cbd9 100644
--- a/paludis/repositories/cran/dep_spec_pretty_printer.hh
+++ b/paludis/repositories/cran/dep_spec_pretty_printer.hh
@@ -21,7 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_CRAN_DEP_SPEC_PRETTY_PRINTER_HH 1
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
+#include <paludis/dep_spec-fwd.hh>
#include <paludis/formatter.hh>
#include <paludis/environment-fwd.hh>
#include <iosfwd>
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index 1627953..64f9d73 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -35,36 +35,30 @@
using namespace paludis;
using namespace paludis::cranrepository;
-URIKey::URIKey(const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<URISpecTree>(r, h, t),
+SimpleURIKey::SimpleURIKey(const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
+ MetadataSpecTreeKey<SimpleURISpecTree>(r, h, t),
_v(v)
{
}
-const tr1::shared_ptr<const URISpecTree::ConstItem>
-URIKey::value() const
+const tr1::shared_ptr<const SimpleURISpecTree::ConstItem>
+SimpleURIKey::value() const
{
- return make_shared_ptr(new TreeLeaf<URISpecTree, URIDepSpec>(make_shared_ptr(new URIDepSpec(_v))));
+ return make_shared_ptr(new TreeLeaf<SimpleURISpecTree, SimpleURIDepSpec>(make_shared_ptr(new SimpleURIDepSpec(_v))));
}
std::string
-URIKey::pretty_print(const URISpecTree::Formatter & f) const
+SimpleURIKey::pretty_print(const SimpleURISpecTree::Formatter & f) const
{
return f.format(_v, format::Plain());
}
std::string
-URIKey::pretty_print_flat(const URISpecTree::Formatter & f) const
+SimpleURIKey::pretty_print_flat(const SimpleURISpecTree::Formatter & f) const
{
return f.format(_v, format::Plain());
}
-const tr1::shared_ptr<const URILabel>
-URIKey::initial_label() const
-{
- return make_shared_ptr(new URIMirrorsThenListedLabel("mirrors-then-listed"));
-}
-
StringKey::StringKey(const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
MetadataStringKey(r, h, t),
_v(v)
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index 9e02e57..d612df8 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -31,25 +31,22 @@ namespace paludis
{
class CRANPackageID;
- class URIKey :
- public MetadataSpecTreeKey<URISpecTree>
+ class SimpleURIKey :
+ public MetadataSpecTreeKey<SimpleURISpecTree>
{
private:
const std::string _v;
public:
- URIKey(const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ SimpleURIKey(const std::string &, const std::string &, const std::string &, const MetadataKeyType);
- virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ virtual const tr1::shared_ptr<const SimpleURISpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print(const SimpleURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual const tr1::shared_ptr<const URILabel> initial_label() const
+ virtual std::string pretty_print_flat(const SimpleURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/paludis/repositories/e/aa_visitor.cc b/paludis/repositories/e/aa_visitor.cc
index 60ab723..49d7240 100644
--- a/paludis/repositories/e/aa_visitor.cc
+++ b/paludis/repositories/e/aa_visitor.cc
@@ -51,23 +51,7 @@ AAVisitor::~AAVisitor()
}
void
-AAVisitor::visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator e)
-{
- std::for_each(cur, e, accept_visitor(*this));
-}
-
-void
-AAVisitor::visit_sequence(const UseDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator e)
-{
- std::for_each(cur, e, accept_visitor(*this));
-}
-
-void
-AAVisitor::visit_leaf(const URIDepSpec & p)
+AAVisitor::visit_leaf(const FetchableURIDepSpec & p)
{
_imp->aa.push_back(p.filename());
}
diff --git a/paludis/repositories/e/aa_visitor.hh b/paludis/repositories/e/aa_visitor.hh
index 5707efb..74c298b 100644
--- a/paludis/repositories/e/aa_visitor.hh
+++ b/paludis/repositories/e/aa_visitor.hh
@@ -20,7 +20,9 @@
#ifndef PALUDIS_GUARD_PALUDIS_AAVISITOR_HH
#define PALUDIS_GUARD_PALUDIS_AAVISITOR_HH 1
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
/** \file
* Declarations for the AAVisitor class.
@@ -39,7 +41,9 @@ namespace paludis
* \ingroup grpaavisitor
*/
class PALUDIS_VISIBLE AAVisitor :
- public ConstVisitor<URISpecTree>,
+ public ConstVisitor<FetchableURISpecTree>,
+ public ConstVisitor<FetchableURISpecTree>::VisitConstSequence<AAVisitor, AllDepSpec>,
+ public ConstVisitor<FetchableURISpecTree>::VisitConstSequence<AAVisitor, UseDepSpec>,
private PrivateImplementationPattern<AAVisitor>
{
public:
@@ -55,15 +59,7 @@ namespace paludis
/// \name Visit functions
///{
- void visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
-
- void visit_sequence(const UseDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
-
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const FetchableURIDepSpec &);
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
diff --git a/paludis/repositories/e/aa_visitor_TEST.cc b/paludis/repositories/e/aa_visitor_TEST.cc
index 76ec845..3589b09 100644
--- a/paludis/repositories/e/aa_visitor_TEST.cc
+++ b/paludis/repositories/e/aa_visitor_TEST.cc
@@ -39,7 +39,7 @@ namespace test_cases
void run()
{
AAVisitor p1;
- parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_fetchable_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_EQUAL(join(p1.begin(), p1.end(), " "), "b c d e");
}
} test_aa_visitor;
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index dd342d3..f85db47 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -108,8 +108,8 @@ CheckFetchedFilesVisitor::~CheckFetchedFilesVisitor()
void
CheckFetchedFilesVisitor::visit_sequence(const UseDepSpec & u,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
if ((_imp->check_unneeded) || (_imp->env->query_use(u.flag(), *_imp->id) ^ u.inverse()))
@@ -118,8 +118,8 @@ CheckFetchedFilesVisitor::visit_sequence(const UseDepSpec & u,
void
CheckFetchedFilesVisitor::visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
std::for_each(cur, end, accept_visitor(*this));
@@ -321,7 +321,7 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
}
void
-CheckFetchedFilesVisitor::visit_leaf(const URIDepSpec & u)
+CheckFetchedFilesVisitor::visit_leaf(const FetchableURIDepSpec & u)
{
Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
index 3b60a3f..885e9b2 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.hh
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -26,7 +26,8 @@
#include <paludis/util/visitor-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/tr1_memory.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/action-fwd.hh>
@@ -37,10 +38,11 @@ namespace paludis
{
class PALUDIS_VISIBLE CheckFetchedFilesVisitor :
private PrivateImplementationPattern<CheckFetchedFilesVisitor>,
- public ConstVisitor<URISpecTree>
+ public ConstVisitor<FetchableURISpecTree>
{
private:
bool check_distfile_manifest(const FSEntry & distfile);
+
public:
CheckFetchedFilesVisitor(
const Environment * const,
@@ -54,18 +56,19 @@ namespace paludis
~CheckFetchedFilesVisitor();
void visit_sequence(const UseDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
void visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const FetchableURIDepSpec &);
const tr1::shared_ptr<const Sequence<FetchActionFailure> > failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
bool need_nofetch() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 39d369f..24be8df 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -148,11 +148,29 @@ namespace
}
};
- struct ParseURIDepSpec
+ struct ParseLicenseDepSpec
+ {
+ template <typename H_>
+ void
+ add(const std::string & s, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> & p) const
+ {
+ p(tr1::shared_ptr<TreeLeaf<H_, LicenseDepSpec> >(new TreeLeaf<H_, LicenseDepSpec>(
+ tr1::shared_ptr<LicenseDepSpec>(new LicenseDepSpec(s)))));
+ }
+
+ template <typename H_>
+ void
+ add_arrow(const std::string & lhs, const std::string & rhs, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> &) const
+ {
+ throw DepStringParseError(lhs + " -> " + rhs, "Arrows not allowed in this context");
+ }
+ };
+
+ struct ParseFetchableURIDepSpec
{
const bool _supports_arrow;
- ParseURIDepSpec(bool a) :
+ ParseFetchableURIDepSpec(bool a) :
_supports_arrow(a)
{
}
@@ -161,8 +179,8 @@ namespace
void
add(const std::string & s, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> & p) const
{
- p(tr1::shared_ptr<TreeLeaf<H_, URIDepSpec> >(new TreeLeaf<H_, URIDepSpec>(
- tr1::shared_ptr<URIDepSpec>(new URIDepSpec(s)))));
+ p(tr1::shared_ptr<TreeLeaf<H_, FetchableURIDepSpec> >(new TreeLeaf<H_, FetchableURIDepSpec>(
+ tr1::shared_ptr<FetchableURIDepSpec>(new FetchableURIDepSpec(s)))));
}
template <typename H_>
@@ -170,13 +188,31 @@ namespace
add_arrow(const std::string & lhs, const std::string & rhs, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> & p) const
{
if (_supports_arrow)
- p(tr1::shared_ptr<TreeLeaf<H_, URIDepSpec> >(new TreeLeaf<H_, URIDepSpec>(
- tr1::shared_ptr<URIDepSpec>(new URIDepSpec(lhs + " -> " + rhs)))));
+ p(tr1::shared_ptr<TreeLeaf<H_, FetchableURIDepSpec> >(new TreeLeaf<H_, FetchableURIDepSpec>(
+ tr1::shared_ptr<FetchableURIDepSpec>(new FetchableURIDepSpec(lhs + " -> " + rhs)))));
else
throw DepStringParseError(lhs + " -> " + rhs, "Arrows not allowed in this EAPI");
}
};
+ struct ParseSimpleURIDepSpec
+ {
+ template <typename H_>
+ void
+ add(const std::string & s, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> & p) const
+ {
+ p(tr1::shared_ptr<TreeLeaf<H_, SimpleURIDepSpec> >(new TreeLeaf<H_, SimpleURIDepSpec>(
+ tr1::shared_ptr<SimpleURIDepSpec>(new SimpleURIDepSpec(s)))));
+ }
+
+ template <typename H_>
+ void
+ add_arrow(const std::string & lhs, const std::string & rhs, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> &) const
+ {
+ throw DepStringParseError(lhs + " -> " + rhs, "Arrows not allowed in this context");
+ }
+ };
+
template <typename H_, bool>
struct HandleUse
{
@@ -676,16 +712,28 @@ paludis::erepository::parse_restrict(const std::string & s, const EAPI & e)
ParseTextDepSpec(), e);
}
-tr1::shared_ptr<URISpecTree::ConstItem>
-paludis::erepository::parse_uri(const std::string & s, const EAPI & e)
+tr1::shared_ptr<FetchableURISpecTree::ConstItem>
+paludis::erepository::parse_fetchable_uri(const std::string & s, const EAPI & e)
+{
+ Context c("When parsing fetchable URI string '" + s + "' using EAPI '" + e.name + "':");
+
+ if (! e.supported)
+ throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' URIs");
+
+ return parse<FetchableURISpecTree, ParseFetchableURIDepSpec, false, true, LabelsAreURI>(s, false,
+ ParseFetchableURIDepSpec(e.supported->uri_supports_arrow), e);
+}
+
+tr1::shared_ptr<SimpleURISpecTree::ConstItem>
+paludis::erepository::parse_simple_uri(const std::string & s, const EAPI & e)
{
- Context c("When parsing URI string '" + s + "' using EAPI '" + e.name + "':");
+ Context c("When parsing simple URI string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' URIs");
- return parse<URISpecTree, ParseURIDepSpec, false, true, LabelsAreURI>(s, false,
- ParseURIDepSpec(e.supported->uri_supports_arrow), e);
+ return parse<SimpleURISpecTree, ParseSimpleURIDepSpec, false, true, void>(s, false,
+ ParseSimpleURIDepSpec(), e);
}
tr1::shared_ptr<LicenseSpecTree::ConstItem>
@@ -696,8 +744,8 @@ paludis::erepository::parse_license(const std::string & s, const EAPI & e)
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' licenses");
- return parse<LicenseSpecTree, ParseTextDepSpec, true, true, void>(s,
- true, ParseTextDepSpec(), e);
+ return parse<LicenseSpecTree, ParseLicenseDepSpec, true, true, void>(s,
+ true, ParseLicenseDepSpec(), e);
}
tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> >
diff --git a/paludis/repositories/e/dep_parser.hh b/paludis/repositories/e/dep_parser.hh
index 05d83be..e75b533 100644
--- a/paludis/repositories/e/dep_parser.hh
+++ b/paludis/repositories/e/dep_parser.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_E_DEP_PARSER_HH 1
#include <paludis/repositories/e/dep_parser-fwd.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/repositories/e/dep_lexer.hh>
#include <paludis/repositories/e/eapi-fwd.hh>
#include <paludis/util/exception.hh>
@@ -96,9 +96,15 @@ namespace paludis
const EAPI &) PALUDIS_VISIBLE;
/**
- * Parse a uri heirarchy.
+ * Parse a fetchable uri heirarchy.
*/
- tr1::shared_ptr<URISpecTree::ConstItem> parse_uri(const std::string & s,
+ tr1::shared_ptr<FetchableURISpecTree::ConstItem> parse_fetchable_uri(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
+
+ /**
+ * Parse a simple uri heirarchy.
+ */
+ tr1::shared_ptr<SimpleURISpecTree::ConstItem> parse_simple_uri(const std::string & s,
const EAPI &) PALUDIS_VISIBLE;
/**
diff --git a/paludis/repositories/e/dep_parser_TEST.cc b/paludis/repositories/e/dep_parser_TEST.cc
index e6baf2f..b8e7111 100644
--- a/paludis/repositories/e/dep_parser_TEST.cc
+++ b/paludis/repositories/e/dep_parser_TEST.cc
@@ -49,7 +49,7 @@ namespace test_cases
void run()
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
@@ -67,7 +67,7 @@ namespace test_cases
void run()
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend(" \n \t",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
@@ -85,7 +85,7 @@ namespace test_cases
void run()
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("app-editors/vim",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim");
@@ -104,17 +104,17 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d1(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d1(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend(">=app-editors/vim-6.4_alpha",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d1);
TEST_CHECK_EQUAL(stringify(d1), ">=app-editors/vim-6.4_alpha");
- DepSpecPrettyPrinter d2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("=app-editors/vim-6.4_alpha-r1",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d2);
TEST_CHECK_EQUAL(stringify(d2), "=app-editors/vim-6.4_alpha-r1");
- DepSpecPrettyPrinter d3(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d3(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend(">=app-editors/vim-6.4_alpha:one",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d3);
TEST_CHECK_EQUAL(stringify(d3), ">=app-editors/vim-6.4_alpha:one");
@@ -133,7 +133,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("app-editors/vim app-misc/hilite \nsys-apps/findutils",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim app-misc/hilite sys-apps/findutils");
@@ -148,7 +148,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("|| ( one/one two/two )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one two/two )");
@@ -163,7 +163,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("|| ( one/one foo? ( two/two ) )",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one foo? ( two/two ) )");
@@ -171,7 +171,7 @@ namespace test_cases
TEST_CHECK_THROWS(parse_depend("|| ( one/one foo? ( two/two ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- DepSpecPrettyPrinter e(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter e(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("|| ( one/one ( foo? ( two/two ) ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
TEST_CHECK_EQUAL(stringify(e), "|| ( one/one ( foo? ( two/two ) ) )");
@@ -190,7 +190,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend(" ( one/one two/two ) ",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "one/one two/two");
@@ -209,7 +209,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "foo? ( one/one )");
}
@@ -227,7 +227,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("!foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "!foo? ( one/one )");
}
@@ -241,15 +241,15 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, true, 0);
- parse_uri("a\n->\tb", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, true);
+ parse_fetchable_uri("a\n->\tb", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "a -> b\n");
- DepSpecPrettyPrinter e(0, tr1::shared_ptr<const PackageID>(), ff, 0, true, 0);
- parse_uri("a-> b", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
+ DepSpecPrettyPrinter e(0, tr1::shared_ptr<const PackageID>(), ff, 0, true);
+ parse_fetchable_uri("a-> b", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
TEST_CHECK_EQUAL(stringify(e), "a->\nb\n");
- TEST_CHECK_THROWS(parse_uri("a -> b",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a -> b",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d), DepStringError);
}
} test_dep_spec_parser_uri;
@@ -266,7 +266,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one ) )",
@@ -292,7 +292,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK_THROWS(parse_depend("||",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
TEST_CHECK_THROWS(parse_depend("|| ",
@@ -310,21 +310,21 @@ namespace test_cases
TEST_CHECK_THROWS(parse_license("a -> b",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("( -> )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("( -> )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("( -> )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("( -> )",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("foo? -> bar",
+ TEST_CHECK_THROWS(parse_fetchable_uri("foo? -> bar",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("a ->",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a ->",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("a -> ( )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a -> ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("a -> )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a -> )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("a -> || ( )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a -> || ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(parse_uri("a -> foo? ( )",
+ TEST_CHECK_THROWS(parse_fetchable_uri("a -> foo? ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
}
} test_dep_spec_parser_bad_values;
@@ -340,7 +340,7 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("build: one/one",
*EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "build: one/one");
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index 8fbf3c8..c82eb10 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -53,7 +53,6 @@ namespace paludis
unsigned indent;
bool extra_label_indent;
bool use_newlines;
- bool plain_text_is_license;
bool outer_block;
bool need_space;
@@ -62,15 +61,13 @@ namespace paludis
const tr1::shared_ptr<const PackageID> & i,
const GenericSpecTree::Formatter & f,
unsigned in,
- bool b,
- bool c) :
+ bool b) :
env(e),
id(i),
formatter(f),
indent(in),
extra_label_indent(false),
use_newlines(b),
- plain_text_is_license(c),
outer_block(true),
need_space(false)
{
@@ -83,9 +80,8 @@ DepSpecPrettyPrinter::DepSpecPrettyPrinter(
const tr1::shared_ptr<const PackageID> & id,
const GenericSpecTree::Formatter & f,
unsigned i,
- bool b,
- bool c) :
- PrivateImplementationPattern<DepSpecPrettyPrinter>(new Implementation<DepSpecPrettyPrinter>(e, id, f, i, b, c))
+ bool b) :
+ PrivateImplementationPattern<DepSpecPrettyPrinter>(new Implementation<DepSpecPrettyPrinter>(e, id, f, i, b))
{
}
@@ -252,7 +248,23 @@ DepSpecPrettyPrinter::visit_leaf(const PlainTextDepSpec & p)
else if (_imp->need_space)
_imp->s << " ";
- if (_imp->env && _imp->id && _imp->plain_text_is_license)
+ _imp->s << _imp->formatter.format(p, format::Plain());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+DepSpecPrettyPrinter::visit_leaf(const LicenseDepSpec & p)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.indent(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ if (_imp->env && _imp->id)
{
if (_imp->env->accept_license(p.text(), *_imp->id))
_imp->s << _imp->formatter.format(p, format::Accepted());
@@ -269,7 +281,23 @@ DepSpecPrettyPrinter::visit_leaf(const PlainTextDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const URIDepSpec & p)
+DepSpecPrettyPrinter::visit_leaf(const FetchableURIDepSpec & p)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.indent(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->formatter.format(p, format::Plain());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+DepSpecPrettyPrinter::visit_leaf(const SimpleURIDepSpec & p)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.hh b/paludis/repositories/e/dep_spec_pretty_printer.hh
index 9733646..212c967 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.hh
+++ b/paludis/repositories/e/dep_spec_pretty_printer.hh
@@ -22,6 +22,7 @@
#include <iosfwd>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -68,16 +69,13 @@ namespace paludis
* use_newlines is false.
*
* \param use_newlines Whether to format over multiple lines.
- *
- * \param plain_text_is_license Whether plain text is a license.
*/
DepSpecPrettyPrinter(
const Environment * const env,
const tr1::shared_ptr<const PackageID> & id,
const GenericSpecTree::Formatter & formatter,
unsigned initial_indent,
- bool use_newlines,
- const bool plain_text_is_license);
+ bool use_newlines);
~DepSpecPrettyPrinter();
@@ -104,7 +102,11 @@ namespace paludis
void visit_leaf(const BlockDepSpec &);
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const FetchableURIDepSpec &);
+
+ void visit_leaf(const SimpleURIDepSpec &);
+
+ void visit_leaf(const LicenseDepSpec &);
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
diff --git a/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
index ac8bdf9..37e6183 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
@@ -40,28 +40,28 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter p1(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ DepSpecPrettyPrinter p1(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, "foo/bar bar/baz");
- DepSpecPrettyPrinter p2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ DepSpecPrettyPrinter p2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, "foo/bar moo? ( bar/baz )");
- DepSpecPrettyPrinter p3(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ DepSpecPrettyPrinter p3(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, "|| ( a/b ( c/d e/f ) )");
- DepSpecPrettyPrinter p4(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ DepSpecPrettyPrinter p4(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, "a b");
- DepSpecPrettyPrinter p5(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p5);
+ DepSpecPrettyPrinter p5(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ parse_fetchable_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p5);
TEST_CHECK_STRINGIFY_EQUAL(p5, "a -> b c x? ( d e )");
- DepSpecPrettyPrinter p6(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
+ DepSpecPrettyPrinter p6(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ parse_fetchable_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
*EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p6);
TEST_CHECK_STRINGIFY_EQUAL(p6, "a manual: b x? ( c mirrors-first: d manual: e ) f");
}
@@ -75,25 +75,25 @@ namespace test_cases
{
StringifyFormatter ff;
- DepSpecPrettyPrinter p1(0, tr1::shared_ptr<const PackageID>(), ff, 1, true, 0);
+ DepSpecPrettyPrinter p1(0, tr1::shared_ptr<const PackageID>(), ff, 1, true);
parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, " foo/bar\n bar/baz\n");
- DepSpecPrettyPrinter p2(0, tr1::shared_ptr<const PackageID>(), ff, 1, true, 0);
+ DepSpecPrettyPrinter p2(0, tr1::shared_ptr<const PackageID>(), ff, 1, true);
parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, " foo/bar\n moo? (\n bar/baz\n )\n");
- DepSpecPrettyPrinter p3(0, tr1::shared_ptr<const PackageID>(), ff, 1, true, 0);
+ DepSpecPrettyPrinter p3(0, tr1::shared_ptr<const PackageID>(), ff, 1, true);
parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, " || (\n a/b\n (\n c/d\n"
" e/f\n )\n )\n");
- DepSpecPrettyPrinter p4(0, tr1::shared_ptr<const PackageID>(), ff, 1, true, 0);
+ DepSpecPrettyPrinter p4(0, tr1::shared_ptr<const PackageID>(), ff, 1, true);
parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, " a\n b\n");
- DepSpecPrettyPrinter p5(0, tr1::shared_ptr<const PackageID>(), ff, 1, true, 0);
- parse_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
+ DepSpecPrettyPrinter p5(0, tr1::shared_ptr<const PackageID>(), ff, 1, true);
+ parse_fetchable_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
*EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p5);
TEST_CHECK_STRINGIFY_EQUAL(p5, " a\n manual:\n b\n x? (\n c\n"
" mirrors-first:\n d\n manual:\n e\n )\n f\n");
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index e7bc542..540aac3 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -155,7 +155,7 @@ std::string
EDependenciesKey::pretty_print(const DependencySpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
value()->accept(p);
return stringify(p);
}
@@ -164,7 +164,7 @@ std::string
EDependenciesKey::pretty_print_flat(const DependencySpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
value()->accept(p);
return stringify(p);
}
@@ -253,7 +253,7 @@ std::string
ELicenseKey::pretty_print(const LicenseSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
value()->accept(p);
return stringify(p);
}
@@ -262,7 +262,7 @@ std::string
ELicenseKey::pretty_print_flat(const LicenseSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
value()->accept(p);
return stringify(p);
}
@@ -293,13 +293,13 @@ ELicenseKey::idle_load() const
namespace paludis
{
template <>
- struct Implementation<EURIKey>
+ struct Implementation<EFetchableURIKey>
{
const Environment * const env;
const tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable tr1::shared_ptr<const URISpecTree::ConstItem> value;
+ mutable tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value;
mutable tr1::shared_ptr<const URILabel> initial_label;
Implementation(const Environment * const e, const tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
@@ -311,21 +311,21 @@ namespace paludis
};
}
-EURIKey::EURIKey(const Environment * const e,
+EFetchableURIKey::EFetchableURIKey(const Environment * const e,
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<URISpecTree>(r, h, t),
- PrivateImplementationPattern<EURIKey>(new Implementation<EURIKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EURIKey>::_imp.get())
+ MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t),
+ PrivateImplementationPattern<EFetchableURIKey>(new Implementation<EFetchableURIKey>(e, id, v)),
+ _imp(PrivateImplementationPattern<EFetchableURIKey>::_imp.get())
{
}
-EURIKey::~EURIKey()
+EFetchableURIKey::~EFetchableURIKey()
{
}
-const tr1::shared_ptr<const URISpecTree::ConstItem>
-EURIKey::value() const
+const tr1::shared_ptr<const FetchableURISpecTree::ConstItem>
+EFetchableURIKey::value() const
{
Lock l(_imp->value_mutex);
@@ -333,30 +333,30 @@ EURIKey::value() const
return _imp->value;
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = parse_uri(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_fetchable_uri(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
std::string
-EURIKey::pretty_print(const URISpecTree::Formatter & f) const
+EFetchableURIKey::pretty_print(const FetchableURISpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
value()->accept(p);
return stringify(p);
}
std::string
-EURIKey::pretty_print_flat(const URISpecTree::Formatter & f) const
+EFetchableURIKey::pretty_print_flat(const FetchableURISpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
value()->accept(p);
return stringify(p);
}
const tr1::shared_ptr<const URILabel>
-EURIKey::initial_label() const
+EFetchableURIKey::initial_label() const
{
Lock l(_imp->value_mutex);
@@ -389,6 +389,70 @@ EURIKey::initial_label() const
namespace paludis
{
template <>
+ struct Implementation<ESimpleURIKey>
+ {
+ const Environment * const env;
+ const tr1::shared_ptr<const ERepositoryID> id;
+ const std::string string_value;
+ mutable Mutex value_mutex;
+ mutable tr1::shared_ptr<const SimpleURISpecTree::ConstItem> value;
+
+ Implementation(const Environment * const e, const tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ env(e),
+ id(i),
+ string_value(v)
+ {
+ }
+ };
+}
+
+ESimpleURIKey::ESimpleURIKey(const Environment * const e,
+ const tr1::shared_ptr<const ERepositoryID> & id,
+ const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
+ MetadataSpecTreeKey<SimpleURISpecTree>(r, h, t),
+ PrivateImplementationPattern<ESimpleURIKey>(new Implementation<ESimpleURIKey>(e, id, v)),
+ _imp(PrivateImplementationPattern<ESimpleURIKey>::_imp.get())
+{
+}
+
+ESimpleURIKey::~ESimpleURIKey()
+{
+}
+
+const tr1::shared_ptr<const SimpleURISpecTree::ConstItem>
+ESimpleURIKey::value() const
+{
+ Lock l(_imp->value_mutex);
+
+ if (_imp->value)
+ return _imp->value;
+
+ Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
+ _imp->value = parse_simple_uri(_imp->string_value, *_imp->id->eapi());
+ return _imp->value;
+}
+
+std::string
+ESimpleURIKey::pretty_print(const SimpleURISpecTree::Formatter & f) const
+{
+ StringifyFormatter ff(f);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
+ value()->accept(p);
+ return stringify(p);
+}
+
+std::string
+ESimpleURIKey::pretty_print_flat(const SimpleURISpecTree::Formatter & f) const
+{
+ StringifyFormatter ff(f);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
+ value()->accept(p);
+ return stringify(p);
+}
+
+namespace paludis
+{
+ template <>
struct Implementation<ERestrictKey>
{
const Environment * const env;
@@ -436,7 +500,7 @@ std::string
ERestrictKey::pretty_print(const RestrictSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
value()->accept(p);
return stringify(p);
}
@@ -445,7 +509,7 @@ std::string
ERestrictKey::pretty_print_flat(const RestrictSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
value()->accept(p);
return stringify(p);
}
@@ -499,7 +563,7 @@ std::string
EProvideKey::pretty_print(const ProvideSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true);
value()->accept(p);
return stringify(p);
}
@@ -508,7 +572,7 @@ std::string
EProvideKey::pretty_print_flat(const ProvideSpecTree::Formatter & f) const
{
StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, false);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false);
value()->accept(p);
return stringify(p);
}
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index bc14378..2854be3 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -89,32 +89,55 @@ namespace paludis
IdleActionResult idle_load() const;
};
- class EURIKey :
- public MetadataSpecTreeKey<URISpecTree>,
- private PrivateImplementationPattern<EURIKey>
+ class EFetchableURIKey :
+ public MetadataSpecTreeKey<FetchableURISpecTree>,
+ private PrivateImplementationPattern<EFetchableURIKey>
{
private:
- Implementation<EURIKey> * const _imp;
+ Implementation<EFetchableURIKey> * const _imp;
public:
- EURIKey(const Environment * const,
+ EFetchableURIKey(const Environment * const,
const tr1::shared_ptr<const ERepositoryID> &,
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
- ~EURIKey();
+ ~EFetchableURIKey();
- virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ virtual const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print_flat(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const tr1::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class ESimpleURIKey :
+ public MetadataSpecTreeKey<SimpleURISpecTree>,
+ private PrivateImplementationPattern<ESimpleURIKey>
+ {
+ private:
+ Implementation<ESimpleURIKey> * const _imp;
+
+ public:
+ ESimpleURIKey(const Environment * const,
+ const tr1::shared_ptr<const ERepositoryID> &,
+ const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ ~ESimpleURIKey();
+
+ virtual const tr1::shared_ptr<const SimpleURISpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print(const SimpleURISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print_flat(const SimpleURISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class ERestrictKey :
public MetadataSpecTreeKey<RestrictSpecTree>,
private PrivateImplementationPattern<ERestrictKey>
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index eba55a9..6c5fad9 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -524,11 +524,11 @@ namespace test_cases
TEST_CHECK(id1->short_description_key());
TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Description");
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pd(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pd(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK(id1->build_dependencies_key());
id1->build_dependencies_key()->value()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "foo/bar");
- erepository::DepSpecPrettyPrinter pr(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pr(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK(id1->run_dependencies_key());
id1->run_dependencies_key()->value()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "foo/bar");
@@ -539,11 +539,11 @@ namespace test_cases
TEST_CHECK(id2->end_metadata() != id2->find_metadata("EAPI"));
TEST_CHECK(id2->short_description_key());
TEST_CHECK_EQUAL(id2->short_description_key()->value(), "dquote \" squote ' backslash \\ dollar $");
- erepository::DepSpecPrettyPrinter pd2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pd2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK(id2->build_dependencies_key());
id2->build_dependencies_key()->value()->accept(pd2);
TEST_CHECK_STRINGIFY_EQUAL(pd2, "foo/bar bar/baz");
- erepository::DepSpecPrettyPrinter pr2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pr2(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
TEST_CHECK(id2->run_dependencies_key());
id2->run_dependencies_key()->value()->accept(pr2);
TEST_CHECK_STRINGIFY_EQUAL(pr2, "foo/bar");
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index 1a50915..f539eeb 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.hh
@@ -32,6 +32,7 @@ namespace paludis
{
public:
virtual const tr1::shared_ptr<const EAPI> eapi() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const = 0;
virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/paludis/repositories/e/e_repository_profile.hh b/paludis/repositories/e/e_repository_profile.hh
index bacaa41..82fe6b8 100644
--- a/paludis/repositories/e/e_repository_profile.hh
+++ b/paludis/repositories/e/e_repository_profile.hh
@@ -20,7 +20,8 @@
#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_REPOSITORY_PROFILE_HH
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_REPOSITORY_PROFILE_HH 1
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/version_spec-fwd.hh>
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index 66b36b4..e11fc4e 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -98,7 +98,7 @@ namespace test_cases
tr1::shared_ptr<SetSpecTree::ConstItem> set1(repo->sets_interface->package_set(SetName("set1")));
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
set1->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "cat-one/foo >=cat-two/bar-2");
}
@@ -133,7 +133,7 @@ namespace test_cases
tr1::shared_ptr<SetSpecTree::ConstItem> insecurity(repo->sets_interface->package_set(SetName("insecurity")));
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
insecurity->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-one/foo-1::test-repo-1 =cat-two/bar-1.5::test-repo-1 "
"=cat-two/bar-1.5.1::test-repo-1 =cat-three/baz-1.0::test-repo-1 "
@@ -175,7 +175,7 @@ namespace test_cases
tr1::shared_ptr<const SetSpecTree::ConstItem> security(repo->sets_interface->package_set(SetName("security")));
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::DepSpecPrettyPrinter pretty(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
security->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-two/bar-2.0::test-repo-1 =cat-three/baz-1.3::test-repo-1");
}
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 77f9e8f..f6010fa 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -26,6 +26,7 @@
#include <paludis/util/sr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/tr1_memory.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec-fwd.hh>
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 840e73a..9896ef2 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -27,6 +27,7 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/fetch_visitor.hh>
#include <paludis/repositories/e/check_fetched_files_visitor.hh>
+#include <paludis/repositories/e/aa_visitor.hh>
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -115,44 +116,12 @@ EbuildEntries::make_id(const QualifiedPackageName & q, const VersionSpec & v, co
namespace
{
- class AAFinder :
- private InstantiationPolicy<AAFinder, instantiation_method::NonCopyableTag>,
- public ConstVisitor<URISpecTree>,
- public ConstVisitor<URISpecTree>::VisitConstSequence<AAFinder, AllDepSpec>,
- public ConstVisitor<URISpecTree>::VisitConstSequence<AAFinder, UseDepSpec>
- {
- private:
- std::list<const URIDepSpec *> _specs;
-
- public:
- void visit_leaf(const URIDepSpec & a)
- {
- _specs.push_back(&a);
- }
-
- void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
- {
- }
-
- typedef std::list<const URIDepSpec *>::const_iterator ConstIterator;
-
- ConstIterator begin()
- {
- return _specs.begin();
- }
-
- ConstIterator end() const
- {
- return _specs.end();
- }
- };
-
class AFinder :
private InstantiationPolicy<AFinder, instantiation_method::NonCopyableTag>,
- public ConstVisitor<URISpecTree>
+ public ConstVisitor<FetchableURISpecTree>
{
private:
- std::list<std::pair<const URIDepSpec *, const LabelsDepSpec<URILabelVisitorTypes> *> > _specs;
+ std::list<std::pair<const FetchableURIDepSpec *, const LabelsDepSpec<URILabelVisitorTypes> *> > _specs;
std::list<const LabelsDepSpec<URILabelVisitorTypes> *> _labels;
const Environment * const env;
@@ -166,7 +135,7 @@ namespace
_labels.push_back(0);
}
- void visit_leaf(const URIDepSpec & a)
+ void visit_leaf(const FetchableURIDepSpec & a)
{
_specs.push_back(std::make_pair(&a, *_labels.begin()));
}
@@ -177,8 +146,8 @@ namespace
}
void visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator e)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator e)
{
_labels.push_front(*_labels.begin());
std::for_each(cur, e, accept_visitor(*this));
@@ -186,8 +155,8 @@ namespace
}
void visit_sequence(const UseDepSpec & u,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator e)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator e)
{
if (env->query_use(u.flag(), *id) ^ u.inverse())
{
@@ -197,7 +166,8 @@ namespace
}
}
- typedef std::list<std::pair<const URIDepSpec *, const LabelsDepSpec<URILabelVisitorTypes> *> >::const_iterator ConstIterator;
+ typedef std::list<std::pair<const FetchableURIDepSpec *,
+ const LabelsDepSpec<URILabelVisitorTypes> *> >::const_iterator ConstIterator;
ConstIterator begin()
{
@@ -361,7 +331,7 @@ EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
- const URIDepSpec * const spec(static_cast<const URIDepSpec *>(i->first));
+ const FetchableURIDepSpec * const spec(static_cast<const FetchableURIDepSpec *>(i->first));
if (already_in_archives.end() == already_in_archives.find(spec->filename()))
{
@@ -374,17 +344,17 @@ EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
/* make AA */
if (! id->eapi()->supported->ebuild_environment_variables->env_aa.empty())
{
- AAFinder g;
+ AAVisitor g;
if (id->src_uri_key())
id->src_uri_key()->value()->accept(g);
std::set<std::string> already_in_all_archives;
- for (AAFinder::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
+ for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
{
- if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->filename()))
+ if (already_in_all_archives.end() == already_in_all_archives.find(*gg))
{
- all_archives.append((*gg)->filename());
- already_in_all_archives.insert((*gg)->filename());
+ all_archives.append(*gg);
+ already_in_all_archives.insert(*gg);
}
all_archives.append(" ");
}
@@ -495,7 +465,7 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
- const URIDepSpec * const spec(static_cast<const URIDepSpec *>(i->first));
+ const FetchableURIDepSpec * const spec(static_cast<const FetchableURIDepSpec *>(i->first));
if (already_in_archives.end() == already_in_archives.find(spec->filename()))
{
@@ -508,17 +478,17 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
/* make AA */
if (! id->eapi()->supported->ebuild_environment_variables->env_aa.empty())
{
- AAFinder g;
+ AAVisitor g;
if (id->src_uri_key())
id->src_uri_key()->value()->accept(g);
std::set<std::string> already_in_all_archives;
- for (AAFinder::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
+ for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
{
- if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->filename()))
+ if (already_in_all_archives.end() == already_in_all_archives.find(*gg))
{
- all_archives.append((*gg)->filename());
- already_in_all_archives.insert((*gg)->filename());
+ all_archives.append(*gg);
+ already_in_all_archives.insert(*gg);
}
all_archives.append(" ");
}
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index a5f1cb1..f0c3214 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -159,7 +159,7 @@ namespace
std::string flatten(const T_ & d)
{
StringifyFormatter ff;
- DepSpecPrettyPrinter p(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
+ DepSpecPrettyPrinter p(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
d->accept(p);
return stringify(p);
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index e1a08e9..b4efbb5 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -92,8 +92,8 @@ namespace paludis
mutable tr1::shared_ptr<const EDependenciesKey> post_dependencies;
mutable tr1::shared_ptr<const EProvideKey> provide;
mutable tr1::shared_ptr<const ERestrictKey> restrictions;
- mutable tr1::shared_ptr<const EURIKey> src_uri;
- mutable tr1::shared_ptr<const EURIKey> homepage;
+ mutable tr1::shared_ptr<const EFetchableURIKey> src_uri;
+ mutable tr1::shared_ptr<const ESimpleURIKey> homepage;
mutable tr1::shared_ptr<const ELicenseKey> license;
mutable tr1::shared_ptr<const EKeywordsKey> keywords;
mutable tr1::shared_ptr<const EIUseKey> iuse;
@@ -332,7 +332,7 @@ namespace
std::for_each(begin, end, accept_visitor(*this));
}
- void visit_leaf(const PlainTextDepSpec & spec)
+ void visit_leaf(const LicenseDepSpec & spec)
{
if (! (env->*func)(spec.text(), *id))
ok = false;
@@ -549,26 +549,20 @@ EbuildID::restrict_key() const
return _imp->restrictions;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
EbuildID::src_uri_key() const
{
need_keys_added();
return _imp->src_uri;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
EbuildID::homepage_key() const
{
need_keys_added();
return _imp->homepage;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-EbuildID::bin_uri_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
-}
-
const tr1::shared_ptr<const MetadataStringKey>
EbuildID::short_description_key() const
{
@@ -696,7 +690,7 @@ void
EbuildID::load_src_uri(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->src_uri.reset(new EURIKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
+ _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
add_metadata_key(_imp->src_uri);
}
@@ -704,7 +698,7 @@ void
EbuildID::load_homepage(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->homepage.reset(new EURIKey(_imp->environment, shared_from_this(), r, h, v, mkt_significant));
+ _imp->homepage.reset(new ESimpleURIKey(_imp->environment, shared_from_this(), r, h, v, mkt_significant));
add_metadata_key(_imp->homepage);
}
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 685c454..f3a4b7a 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -73,10 +73,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
@@ -88,6 +86,7 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
const tr1::shared_ptr<const MetadataSetKey<Set<std::string> > > inherited_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index d0580e1..bb437b2 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -104,8 +104,8 @@ FetchVisitor::~FetchVisitor()
void
FetchVisitor::visit_sequence(const UseDepSpec & u,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
if ((_imp->fetch_unneeded) || (_imp->env->query_use(u.flag(), *_imp->id) ^ u.inverse()))
{
@@ -117,8 +117,8 @@ FetchVisitor::visit_sequence(const UseDepSpec & u,
void
FetchVisitor::visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator cur,
- URISpecTree::ConstSequenceIterator end)
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
{
_imp->labels.push_front(* _imp->labels.begin());
std::for_each(cur, end, accept_visitor(*this));
@@ -144,7 +144,7 @@ namespace
}
void
-FetchVisitor::visit_leaf(const URIDepSpec & u)
+FetchVisitor::visit_leaf(const FetchableURIDepSpec & u)
{
Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
diff --git a/paludis/repositories/e/fetch_visitor.hh b/paludis/repositories/e/fetch_visitor.hh
index 0115b5c..02636b7 100644
--- a/paludis/repositories/e/fetch_visitor.hh
+++ b/paludis/repositories/e/fetch_visitor.hh
@@ -27,6 +27,7 @@
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/tr1_memory.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
@@ -36,7 +37,7 @@ namespace paludis
{
class PALUDIS_VISIBLE FetchVisitor :
private PrivateImplementationPattern<FetchVisitor>,
- public ConstVisitor<URISpecTree>
+ public ConstVisitor<FetchableURISpecTree>
{
public:
FetchVisitor(
@@ -53,16 +54,16 @@ namespace paludis
~FetchVisitor();
void visit_sequence(const AllDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
void visit_sequence(const UseDepSpec &,
- URISpecTree::ConstSequenceIterator,
- URISpecTree::ConstSequenceIterator);
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const FetchableURIDepSpec &);
};
}
}
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index 19d91ee..d99b4f8 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -57,7 +57,7 @@ namespace test_cases
qo_require_exactly_one)->begin(),
*eapi, FSEntry("fetch_visitor_TEST_dir/out"),
false, false, "test", make_shared_ptr(new URIListedThenMirrorsLabel("listed-then-mirrors")), false);
- parse_uri("file:///" + stringify(FSEntry("fetch_visitor_TEST_dir/in/input1").realpath()), *eapi)->accept(v);
+ parse_fetchable_uri("file:///" + stringify(FSEntry("fetch_visitor_TEST_dir/in/input1").realpath()), *eapi)->accept(v);
TEST_CHECK(FSEntry("fetch_visitor_TEST_dir/out/input1").is_regular_file());
std::ifstream f(stringify(FSEntry("fetch_visitor_TEST_dir/out/input1")).c_str());
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index 6b173aa..a2a30eb 100644
--- a/paludis/repositories/e/qa/extractors.cc
+++ b/paludis/repositories/e/qa/extractors.cc
@@ -72,7 +72,7 @@ namespace
std::set<UseFlagName> current;
std::set<QualifiedPackageName> needed_packages;
- void visit_leaf(const URIDepSpec & u)
+ void visit_leaf(const FetchableURIDepSpec & u)
{
std::string::size_type p(u.filename().rfind('.'));
if (std::string::npos == p)
@@ -117,6 +117,14 @@ namespace
std::for_each(cur, end, accept_visitor(*this));
}
+ void visit_leaf(const LicenseDepSpec &)
+ {
+ }
+
+ void visit_leaf(const SimpleURIDepSpec &)
+ {
+ }
+
using ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AllDepSpec>::visit_sequence;
using ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AnyDepSpec>::visit_sequence;
};
@@ -162,7 +170,7 @@ namespace
requirements.insert(new_requirements.begin(), new_requirements.end());
}
- void visit_leaf(const URIDepSpec & u)
+ void visit_leaf(const FetchableURIDepSpec & u)
{
std::string::size_type p(u.filename().rfind('.'));
if (std::string::npos == p)
@@ -175,6 +183,10 @@ namespace
add_requirements();
}
+ void visit_leaf(const SimpleURIDepSpec &)
+ {
+ }
+
void visit_leaf(const PackageDepSpec & p)
{
if ((! p.package_ptr()) || (name != *p.package_ptr()))
@@ -199,6 +211,10 @@ namespace
{
}
+ void visit_leaf(const LicenseDepSpec &)
+ {
+ }
+
using ConstVisitor<GenericSpecTree>::VisitConstSequence<Requirements, AllDepSpec>::visit_sequence;
void visit_sequence(const UseDepSpec & u,
diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc
index 4cb2210..046cfb1 100644
--- a/paludis/repositories/e/qa/homepage_key.cc
+++ b/paludis/repositories/e/qa/homepage_key.cc
@@ -34,12 +34,12 @@ using namespace paludis::erepository;
namespace
{
struct HomepageChecker :
- ConstVisitor<URISpecTree>,
- ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>,
- ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, UseDepSpec>
+ ConstVisitor<SimpleURISpecTree>,
+ ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>,
+ ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, UseDepSpec>
{
- using ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, UseDepSpec>::visit_sequence;
- using ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>::visit_sequence;
+ using ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, UseDepSpec>::visit_sequence;
+ using ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>::visit_sequence;
const tr1::shared_ptr<const MetadataKey> & key;
const FSEntry entry;
@@ -69,29 +69,18 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name, "Homepage specifies no URIs"));
}
- void visit_leaf(const URIDepSpec & u)
+ void visit_leaf(const SimpleURIDepSpec & u)
{
found_one = true;
- if (! u.renamed_url_suffix().empty())
- reporter.message(
- QAMessage(entry, qaml_normal, name, "Homepage uses -> in part '" + u.text() + "'"));
-
- if (0 == u.original_url().compare(0, 7, "http://") &&
- 0 == u.original_url().compare(0, 8, "https://") &&
- 0 == u.original_url().compare(0, 6, "ftp://"))
+ if (0 == u.text().compare(0, 7, "http://") &&
+ 0 == u.text().compare(0, 8, "https://") &&
+ 0 == u.text().compare(0, 6, "ftp://"))
reporter.message(QAMessage(entry, qaml_normal, name,
"Homepage uses no or unknown protocol in part '" + u.text() + "'")
.with_associated_id(id)
.with_associated_key(key));
}
-
- void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
- {
- reporter.message(QAMessage(entry, qaml_normal, name, "Homepage uses labels")
- .with_associated_id(id)
- .with_associated_key(key));
- }
};
}
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 6f4df10..449db15 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -134,7 +134,11 @@ namespace
.with_associated_key(key));
}
- void visit_leaf(const URIDepSpec &)
+ void visit_leaf(const SimpleURIDepSpec &)
+ {
+ }
+
+ void visit_leaf(const FetchableURIDepSpec &)
{
}
@@ -150,6 +154,10 @@ namespace
{
}
+ void visit_leaf(const LicenseDepSpec &)
+ {
+ }
+
void visit_sequence(const UseDepSpec & u,
GenericSpecTree::ConstSequenceIterator cur,
GenericSpecTree::ConstSequenceIterator end)
@@ -294,7 +302,24 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ try
+ {
+ Context context("When visiting metadata key '" + k.raw_name() + "':");
+ Checker c(entry, reporter, id, key, name, tr1::shared_ptr<const QualifiedPackageNameSet>());
+ k.value()->accept(c);
+ }
+ catch (const Exception & e)
+ {
+ reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' ("
+ + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'")
+ .with_associated_id(id)
+ .with_associated_key(key));
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
try
{
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index dccf9c7..ebe7e1d 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -239,8 +239,7 @@ namespace
if (reporter)
{
StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter printer(0, tr1::shared_ptr<const PackageID>(),
- ff, 0, false, 0);
+ erepository::DepSpecPrettyPrinter printer(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
std::for_each(begin, end, accept_visitor(printer));
reporter->message(QAMessage(entry, qaml_normal, name, "No item in block '|| ( "
+ stringify(printer) + " )' visible for profile '"
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index b6aee99..5b7b694 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -82,8 +82,8 @@ namespace paludis
tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies;
tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies;
tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrictions;
- tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri;
- tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage;
+ tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
+ tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage;
tr1::shared_ptr<const MetadataStringKey> short_description;
tr1::shared_ptr<const MetadataContentsKey> contents;
tr1::shared_ptr<const MetadataTimeKey> installed_time;
@@ -237,7 +237,7 @@ VDBID::need_keys_added() const
if (! vars->metadata_src_uri.empty())
if ((_imp->dir / vars->metadata_src_uri).exists())
{
- _imp->src_uri.reset(new EURIKey(_imp->environment, shared_from_this(), vars->metadata_src_uri, vars->description_src_uri,
+ _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), vars->metadata_src_uri, vars->description_src_uri,
file_contents(_imp->dir / vars->metadata_src_uri), mkt_dependencies));
add_metadata_key(_imp->src_uri);
}
@@ -253,7 +253,7 @@ VDBID::need_keys_added() const
if (! vars->metadata_homepage.empty())
if ((_imp->dir / vars->metadata_homepage).exists())
{
- _imp->homepage.reset(new EURIKey(_imp->environment, shared_from_this(), vars->metadata_homepage, vars->description_homepage,
+ _imp->homepage.reset(new ESimpleURIKey(_imp->environment, shared_from_this(), vars->metadata_homepage, vars->description_homepage,
file_contents(_imp->dir / vars->metadata_homepage), mkt_significant));
add_metadata_key(_imp->homepage);
}
@@ -516,26 +516,20 @@ VDBID::restrict_key() const
return _imp->restrictions;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
VDBID::src_uri_key() const
{
need_keys_added();
return _imp->src_uri;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
VDBID::homepage_key() const
{
need_keys_added();
return _imp->homepage;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-VDBID::bin_uri_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
-}
-
const tr1::shared_ptr<const MetadataStringKey>
VDBID::short_description_key() const
{
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index dca106c..0d5d959 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -68,9 +68,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 99559e1..7b2ccb3 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -1012,7 +1012,7 @@ VDBRepository::regenerate_provides_cache() const
tr1::shared_ptr<const ProvideSpecTree::ConstItem> provide((*e)->provide_key()->value());
StringifyFormatter ff;
- DepSpecPrettyPrinter p(0, tr1::shared_ptr<const PackageID>(), ff, 0, false, 0);
+ DepSpecPrettyPrinter p(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
provide->accept(p);
std::string provide_str(strip_leading(strip_trailing(stringify(p), " \t\r\n"), " \t\r\n"));
if (provide_str.empty())
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 0542417..2721a85 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -137,14 +137,14 @@ namespace paludis
};
template <>
- struct Implementation<FakeMetadataSpecTreeKey<URISpecTree> >
+ struct Implementation<FakeMetadataSpecTreeKey<FetchableURISpecTree> >
{
- tr1::shared_ptr<const URISpecTree::ConstItem> value;
+ tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value;
std::string string_value;
- const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> func;
+ const tr1::function<const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> (const std::string &)> func;
tr1::shared_ptr<const URILabel> initial_label;
- Implementation(const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> & f) :
+ Implementation(const tr1::function<const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> (const std::string &)> & f) :
func(f),
initial_label(new URIListedThenMirrorsLabel("listed-then-mirrors"))
{
@@ -196,46 +196,47 @@ FakeMetadataSpecTreeKey<C_>::pretty_print_flat(const typename C_::Formatter &) c
return _imp->string_value;
}
-FakeMetadataSpecTreeKey<URISpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
- const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> & f, const MetadataKeyType t) :
- MetadataSpecTreeKey<URISpecTree>(r, h, t),
- PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >(new Implementation<FakeMetadataSpecTreeKey<URISpecTree> >(f)),
- _imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >::_imp.get())
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
+ const tr1::function<const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> (const std::string &)> & f, const MetadataKeyType t) :
+ MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t),
+ PrivateImplementationPattern<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(
+ new Implementation<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(f)),
+ _imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<FetchableURISpecTree> >::_imp.get())
{
set_from_string(v);
}
-FakeMetadataSpecTreeKey<URISpecTree>::~FakeMetadataSpecTreeKey()
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::~FakeMetadataSpecTreeKey()
{
}
void
-FakeMetadataSpecTreeKey<URISpecTree>::set_from_string(const std::string & s)
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::set_from_string(const std::string & s)
{
_imp->string_value = s;
_imp->value = _imp->func(s);
}
-const tr1::shared_ptr<const URISpecTree::ConstItem>
-FakeMetadataSpecTreeKey<URISpecTree>::value() const
+const tr1::shared_ptr<const FetchableURISpecTree::ConstItem>
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::value() const
{
return _imp->value;
}
std::string
-FakeMetadataSpecTreeKey<URISpecTree>::pretty_print(const URISpecTree::Formatter &) const
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print(const FetchableURISpecTree::Formatter &) const
{
return _imp->string_value;
}
std::string
-FakeMetadataSpecTreeKey<URISpecTree>::pretty_print_flat(const URISpecTree::Formatter &) const
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print_flat(const FetchableURISpecTree::Formatter &) const
{
return _imp->string_value;
}
const tr1::shared_ptr<const URILabel>
-FakeMetadataSpecTreeKey<URISpecTree>::initial_label() const
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::initial_label() const
{
return _imp->initial_label;
}
@@ -339,9 +340,8 @@ namespace paludis
tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > post_dependencies;
tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies;
tr1::shared_ptr<FakeMetadataSpecTreeKey<RestrictSpecTree> > restrictions;
- tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > src_uri;
- tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > bin_uri;
- tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > homepage;
+ tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
+ tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage;
mutable bool has_masks;
@@ -372,8 +372,8 @@ namespace paludis
suggested_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("SDEPEND", "Suggested dependencies",
"", tr1::bind(&erepository::parse_depend, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
- src_uri(new FakeMetadataSpecTreeKey<URISpecTree>("SRC_URI", "Source URIs",
- "", tr1::bind(&erepository::parse_uri, _1,
+ src_uri(new FakeMetadataSpecTreeKey<FetchableURISpecTree>("SRC_URI", "Source URIs",
+ "", tr1::bind(&erepository::parse_fetchable_uri, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
has_masks(false)
{
@@ -499,12 +499,6 @@ FakePackageID::suggested_dependencies_key() const
return _imp->suggested_dependencies;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >
-FakePackageID::restrict_key() const
-{
- return _imp->restrictions;
-}
-
const tr1::shared_ptr<FakeMetadataKeywordSetKey>
FakePackageID::keywords_key()
{
@@ -547,30 +541,24 @@ FakePackageID::suggested_dependencies_key()
return _imp->suggested_dependencies;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
FakePackageID::src_uri_key() const
{
return _imp->src_uri;
}
-const tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> >
FakePackageID::src_uri_key()
{
return _imp->src_uri;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
FakePackageID::homepage_key() const
{
return _imp->homepage;
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-FakePackageID::bin_uri_key() const
-{
- return _imp->bin_uri;
-}
-
const tr1::shared_ptr<const MetadataStringKey>
FakePackageID::short_description_key() const
{
@@ -688,7 +676,7 @@ namespace
std::for_each(begin, end, accept_visitor(*this));
}
- void visit_leaf(const PlainTextDepSpec & spec)
+ void visit_leaf(const LicenseDepSpec & spec)
{
if (! (env->*func)(spec.text(), *id))
ok = false;
@@ -944,7 +932,8 @@ template class FakeMetadataSpecTreeKey<LicenseSpecTree>;
template class FakeMetadataSpecTreeKey<ProvideSpecTree>;
template class FakeMetadataSpecTreeKey<DependencySpecTree>;
template class FakeMetadataSpecTreeKey<RestrictSpecTree>;
-template class FakeMetadataSpecTreeKey<URISpecTree>;
+template class FakeMetadataSpecTreeKey<FetchableURISpecTree>;
+template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
template class FakeMetadataSetKey<KeywordNameSet>;
template class FakeMetadataSetKey<IUseFlagSet>;
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 152d12f..2b407d8 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -106,27 +106,28 @@ namespace paludis
};
template <>
- class PALUDIS_VISIBLE FakeMetadataSpecTreeKey<URISpecTree> :
- public MetadataSpecTreeKey<URISpecTree>,
- private PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >
+ class PALUDIS_VISIBLE FakeMetadataSpecTreeKey<FetchableURISpecTree> :
+ public MetadataSpecTreeKey<FetchableURISpecTree>,
+ private PrivateImplementationPattern<FakeMetadataSpecTreeKey<FetchableURISpecTree> >
{
private:
- Implementation<FakeMetadataSpecTreeKey<URISpecTree> > * const _imp;
+ Implementation<FakeMetadataSpecTreeKey<FetchableURISpecTree> > * const _imp;
public:
FakeMetadataSpecTreeKey(const std::string &, const std::string &, const std::string &,
- const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> &, const MetadataKeyType);
+ const tr1::function<const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> (const std::string &)> &,
+ const MetadataKeyType);
~FakeMetadataSpecTreeKey();
- virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ virtual const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
void set_from_string(const std::string &);
- virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print_flat(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const tr1::shared_ptr<const URILabel> initial_label() const
@@ -195,10 +196,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
@@ -217,7 +216,7 @@ namespace paludis
const tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key();
const tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key();
const tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key();
- const tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > src_uri_key();
+ const tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key();
void set_slot(const SlotName &);
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 397d6d2..6267ae0 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -439,28 +439,16 @@ GemSpecification::post_dependencies_key() const
return tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >
-GemSpecification::restrict_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
GemSpecification::src_uri_key() const
{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
+ return tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
GemSpecification::homepage_key() const
{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-GemSpecification::bin_uri_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
+ return tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >();
}
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index 71b03a6..b443dae 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -99,10 +99,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataSetKey<PackageIDSequence> > contains_key() const;
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 650f982..be30b9c 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -84,7 +84,11 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 9578361..afc74e7 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -319,28 +319,16 @@ VirtualsPackageID::long_description_key() const
return tr1::shared_ptr<const MetadataStringKey>();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >
-VirtualsPackageID::restrict_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
VirtualsPackageID::src_uri_key() const
{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
+ return tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >();
}
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
+const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
VirtualsPackageID::homepage_key() const
{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
-}
-
-const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >
-VirtualsPackageID::bin_uri_key() const
-{
- return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
+ return tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >();
}
const tr1::shared_ptr<const MetadataContentsKey>
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index beca99f..fa39b0d 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -102,10 +102,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies_key() const;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > bin_uri_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
- virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > src_uri_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 4765016..020200a 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -23,7 +23,8 @@
#include <paludis/action-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/repository_info-fwd.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/name.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/qa-fwd.hh>
diff --git a/paludis/set_file.hh b/paludis/set_file.hh
index c938458..186b197 100644
--- a/paludis/set_file.hh
+++ b/paludis/set_file.hh
@@ -25,7 +25,9 @@
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/name.hh>
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tag-fwd.hh>
#include <iosfwd>
namespace paludis
diff --git a/paludis/stringify_formatter-impl.hh b/paludis/stringify_formatter-impl.hh
index 19d99fb..1e453dd 100644
--- a/paludis/stringify_formatter-impl.hh
+++ b/paludis/stringify_formatter-impl.hh
@@ -34,7 +34,9 @@ namespace paludis
const CanFormat<KeywordName> * const f_keyword;
const CanFormat<PackageDepSpec> * const f_package;
const CanFormat<BlockDepSpec> * const f_block;
- const CanFormat<URIDepSpec> * const f_uri;
+ const CanFormat<FetchableURIDepSpec> * const f_f_uri;
+ const CanFormat<SimpleURIDepSpec> * const f_s_uri;
+ const CanFormat<LicenseDepSpec> * const f_license;
const CanFormat<LabelsDepSpec<DependencyLabelVisitorTypes> > * const f_dep_label;
const CanFormat<LabelsDepSpec<URILabelVisitorTypes> > * const f_uri_label;
const CanFormat<PlainTextDepSpec> * const f_plain;
@@ -47,7 +49,9 @@ namespace paludis
const CanFormat<KeywordName> * const f_keyword_v,
const CanFormat<PackageDepSpec> * const f_package_v,
const CanFormat<BlockDepSpec> * const f_block_v,
- const CanFormat<URIDepSpec> * const f_uri_v,
+ const CanFormat<FetchableURIDepSpec> * const f_f_uri_v,
+ const CanFormat<SimpleURIDepSpec> * const f_s_uri_v,
+ const CanFormat<LicenseDepSpec> * const f_license_v,
const CanFormat<LabelsDepSpec<DependencyLabelVisitorTypes> > * const f_dep_label_v,
const CanFormat<LabelsDepSpec<URILabelVisitorTypes> > * const f_uri_label_v,
const CanFormat<PlainTextDepSpec> * const f_plain_v,
@@ -59,7 +63,9 @@ namespace paludis
f_keyword(f_keyword_v),
f_package(f_package_v),
f_block(f_block_v),
- f_uri(f_uri_v),
+ f_f_uri(f_f_uri_v),
+ f_s_uri(f_s_uri_v),
+ f_license(f_license_v),
f_dep_label(f_dep_label_v),
f_uri_label(f_uri_label_v),
f_plain(f_plain_v),
@@ -113,14 +119,24 @@ namespace paludis
StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<KeywordName> *>::value, KeywordName>::get(&t),
StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<PackageDepSpec> *>::value, PackageDepSpec>::get(&t),
StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<BlockDepSpec> *>::value, BlockDepSpec>::get(&t),
- StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<URIDepSpec> *>::value, URIDepSpec>::get(&t),
+ StringifyFormatterGetForwarder<
+ tr1::is_convertible<T_ *, CanFormat<FetchableURIDepSpec> *>::value,
+ FetchableURIDepSpec>::get(&t),
+ StringifyFormatterGetForwarder<
+ tr1::is_convertible<T_ *, CanFormat<SimpleURIDepSpec> *>::value,
+ SimpleURIDepSpec>::get(&t),
+ StringifyFormatterGetForwarder<
+ tr1::is_convertible<T_ *, CanFormat<LicenseDepSpec> *>::value,
+ LicenseDepSpec>::get(&t),
StringifyFormatterGetForwarder<
tr1::is_convertible<T_ *, CanFormat<LabelsDepSpec<DependencyLabelVisitorTypes> > *>::value,
LabelsDepSpec<DependencyLabelVisitorTypes> >::get(&t),
StringifyFormatterGetForwarder<
tr1::is_convertible<T_ *, CanFormat<LabelsDepSpec<URILabelVisitorTypes> > *>::value,
LabelsDepSpec<URILabelVisitorTypes> >::get(&t),
- StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<PlainTextDepSpec> *>::value, PlainTextDepSpec>::get(&t),
+ StringifyFormatterGetForwarder<
+ tr1::is_convertible<T_ *, CanFormat<PlainTextDepSpec> *>::value,
+ PlainTextDepSpec>::get(&t),
StringifyFormatterGetForwarder<tr1::is_convertible<T_ *, CanFormat<UseDepSpec> *>::value, UseDepSpec>::get(&t),
StringifyFormatterGetSpaceForwarder<tr1::is_convertible<T_ *, CanSpace *>::value>::get(&t)
))
diff --git a/paludis/stringify_formatter.cc b/paludis/stringify_formatter.cc
index cceeb6d..8e03a46 100644
--- a/paludis/stringify_formatter.cc
+++ b/paludis/stringify_formatter.cc
@@ -27,7 +27,7 @@
using namespace paludis;
StringifyFormatter::StringifyFormatter() :
- PrivateImplementationPattern<StringifyFormatter>(new Implementation<StringifyFormatter>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ PrivateImplementationPattern<StringifyFormatter>(new Implementation<StringifyFormatter>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
{
}
@@ -188,47 +188,63 @@ StringifyFormatter::format(const BlockDepSpec & s, const format::Plain & k) cons
}
std::string
-StringifyFormatter::format(const URIDepSpec & s, const format::Plain & k) const
+StringifyFormatter::format(const SimpleURIDepSpec & s, const format::Plain & k) const
{
- if (_imp->f_uri)
- return _imp->f_uri->format(s, k);
+ if (_imp->f_s_uri)
+ return _imp->f_s_uri->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const LabelsDepSpec<DependencyLabelVisitorTypes> & s, const format::Plain & k) const
+StringifyFormatter::format(const FetchableURIDepSpec & s, const format::Plain & k) const
{
- if (_imp->f_dep_label)
- return _imp->f_dep_label->format(s, k);
+ if (_imp->f_f_uri)
+ return _imp->f_f_uri->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const LabelsDepSpec<URILabelVisitorTypes> & s, const format::Plain & k) const
+StringifyFormatter::format(const LicenseDepSpec & s, const format::Plain & k) const
{
- if (_imp->f_uri_label)
- return _imp->f_uri_label->format(s, k);
+ if (_imp->f_license)
+ return _imp->f_license->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const PlainTextDepSpec & s, const format::Plain & k) const
+StringifyFormatter::format(const LicenseDepSpec & s, const format::Accepted & k) const
{
- if (_imp->f_plain)
- return _imp->f_plain->format(s, k);
+ if (_imp->f_license)
+ return _imp->f_license->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const PlainTextDepSpec & s, const format::Accepted & k) const
+StringifyFormatter::format(const LicenseDepSpec & s, const format::Unaccepted & k) const
{
- if (_imp->f_plain)
- return _imp->f_plain->format(s, k);
+ if (_imp->f_license)
+ return _imp->f_license->format(s, k);
+ return stringify(s);
+}
+
+std::string
+StringifyFormatter::format(const LabelsDepSpec<DependencyLabelVisitorTypes> & s, const format::Plain & k) const
+{
+ if (_imp->f_dep_label)
+ return _imp->f_dep_label->format(s, k);
+ return stringify(s);
+}
+
+std::string
+StringifyFormatter::format(const LabelsDepSpec<URILabelVisitorTypes> & s, const format::Plain & k) const
+{
+ if (_imp->f_uri_label)
+ return _imp->f_uri_label->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const PlainTextDepSpec & s, const format::Unaccepted & k) const
+StringifyFormatter::format(const PlainTextDepSpec & s, const format::Plain & k) const
{
if (_imp->f_plain)
return _imp->f_plain->format(s, k);
diff --git a/paludis/stringify_formatter.hh b/paludis/stringify_formatter.hh
index e799858..11b0df4 100644
--- a/paludis/stringify_formatter.hh
+++ b/paludis/stringify_formatter.hh
@@ -35,10 +35,12 @@ namespace paludis
public CanFormat<KeywordName>,
public CanFormat<PackageDepSpec>,
public CanFormat<BlockDepSpec>,
- public CanFormat<URIDepSpec>,
+ public CanFormat<FetchableURIDepSpec>,
+ public CanFormat<SimpleURIDepSpec>,
public CanFormat<LabelsDepSpec<DependencyLabelVisitorTypes> >,
public CanFormat<LabelsDepSpec<URILabelVisitorTypes> >,
public CanFormat<PlainTextDepSpec>,
+ public CanFormat<LicenseDepSpec>,
public CanFormat<UseDepSpec>,
public CanSpace
{
@@ -76,15 +78,19 @@ namespace paludis
virtual std::string format(const BlockDepSpec &, const format::Plain &) const;
- virtual std::string format(const URIDepSpec &, const format::Plain &) const;
+ virtual std::string format(const FetchableURIDepSpec &, const format::Plain &) const;
+
+ virtual std::string format(const SimpleURIDepSpec &, const format::Plain &) const;
virtual std::string format(const LabelsDepSpec<DependencyLabelVisitorTypes> &, const format::Plain &) const;
virtual std::string format(const LabelsDepSpec<URILabelVisitorTypes> &, const format::Plain &) const;
virtual std::string format(const PlainTextDepSpec &, const format::Plain &) const;
- virtual std::string format(const PlainTextDepSpec &, const format::Accepted &) const;
- virtual std::string format(const PlainTextDepSpec &, const format::Unaccepted &) const;
+
+ virtual std::string format(const LicenseDepSpec &, const format::Plain &) const;
+ virtual std::string format(const LicenseDepSpec &, const format::Accepted &) const;
+ virtual std::string format(const LicenseDepSpec &, const format::Unaccepted &) const;
virtual std::string format(const UseDepSpec &, const format::Enabled &) const;
virtual std::string format(const UseDepSpec &, const format::Disabled &) const;
diff --git a/paludis/stringify_formatter_TEST.cc b/paludis/stringify_formatter_TEST.cc
index dd7ea37..fa4bfbf 100644
--- a/paludis/stringify_formatter_TEST.cc
+++ b/paludis/stringify_formatter_TEST.cc
@@ -21,6 +21,7 @@
#include <paludis/stringify_formatter-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
diff --git a/paludis/tasks/uninstall_task.hh b/paludis/tasks/uninstall_task.hh
index 77e859b..76d526f 100644
--- a/paludis/tasks/uninstall_task.hh
+++ b/paludis/tasks/uninstall_task.hh
@@ -20,10 +20,12 @@
#ifndef PALUDIS_GUARD_PALUDIS_TASKS_UNINSTALL_TASK_HH
#define PALUDIS_GUARD_PALUDIS_TASKS_UNINSTALL_TASK_HH 1
-#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/package_id.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/exception.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
namespace paludis
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index decb0a2..126364d 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -220,5 +220,6 @@ void expose_additional_tests()
bp::def("test_metadata_provide_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<ProvideSpecTree>);
bp::def("test_metadata_dependency_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<DependencySpecTree>);
bp::def("test_metadata_restrict_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<RestrictSpecTree>);
- bp::def("test_metadata_uri_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<URISpecTree>);
+ bp::def("test_metadata_fetchable_uri_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<FetchableURISpecTree>);
+ bp::def("test_metadata_simple_uri_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<SimpleURISpecTree>);
}
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 2172f60..0c0f0c3 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -46,7 +46,9 @@ template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonU
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonPackageDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonBlockDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonPlainTextDepSpec>;
-template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURIDepSpec>;
+template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonSimpleURIDepSpec>;
+template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonFetchableURIDepSpec>;
+template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonLicenseDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURILabelsDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonDependencyLabelsDepSpec>;
@@ -56,7 +58,9 @@ template class Visits<const PythonUseDepSpec>;
template class Visits<const PythonPackageDepSpec>;
template class Visits<const PythonBlockDepSpec>;
template class Visits<const PythonPlainTextDepSpec>;
-template class Visits<const PythonURIDepSpec>;
+template class Visits<const PythonSimpleURIDepSpec>;
+template class Visits<const PythonFetchableURIDepSpec>;
+template class Visits<const PythonLicenseDepSpec>;
template class Visits<const PythonURILabelsDepSpec>;
template class Visits<const PythonDependencyLabelsDepSpec>;
@@ -398,6 +402,26 @@ PythonPlainTextDepSpec::PythonPlainTextDepSpec(const PlainTextDepSpec & d) :
{
}
+PythonLicenseDepSpec::PythonLicenseDepSpec(const std::string & s) :
+ PythonStringDepSpec(s)
+{
+}
+
+PythonLicenseDepSpec::PythonLicenseDepSpec(const LicenseDepSpec & d) :
+ PythonStringDepSpec(d.text())
+{
+}
+
+PythonSimpleURIDepSpec::PythonSimpleURIDepSpec(const std::string & s) :
+ PythonStringDepSpec(s)
+{
+}
+
+PythonSimpleURIDepSpec::PythonSimpleURIDepSpec(const SimpleURIDepSpec & d) :
+ PythonStringDepSpec(d.text())
+{
+}
+
PythonBlockDepSpec::PythonBlockDepSpec(tr1::shared_ptr<const PythonPackageDepSpec> & a) :
PythonStringDepSpec("!" + a->text()),
_spec(a)
@@ -416,18 +440,18 @@ PythonBlockDepSpec::blocked_spec() const
return _spec;
}
-PythonURIDepSpec::PythonURIDepSpec(const std::string & s) :
+PythonFetchableURIDepSpec::PythonFetchableURIDepSpec(const std::string & s) :
PythonStringDepSpec(s)
{
}
-PythonURIDepSpec::PythonURIDepSpec(const URIDepSpec & d) :
+PythonFetchableURIDepSpec::PythonFetchableURIDepSpec(const FetchableURIDepSpec & d) :
PythonStringDepSpec(d.text())
{
}
std::string
-PythonURIDepSpec::original_url() const
+PythonFetchableURIDepSpec::original_url() const
{
std::string::size_type p(text().find(" -> "));
if (std::string::npos == p)
@@ -437,7 +461,7 @@ PythonURIDepSpec::original_url() const
}
std::string
-PythonURIDepSpec::renamed_url_suffix() const
+PythonFetchableURIDepSpec::renamed_url_suffix() const
{
std::string::size_type p(text().find(" -> "));
if (std::string::npos == p)
@@ -517,9 +541,21 @@ SpecTreeToPython::visit_leaf(const PlainTextDepSpec & d)
}
void
-SpecTreeToPython::visit_leaf(const URIDepSpec & d)
+SpecTreeToPython::visit_leaf(const LicenseDepSpec & d)
{
- _current_parent->add_child(tr1::shared_ptr<PythonURIDepSpec>(new PythonURIDepSpec(d)));
+ _current_parent->add_child(tr1::shared_ptr<PythonLicenseDepSpec>(new PythonLicenseDepSpec(d)));
+}
+
+void
+SpecTreeToPython::visit_leaf(const SimpleURIDepSpec & d)
+{
+ _current_parent->add_child(tr1::shared_ptr<PythonSimpleURIDepSpec>(new PythonSimpleURIDepSpec(d)));
+}
+
+void
+SpecTreeToPython::visit_leaf(const FetchableURIDepSpec & d)
+{
+ _current_parent->add_child(tr1::shared_ptr<PythonFetchableURIDepSpec>(new PythonFetchableURIDepSpec(d)));
}
void
@@ -577,19 +613,27 @@ struct AllowedTypes<LicenseSpecTree>
AllowedTypes(const AllDepSpec &) {};
AllowedTypes(const AnyDepSpec &) {};
AllowedTypes(const UseDepSpec &) {};
- AllowedTypes(const PlainTextDepSpec &) {};
+ AllowedTypes(const LicenseDepSpec &) {};
};
template<>
-struct AllowedTypes<URISpecTree>
+struct AllowedTypes<FetchableURISpecTree>
{
AllowedTypes(const AllDepSpec &) {};
AllowedTypes(const UseDepSpec &) {};
- AllowedTypes(const URIDepSpec &) {};
+ AllowedTypes(const FetchableURISpecTree &) {};
AllowedTypes(const LabelsDepSpec<URILabelVisitorTypes> &) {};
};
template<>
+struct AllowedTypes<SimpleURISpecTree>
+{
+ AllowedTypes(const AllDepSpec &) {};
+ AllowedTypes(const UseDepSpec &) {};
+ AllowedTypes(const SimpleURIDepSpec &) {};
+};
+
+template<>
struct AllowedTypes<ProvideSpecTree>
{
AllowedTypes(const AllDepSpec &) {};
@@ -670,6 +714,20 @@ struct NiceClassNames<PlainTextDepSpec>
const char * NiceClassNames<PlainTextDepSpec>::name = "PlainTextDepSpec";
template<>
+struct NiceClassNames<LicenseDepSpec>
+{
+ static const char * name;
+};
+const char * NiceClassNames<LicenseDepSpec>::name = "LicenseDepSpec";
+
+template<>
+struct NiceClassNames<SimpleURIDepSpec>
+{
+ static const char * name;
+};
+const char * NiceClassNames<SimpleURIDepSpec>::name = "SimpleURIDepSpec";
+
+template<>
struct NiceClassNames<PackageDepSpec>
{
static const char * name;
@@ -677,11 +735,11 @@ struct NiceClassNames<PackageDepSpec>
const char * NiceClassNames<PackageDepSpec>::name = "PackageDepSpec";
template<>
-struct NiceClassNames<URIDepSpec>
+struct NiceClassNames<FetchableURIDepSpec>
{
static const char * name;
};
-const char * NiceClassNames<URIDepSpec>::name = "URIDepSpec";
+const char * NiceClassNames<FetchableURIDepSpec>::name = "FetchableURIDepSpec";
template<>
struct NiceClassNames<LabelsDepSpec<URILabelVisitorTypes> >
@@ -719,11 +777,18 @@ struct NiceClassNames<LicenseSpecTree>
const char * NiceClassNames<LicenseSpecTree>::name = "LicenseSpecTree";
template<>
-struct NiceClassNames<URISpecTree>
+struct NiceClassNames<FetchableURISpecTree>
{
static const char * name;
};
-const char * NiceClassNames<URISpecTree>::name = "URISpecTree";
+const char * NiceClassNames<FetchableURISpecTree>::name = "FetchableURISpecTree";
+
+template<>
+struct NiceClassNames<SimpleURISpecTree>
+{
+ static const char * name;
+};
+const char * NiceClassNames<SimpleURISpecTree>::name = "SimpleURISpecTree";
template<>
struct NiceClassNames<FlattenableSpecTree>
@@ -797,7 +862,6 @@ Dispatcher<H_, D_, PyD_, false>::do_dispatch(SpecTreeFromPython<H_> *, const PyD
" are not allowed in a heirarchy of type '" + NiceClassNames<H_>::name + "'");
}
-
template <typename H_, typename D_, typename PyD_>
void dispatch(SpecTreeFromPython<H_> * const v, const PyD_ & d)
{
@@ -846,6 +910,20 @@ SpecTreeFromPython<H_>::visit(const PythonPackageDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::visit(const PythonSimpleURIDepSpec & d)
+{
+ dispatch<H_, SimpleURIDepSpec>(this, d);
+}
+
+template <typename H_>
+void
+SpecTreeFromPython<H_>::visit(const PythonLicenseDepSpec & d)
+{
+ dispatch<H_, LicenseDepSpec>(this, d);
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::visit(const PythonPlainTextDepSpec & d)
{
dispatch<H_, PlainTextDepSpec>(this, d);
@@ -853,9 +931,9 @@ SpecTreeFromPython<H_>::visit(const PythonPlainTextDepSpec & d)
template <typename H_>
void
-SpecTreeFromPython<H_>::visit(const PythonURIDepSpec & d)
+SpecTreeFromPython<H_>::visit(const PythonFetchableURIDepSpec & d)
{
- dispatch<H_, URIDepSpec>(this, d);
+ dispatch<H_, FetchableURIDepSpec>(this, d);
}
template <typename H_>
@@ -939,6 +1017,24 @@ SpecTreeFromPython<H_>::real_visit(const PythonPackageDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::real_visit(const PythonLicenseDepSpec & d)
+{
+ _add(tr1::shared_ptr<TreeLeaf<H_, LicenseDepSpec> >(
+ new TreeLeaf<H_, LicenseDepSpec>(tr1::shared_ptr<LicenseDepSpec>(
+ new LicenseDepSpec(d.text())))));
+}
+
+template <typename H_>
+void
+SpecTreeFromPython<H_>::real_visit(const PythonSimpleURIDepSpec & d)
+{
+ _add(tr1::shared_ptr<TreeLeaf<H_, SimpleURIDepSpec> >(
+ new TreeLeaf<H_, SimpleURIDepSpec>(tr1::shared_ptr<SimpleURIDepSpec>(
+ new SimpleURIDepSpec(d.text())))));
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::real_visit(const PythonPlainTextDepSpec & d)
{
_add(tr1::shared_ptr<TreeLeaf<H_, PlainTextDepSpec> >(
@@ -948,11 +1044,11 @@ SpecTreeFromPython<H_>::real_visit(const PythonPlainTextDepSpec & d)
template <typename H_>
void
-SpecTreeFromPython<H_>::real_visit(const PythonURIDepSpec & d)
+SpecTreeFromPython<H_>::real_visit(const PythonFetchableURIDepSpec & d)
{
- _add(tr1::shared_ptr<TreeLeaf<H_, URIDepSpec> >(
- new TreeLeaf<H_, URIDepSpec>(tr1::shared_ptr<URIDepSpec>(
- new URIDepSpec(d.text())))));
+ _add(tr1::shared_ptr<TreeLeaf<H_, FetchableURIDepSpec> >(
+ new TreeLeaf<H_, FetchableURIDepSpec>(tr1::shared_ptr<FetchableURIDepSpec>(
+ new FetchableURIDepSpec(d.text())))));
}
template <typename H_>
@@ -1169,16 +1265,20 @@ void expose_dep_spec()
register_tree_to_python<DependencySpecTree>();
register_tree_to_python<ProvideSpecTree>();
register_tree_to_python<RestrictSpecTree>();
- register_tree_to_python<URISpecTree>();
+ register_tree_to_python<FetchableURISpecTree>();
+ register_tree_to_python<SimpleURISpecTree>();
register_tree_to_python<LicenseSpecTree>();
register_tree_to_python<SetSpecTree>();
+ register_tree_to_python<FlattenableSpecTree>();
RegisterSpecTreeSPTRFromPython<DependencySpecTree>();
RegisterSpecTreeSPTRFromPython<ProvideSpecTree>();
RegisterSpecTreeSPTRFromPython<RestrictSpecTree>();
- RegisterSpecTreeSPTRFromPython<URISpecTree>();
+ RegisterSpecTreeSPTRFromPython<FetchableURISpecTree>();
+ RegisterSpecTreeSPTRFromPython<SimpleURISpecTree>();
RegisterSpecTreeSPTRFromPython<LicenseSpecTree>();
RegisterSpecTreeSPTRFromPython<SetSpecTree>();
+ RegisterSpecTreeSPTRFromPython<FlattenableSpecTree>();
/**
* DepSpec
@@ -1367,26 +1467,50 @@ void expose_dep_spec()
bp::class_<PythonPlainTextDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
(
"PlainTextDepSpec",
- "A PlainTextDepSpec represents a plain text entry (for example, a URI in SRC_URI).",
+ "A PlainTextDepSpec represents a plain text entry (for example, a RESTRICT keyword).",
bp::init<const std::string &>("__init__(string)")
)
.def("__str__", &PythonPlainTextDepSpec::text)
;
/**
- * URIDepSpec
+ * LicenseDepSpec
+ */
+ bp::class_<PythonLicenseDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
+ (
+ "LicenseDepSpec",
+ "A LicenseDepSpec represents a license.",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .def("__str__", &PythonLicenseDepSpec::text)
+ ;
+
+ /**
+ * SimpleURIDepSpec
+ */
+ bp::class_<PythonSimpleURIDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
+ (
+ "SimpleURIDepSpec",
+ "A SimpleURIDepSpec represents a simple URI.",
+ bp::init<const std::string &>("__init__(string)")
+ )
+ .def("__str__", &PythonSimpleURIDepSpec::text)
+ ;
+
+ /**
+ * FetchableURIDepSpec
*/
- bp::class_<PythonURIDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
+ bp::class_<PythonFetchableURIDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable>
(
- "URIDepSpec",
- "A URIDepSpec represents a URI part.",
+ "FetchableURIDepSpec",
+ "A FetchableURIDepSpec represents a fetchable URI part.",
bp::init<const std::string &>("__init__(str)")
)
- .add_property("original_url", &PythonURIDepSpec::original_url,
+ .add_property("original_url", &PythonFetchableURIDepSpec::original_url,
"[ro] str"
)
- .add_property("renamed_url_suffix", &PythonURIDepSpec::renamed_url_suffix,
+ .add_property("renamed_url_suffix", &PythonFetchableURIDepSpec::renamed_url_suffix,
"[ro] str"
)
;
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index b7ce90a..e1ec963 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PYTHON_DEP_SPEC_HH 1
#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
#include <paludis/util/tr1_functional.hh>
namespace paludis
@@ -34,8 +35,10 @@ namespace paludis
class PythonUseDepSpec;
class PythonStringDepSpec;
class PythonPlainTextDepSpec;
+ class PythonLicenseDepSpec;
class PythonPackageDepSpec;
- class PythonURIDepSpec;
+ class PythonFetchableURIDepSpec;
+ class PythonSimpleURIDepSpec;
class PythonBlockDepSpec;
class PythonURILabelsDepSpec;
class PythonDependencyLabelsDepSpec;
@@ -49,8 +52,10 @@ namespace paludis
PythonUseDepSpec,
PythonBlockDepSpec,
PythonPlainTextDepSpec,
+ PythonLicenseDepSpec,
PythonPackageDepSpec,
- PythonURIDepSpec,
+ PythonFetchableURIDepSpec,
+ PythonSimpleURIDepSpec,
PythonURILabelsDepSpec,
PythonDependencyLabelsDepSpec
>
@@ -187,13 +192,31 @@ namespace paludis
PythonPlainTextDepSpec(const PlainTextDepSpec &);
};
- class PALUDIS_VISIBLE PythonURIDepSpec :
+ class PALUDIS_VISIBLE PythonSimpleURIDepSpec :
public PythonStringDepSpec,
- public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURIDepSpec>
+ public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonSimpleURIDepSpec>
{
public:
- PythonURIDepSpec(const std::string &);
- PythonURIDepSpec(const URIDepSpec &);
+ PythonSimpleURIDepSpec(const std::string &);
+ PythonSimpleURIDepSpec(const SimpleURIDepSpec &);
+ };
+
+ class PALUDIS_VISIBLE PythonLicenseDepSpec :
+ public PythonStringDepSpec,
+ public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonLicenseDepSpec>
+ {
+ public:
+ PythonLicenseDepSpec(const std::string &);
+ PythonLicenseDepSpec(const LicenseDepSpec &);
+ };
+
+ class PALUDIS_VISIBLE PythonFetchableURIDepSpec :
+ public PythonStringDepSpec,
+ public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonFetchableURIDepSpec>
+ {
+ public:
+ PythonFetchableURIDepSpec(const std::string &);
+ PythonFetchableURIDepSpec(const FetchableURIDepSpec &);
std::string original_url() const;
std::string renamed_url_suffix() const;
@@ -266,7 +289,11 @@ namespace paludis
void visit_leaf(const BlockDepSpec &);
- void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const SimpleURIDepSpec &);
+
+ void visit_leaf(const FetchableURIDepSpec &);
+
+ void visit_leaf(const LicenseDepSpec &);
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
@@ -298,7 +325,9 @@ namespace paludis
void visit(const PythonPackageDepSpec &);
void visit(const PythonPlainTextDepSpec &);
void visit(const PythonBlockDepSpec &);
- void visit(const PythonURIDepSpec &);
+ void visit(const PythonSimpleURIDepSpec &);
+ void visit(const PythonFetchableURIDepSpec &);
+ void visit(const PythonLicenseDepSpec &);
void visit(const PythonURILabelsDepSpec &);
void visit(const PythonDependencyLabelsDepSpec &);
@@ -308,9 +337,11 @@ namespace paludis
void real_visit(const PythonPackageDepSpec &);
void real_visit(const PythonPlainTextDepSpec &);
void real_visit(const PythonBlockDepSpec &);
- void real_visit(const PythonURIDepSpec &);
+ void real_visit(const PythonFetchableURIDepSpec &);
+ void real_visit(const PythonSimpleURIDepSpec &);
void real_visit(const PythonURILabelsDepSpec &);
void real_visit(const PythonDependencyLabelsDepSpec &);
+ void real_visit(const PythonLicenseDepSpec &);
};
}
}
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index e592e1e..074fdfa 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -119,9 +119,14 @@ class MetadataKeySptrToPythonVisitor :
obj = bp::object(tr1::static_pointer_cast<const MetadataSpecTreeKey<RestrictSpecTree> >(_m_ptr));
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
- obj = bp::object(tr1::static_pointer_cast<const MetadataSpecTreeKey<URISpecTree> >(_m_ptr));
+ obj = bp::object(tr1::static_pointer_cast<const MetadataSpecTreeKey<FetchableURISpecTree> >(_m_ptr));
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
+ {
+ obj = bp::object(tr1::static_pointer_cast<const MetadataSpecTreeKey<SimpleURISpecTree> >(_m_ptr));
}
void visit(const MetadataSetKey<PackageIDSequence> & k)
@@ -393,16 +398,16 @@ struct MetadataSpecTreeKeyWrapper :
};
template <>
-struct MetadataSpecTreeKeyWrapper<URISpecTree> :
- MetadataSpecTreeKey<URISpecTree>,
- bp::wrapper<MetadataSpecTreeKey<URISpecTree> >
+struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> :
+ MetadataSpecTreeKey<FetchableURISpecTree>,
+ bp::wrapper<MetadataSpecTreeKey<FetchableURISpecTree> >
{
MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataSpecTreeKey<URISpecTree>(r, h, t)
+ MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t)
{
}
- virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ virtual const tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
Lock l(get_mutex());
@@ -413,7 +418,7 @@ struct MetadataSpecTreeKeyWrapper<URISpecTree> :
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value");
}
- virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
Lock l(get_mutex());
@@ -425,7 +430,7 @@ struct MetadataSpecTreeKeyWrapper<URISpecTree> :
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print");
}
- virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ virtual std::string pretty_print_flat(const FetchableURISpecTree::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
Lock l(get_mutex());
@@ -684,6 +689,7 @@ void expose_metadata_key()
class_spec_tree_key<ProvideSpecTree>("ProvideSpecTree");
class_spec_tree_key<DependencySpecTree>("DependencySpecTree");
class_spec_tree_key<RestrictSpecTree>("RestrictSpecTree");
- class_spec_tree_key<URISpecTree>("URISpecTree");
+ class_spec_tree_key<SimpleURISpecTree>("SimpleURISpecTree");
+ class_spec_tree_key<FetchableURISpecTree>("FetchableURISpecTree");
}
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 69185a4..57c41dd 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -228,10 +228,10 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
test_metadata_restrict_spec_tree_key(TestKey())
- def test_14_uri_spec_tree(self):
- class TestKey(MetadataURISpecTreeKey):
+ def test_14_fetchable_uri_spec_tree(self):
+ class TestKey(MetadataFetchableURISpecTreeKey):
def __init__(self):
- MetadataURISpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataFetchableURISpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
def value(self):
return AllDepSpec()
@@ -242,7 +242,23 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def pretty_print_flat(self):
return "str"
- test_metadata_uri_spec_tree_key(TestKey())
+ test_metadata_fetchable_uri_spec_tree_key(TestKey())
+
+ def test_15_simple_uri_spec_tree(self):
+ class TestKey(MetadataSimpleURISpecTreeKey):
+ def __init__(self):
+ MetadataSimpleURISpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+
+ def value(self):
+ return AllDepSpec()
+
+ def pretty_print(self):
+ return "str"
+
+ def pretty_print_flat(self):
+ return "str"
+
+ test_metadata_simple_uri_spec_tree_key(TestKey())
if __name__ == "__main__":
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index e890d06..1dbf1d7 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -145,7 +145,12 @@ namespace
value = Qnil;
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
+ {
+ value = Qnil;
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
value = Qnil;
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
index 486315f..fdb1344 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
@@ -137,13 +137,19 @@ MarkupFormatter::format(const PlainTextDepSpec & f, const format::Plain &) const
}
std::string
-MarkupFormatter::format(const PlainTextDepSpec & f, const format::Accepted &) const
+MarkupFormatter::format(const LicenseDepSpec & f, const format::Plain &) const
+{
+ return markup_escape(stringify(f));
+}
+
+std::string
+MarkupFormatter::format(const LicenseDepSpec & f, const format::Accepted &) const
{
return markup_foreground("green", markup_escape(stringify(f)));
}
std::string
-MarkupFormatter::format(const PlainTextDepSpec & f, const format::Unaccepted &) const
+MarkupFormatter::format(const LicenseDepSpec & f, const format::Unaccepted &) const
{
return markup_foreground("red", markup_escape(stringify(f)));
}
@@ -185,7 +191,13 @@ MarkupFormatter::format(const LabelsDepSpec<DependencyLabelVisitorTypes> & f, co
}
std::string
-MarkupFormatter::format(const URIDepSpec & f, const format::Plain &) const
+MarkupFormatter::format(const FetchableURIDepSpec & f, const format::Plain &) const
+{
+ return markup_escape(stringify(f));
+}
+
+std::string
+MarkupFormatter::format(const SimpleURIDepSpec & f, const format::Plain &) const
{
return markup_escape(stringify(f));
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
index edef0e5..c1cffb4 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
@@ -19,7 +19,9 @@ namespace gtkpaludis
public paludis::CanFormat<paludis::LabelsDepSpec<paludis::DependencyLabelVisitorTypes> >,
public paludis::CanFormat<paludis::LabelsDepSpec<paludis::URILabelVisitorTypes> >,
public paludis::CanFormat<paludis::PlainTextDepSpec>,
- public paludis::CanFormat<paludis::URIDepSpec>,
+ public paludis::CanFormat<paludis::SimpleURIDepSpec>,
+ public paludis::CanFormat<paludis::FetchableURIDepSpec>,
+ public paludis::CanFormat<paludis::LicenseDepSpec>,
public paludis::CanFormat<paludis::tr1::shared_ptr<const paludis::PackageID> >,
public paludis::CanFormat<std::string>,
public paludis::CanSpace
@@ -50,8 +52,10 @@ namespace gtkpaludis
std::string format(const paludis::PackageDepSpec &, const paludis::format::Installable &) const;
std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Accepted &) const;
- std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Unaccepted &) const;
+
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Plain &) const;
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Accepted &) const;
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Unaccepted &) const;
std::string format(const paludis::KeywordName &, const paludis::format::Plain &) const;
std::string format(const paludis::KeywordName &, const paludis::format::Accepted &) const;
@@ -63,7 +67,9 @@ namespace gtkpaludis
std::string format(const paludis::LabelsDepSpec<paludis::DependencyLabelVisitorTypes> &, const paludis::format::Plain &) const;
- std::string format(const paludis::URIDepSpec &, const paludis::format::Plain &) const;
+ std::string format(const paludis::SimpleURIDepSpec &, const paludis::format::Plain &) const;
+
+ std::string format(const paludis::FetchableURIDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::BlockDepSpec &, const paludis::format::Plain &) const;
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index d0bb9ed..397ee2d 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -132,7 +132,12 @@ namespace gtkpaludis
got_key(k, k.pretty_print_flat(formatter));
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
+ {
+ got_key(k, k.pretty_print_flat(formatter));
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
got_key(k, k.pretty_print_flat(formatter));
}
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index f4726b7..173fa18 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -91,7 +91,11 @@ namespace
{
}
- void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
}
@@ -167,9 +171,14 @@ namespace
const tr1::shared_ptr<ProvideSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ const tr1::shared_ptr<FetchableURISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
- const tr1::shared_ptr<URISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const tr1::shared_ptr<SimpleURISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
@@ -355,7 +364,8 @@ main(int argc, char *argv[])
}
catch (const Exception & e)
{
- results.insert(std::make_pair(*i, "Exception in metadata key '" + (*m)->raw_name() + "': '" + e.message() + "' (" + e.what() + ")"));
+ results.insert(std::make_pair(*i, "Exception in metadata key '" + (*m)->raw_name() + "': '" + e.message() +
+ "' (" + e.what() + ")"));
metadata_errors = true;
}
}
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index e333cd5..a017fc7 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -87,7 +87,12 @@ namespace
stream << k.raw_name() << ": " << k.pretty_print_flat(formatter);
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ stream << k.raw_name() << ": " << k.pretty_print_flat(formatter);
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
stream << k.raw_name() << ": " << k.pretty_print_flat(formatter);
}
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index 0f516f6..41f9552 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -295,13 +295,19 @@ ColourFormatter::format(const PlainTextDepSpec & f, const format::Plain &) const
}
std::string
-ColourFormatter::format(const PlainTextDepSpec & f, const format::Accepted &) const
+ColourFormatter::format(const LicenseDepSpec & f, const format::Plain &) const
+{
+ return stringify(f);
+}
+
+std::string
+ColourFormatter::format(const LicenseDepSpec & f, const format::Accepted &) const
{
return colour(cl_flag_on, f);
}
std::string
-ColourFormatter::format(const PlainTextDepSpec & f, const format::Unaccepted &) const
+ColourFormatter::format(const LicenseDepSpec & f, const format::Unaccepted &) const
{
return colour(cl_flag_off, f);
}
@@ -343,7 +349,13 @@ ColourFormatter::format(const LabelsDepSpec<DependencyLabelVisitorTypes> & f, co
}
std::string
-ColourFormatter::format(const URIDepSpec & f, const format::Plain &) const
+ColourFormatter::format(const FetchableURIDepSpec & f, const format::Plain &) const
+{
+ return stringify(f);
+}
+
+std::string
+ColourFormatter::format(const SimpleURIDepSpec & f, const format::Plain &) const
{
return stringify(f);
}
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
index 3e62e8b..f1a9d59 100644
--- a/src/output/colour_formatter.hh
+++ b/src/output/colour_formatter.hh
@@ -35,7 +35,9 @@ class ColourFormatter :
public paludis::CanFormat<paludis::LabelsDepSpec<paludis::DependencyLabelVisitorTypes> >,
public paludis::CanFormat<paludis::LabelsDepSpec<paludis::URILabelVisitorTypes> >,
public paludis::CanFormat<paludis::PlainTextDepSpec>,
- public paludis::CanFormat<paludis::URIDepSpec>,
+ public paludis::CanFormat<paludis::SimpleURIDepSpec>,
+ public paludis::CanFormat<paludis::FetchableURIDepSpec>,
+ public paludis::CanFormat<paludis::LicenseDepSpec>,
public paludis::CanFormat<paludis::tr1::shared_ptr<const paludis::PackageID> >,
public paludis::CanFormat<std::string>,
public paludis::CanSpace,
@@ -75,8 +77,10 @@ class ColourFormatter :
std::string format(const paludis::PackageDepSpec &, const paludis::format::Installable &) const;
std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Accepted &) const;
- std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Unaccepted &) const;
+
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Plain &) const;
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Accepted &) const;
+ std::string format(const paludis::LicenseDepSpec &, const paludis::format::Unaccepted &) const;
std::string format(const paludis::KeywordName &, const paludis::format::Plain &) const;
std::string format(const paludis::KeywordName &, const paludis::format::Accepted &) const;
@@ -88,7 +92,9 @@ class ColourFormatter :
std::string format(const paludis::LabelsDepSpec<paludis::DependencyLabelVisitorTypes> &, const paludis::format::Plain &) const;
- std::string format(const paludis::URIDepSpec &, const paludis::format::Plain &) const;
+ std::string format(const paludis::FetchableURIDepSpec &, const paludis::format::Plain &) const;
+
+ std::string format(const paludis::SimpleURIDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::BlockDepSpec &, const paludis::format::Plain &) const;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 169484a..e8fdba8 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -281,7 +281,26 @@ namespace
}
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ if (k.type() == type)
+ {
+ ColourFormatter formatter;
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":");
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ else
+ {
+ task->output_left_column(k.human_name() + ":");
+ task->output_stream() << k.pretty_print_flat(formatter);
+ task->output_right_column("");
+ }
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
if (k.type() == type)
{
@@ -570,7 +589,12 @@ namespace
empty = false;
}
- void visit_leaf(const URIDepSpec &)
+ void visit_leaf(const SimpleURIDepSpec &)
+ {
+ empty = false;
+ }
+
+ void visit_leaf(const FetchableURIDepSpec &)
{
empty = false;
}
@@ -580,6 +604,11 @@ namespace
empty = false;
}
+ void visit_leaf(const LicenseDepSpec &)
+ {
+ empty = false;
+ }
+
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
{
}
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index 5a7f0bd..ebb122e 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -119,7 +119,13 @@ namespace
s << k.pretty_print_flat(formatter);
}
- void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
ColourFormatter formatter;
s << k.pretty_print_flat(formatter);