aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-26 22:16:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-26 22:16:54 +0000
commitb2c5636d0262ac180ce5319f464de5bb5ee3f420 (patch)
tree7c7e22467d87e1cfc327aa411e6695b9400d3a95
parent6b5af5a100ccbdadbd2bda2ae1f5d0c82fd88b78 (diff)
downloadpaludis-b2c5636d0262ac180ce5319f464de5bb5ee3f420.tar.gz
paludis-b2c5636d0262ac180ce5319f464de5bb5ee3f420.tar.xz
Carry around default labels with src_uri_key.
-rw-r--r--paludis/dep_label-fwd.hh18
-rw-r--r--paludis/dep_label.hh136
-rw-r--r--paludis/dep_spec.cc8
-rw-r--r--paludis/dep_spec.hh3
-rw-r--r--paludis/dep_tag.cc3
-rw-r--r--paludis/metadata_key.cc5
-rw-r--r--paludis/metadata_key.hh22
-rw-r--r--paludis/repositories/cran/keys.cc6
-rw-r--r--paludis/repositories/cran/keys.hh3
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc2
-rw-r--r--paludis/repositories/e/e_key.cc12
-rw-r--r--paludis/repositories/e/e_key.hh3
-rw-r--r--paludis/repositories/e/ebuild_entries.cc4
-rw-r--r--paludis/repositories/e/fetch_visitor.cc38
-rw-r--r--paludis/repositories/e/fetch_visitor.hh3
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc3
-rw-r--r--paludis/repositories/e/vdb_id.cc1
-rw-r--r--paludis/repositories/fake/fake_package_id.cc59
-rw-r--r--paludis/repositories/fake/fake_package_id.hh28
-rw-r--r--python/metadata_key.cc57
20 files changed, 374 insertions, 40 deletions
diff --git a/paludis/dep_label-fwd.hh b/paludis/dep_label-fwd.hh
index fede402..1019e1b 100644
--- a/paludis/dep_label-fwd.hh
+++ b/paludis/dep_label-fwd.hh
@@ -23,6 +23,12 @@
#include <paludis/util/attributes.hh>
#include <iosfwd>
+/** \file
+ * Forward declarations for paludis/dep_label.hh .
+ *
+ * \ingroup g_dep_spec
+ */
+
namespace paludis
{
struct URILabelVisitorTypes;
@@ -36,6 +42,12 @@ namespace paludis
typedef ConcreteURILabel<enum URILocalMirrorsOnlyLabelTag { }> URILocalMirrorsOnlyLabel;
typedef ConcreteURILabel<enum URIManualOnlyLabelTag { }> URIManualOnlyLabel;
+ /**
+ * A URILabel can be written to a stream.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.26
+ */
std::ostream & operator<< (std::ostream &, const URILabel &) PALUDIS_VISIBLE;
struct DependencyLabelVisitorTypes;
@@ -73,6 +85,12 @@ namespace paludis
typedef ConcreteDependencyLabel<enum DependencyABILabelTag { },
DependencyABIsLabel> DependencyABILabel;
+ /**
+ * A DependencyLabel can be written to a stream.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.26
+ */
std::ostream & operator<< (std::ostream &, const DependencyLabel &) PALUDIS_VISIBLE;
}
diff --git a/paludis/dep_label.hh b/paludis/dep_label.hh
index 5ae45a2..5980116 100644
--- a/paludis/dep_label.hh
+++ b/paludis/dep_label.hh
@@ -26,8 +26,25 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/attributes.hh>
+/** \file
+ * Declarations for dependency label-related classes.
+ *
+ * \ingroup g_dep_spec
+ *
+ * \section Examples
+ *
+ * - \ref example_dep_label.cc "example_dep_label.cc"
+ */
+
namespace paludis
{
+ /**
+ * Types for visiting a URI label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct URILabelVisitorTypes :
VisitorTypes<
URILabelVisitorTypes,
@@ -42,6 +59,13 @@ namespace paludis
{
};
+ /**
+ * Types for visiting a dependency label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct DependencyLabelVisitorTypes :
VisitorTypes<
DependencyLabelVisitorTypes,
@@ -54,6 +78,13 @@ namespace paludis
{
};
+ /**
+ * Types for visiting a dependency system label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct DependencySystemLabelVisitorTypes :
VisitorTypes<
DependencySystemLabelVisitorTypes,
@@ -64,6 +95,13 @@ namespace paludis
{
};
+ /**
+ * Types for visiting a dependency type label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct DependencyTypeLabelVisitorTypes :
VisitorTypes<
DependencyTypeLabelVisitorTypes,
@@ -76,6 +114,13 @@ namespace paludis
{
};
+ /**
+ * Types for visiting a dependency suggests label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct DependencySuggestLabelVisitorTypes :
VisitorTypes<
DependencySuggestLabelVisitorTypes,
@@ -87,6 +132,13 @@ namespace paludis
{
};
+ /**
+ * Types for visiting a dependency abi label.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct DependencyABIsLabelVisitorTypes :
VisitorTypes<
DependencyABIsLabelVisitorTypes,
@@ -99,16 +151,36 @@ namespace paludis
{
};
+ /**
+ * URI label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
class PALUDIS_VISIBLE URILabel :
private InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>,
public virtual ConstAcceptInterface<URILabelVisitorTypes>
{
public:
+ ///\name Basic operations
+ ///\{
+
virtual ~URILabel() = 0;
+ ///\}
+
+ /// Our text.
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+ /**
+ * A concrete URI label class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
template <typename T_>
class PALUDIS_VISIBLE ConcreteURILabel :
public URILabel,
@@ -119,56 +191,114 @@ namespace paludis
using PrivateImplementationPattern<ConcreteURILabel<T_> >::_imp;
public:
+ ///\name Basic operations
+ ///\{
+
ConcreteURILabel(const std::string &);
~ConcreteURILabel();
+ ///\}
+
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ /// Convenience typedef alias to obtain our tag.
typedef T_ Tag;
};
+ /**
+ * Dependency label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
class PALUDIS_VISIBLE DependencyLabel :
private InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>,
public virtual ConstAcceptInterface<DependencyLabelVisitorTypes>
{
public:
+ ///\name Basic operations
+ ///\{
+
virtual ~DependencyLabel() = 0;
+ ///\}
+
+ /// Our text.
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+ /**
+ * System dependency label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct PALUDIS_VISIBLE DependencySystemLabel :
public DependencyLabel,
public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySystemLabel>,
public virtual ConstAcceptInterface<DependencySystemLabelVisitorTypes>
{
+ /// Convenience alias for our visitor types.
typedef DependencySystemLabelVisitorTypes VisitorTypes;
};
+ /**
+ * Type dependency label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct PALUDIS_VISIBLE DependencyTypeLabel :
public DependencyLabel,
public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyTypeLabel>,
public virtual ConstAcceptInterface<DependencyTypeLabelVisitorTypes>
{
+ /// Convenience alias for our visitor types.
typedef DependencyTypeLabelVisitorTypes VisitorTypes;
};
+ /**
+ * Suggest dependency label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct PALUDIS_VISIBLE DependencySuggestLabel :
public DependencyLabel,
public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySuggestLabel>,
public virtual ConstAcceptInterface<DependencySuggestLabelVisitorTypes>
{
+ /// Convenience alias for our visitor types.
typedef DependencySuggestLabelVisitorTypes VisitorTypes;
};
+ /**
+ * ABI dependency label base class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
struct PALUDIS_VISIBLE DependencyABIsLabel :
public DependencyLabel,
public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyABIsLabel>,
public virtual ConstAcceptInterface<DependencyABIsLabelVisitorTypes>
{
+ /// Convenience alias for our visitor types.
typedef DependencyABIsLabelVisitorTypes VisitorTypes;
};
+ /**
+ * A concrete dependency label class.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ * \nosubgrouping
+ */
template <typename T_, typename C_>
class PALUDIS_VISIBLE ConcreteDependencyLabel :
public C_,
@@ -179,11 +309,17 @@ namespace paludis
using PrivateImplementationPattern<ConcreteDependencyLabel<T_, C_> >::_imp;
public:
+ ///\name Basic operations
+ ///\{
+
ConcreteDependencyLabel(const std::string &);
~ConcreteDependencyLabel();
+ ///\}
+
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ /// Convenience typedef alias to obtain our tag.
typedef T_ Tag;
};
}
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 3667553..4ac1cfe 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -791,14 +791,14 @@ paludis::operator<< (std::ostream & s, const PackageDepSpec & a)
std::ostream &
paludis::operator<< (std::ostream & s, const LabelsDepSpec<URILabelVisitorTypes> & l)
{
- s << join(l.begin(), l.end(), "+") << ":";
+ s << join(indirect_iterator(l.begin()), indirect_iterator(l.end()), "+") << ":";
return s;
}
std::ostream &
paludis::operator<< (std::ostream & s, const LabelsDepSpec<DependencyLabelVisitorTypes> & l)
{
- s << join(l.begin(), l.end(), ",") << ":";
+ s << join(indirect_iterator(l.begin()), indirect_iterator(l.end()), ",") << ":";
return s;
}
@@ -1107,14 +1107,14 @@ template <typename T_>
typename LabelsDepSpec<T_>::ConstIterator
LabelsDepSpec<T_>::begin() const
{
- return ConstIterator(indirect_iterator(_imp->items.begin()));
+ return ConstIterator(_imp->items.begin());
}
template <typename T_>
typename LabelsDepSpec<T_>::ConstIterator
LabelsDepSpec<T_>::end() const
{
- return ConstIterator(indirect_iterator(_imp->items.end()));
+ return ConstIterator(_imp->items.end());
}
template <typename T_>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 2d247f9..634c1d1 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -487,7 +487,8 @@ namespace paludis
///\{
void add_label(const tr1::shared_ptr<const typename SpecTree_::BasicNode> &);
- typedef libwrapiter::ForwardIterator<LabelsDepSpec<SpecTree_>, const typename SpecTree_::BasicNode> ConstIterator;
+ typedef libwrapiter::ForwardIterator<LabelsDepSpec<SpecTree_>,
+ const tr1::shared_ptr<const typename SpecTree_::BasicNode> > ConstIterator;
ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc
index 15b613b..0f2bdb0 100644
--- a/paludis/dep_tag.cc
+++ b/paludis/dep_tag.cc
@@ -239,7 +239,8 @@ namespace
void
visit_leaf(const DependencyLabelDepSpec & l)
{
- std::copy(l.begin(), l.end(), std::ostream_iterator<DependencyLabelVisitorTypes::BasicNode>(s, ","));
+ std::copy(indirect_iterator(l.begin()), indirect_iterator(l.end()),
+ std::ostream_iterator<DependencyLabelVisitorTypes::BasicNode>(s, ","));
s << ":";
}
};
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index b78db75..a5b0fde 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -122,6 +122,11 @@ MetadataSpecTreeKey<C_>::MetadataSpecTreeKey(const std::string & r, const std::s
{
}
+MetadataSpecTreeKey<URISpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
template class MetadataSetKey<KeywordNameSet>;
template class MetadataSetKey<IUseFlagSet>;
template class MetadataSetKey<Set<std::string> >;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 4bdd283..821769e 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -206,6 +206,28 @@ namespace paludis
virtual std::string pretty_print_flat(const typename C_::Formatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+
+ template <>
+ class PALUDIS_VISIBLE MetadataSpecTreeKey<URISpecTree> :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<URISpecTree> >
+ {
+ protected:
+ MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ public:
+ virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual const tr1::shared_ptr<const URILabel> initial_label() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
}
#endif
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index 35910ac..1627953 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -59,6 +59,12 @@ URIKey::pretty_print_flat(const URISpecTree::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 0bfae08..9e02e57 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -48,6 +48,9 @@ namespace paludis
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
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
class StringKey :
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 27fa012..dd342d3 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -169,7 +169,7 @@ void
CheckFetchedFilesVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
{
InNoFetchVisitor v;
- std::for_each(l.begin(), l.end(), accept_visitor(v));
+ std::for_each(indirect_iterator(l.begin()), indirect_iterator(l.end()), accept_visitor(v));
_imp->in_nofetch = v.result;
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index a90b8da..9ae07d6 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -299,6 +299,7 @@ namespace paludis
const std::string string_value;
mutable Mutex value_mutex;
mutable tr1::shared_ptr<const URISpecTree::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) :
env(e),
@@ -353,6 +354,17 @@ EURIKey::pretty_print_flat(const URISpecTree::Formatter & f) const
return stringify(p);
}
+const tr1::shared_ptr<const URILabel>
+EURIKey::initial_label() const
+{
+ Lock l(_imp->value_mutex);
+
+ if (! _imp->initial_label)
+ _imp->initial_label = *parse_uri_label("default:", *_imp->id->eapi())->begin();
+
+ return _imp->initial_label;
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 86fb782..bc14378 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -110,6 +110,9 @@ namespace paludis
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
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ERestrictKey :
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 961a494..feb79ab 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -411,8 +411,8 @@ EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
stringify(_imp->e_repository->params().master_repository->name()) :
stringify(_imp->e_repository->name()));
FetchVisitor f(_imp->params.environment, id, *id->eapi(),
- _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_userpriv_ok,
- mirrors_name, fetch_restrict, no_mirror, o.safe_resume);
+ _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_userpriv_ok, mirrors_name,
+ id->src_uri_key()->initial_label(), o.safe_resume);
id->src_uri_key()->value()->accept(f);
CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 8eeec03..d0580e1 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -54,12 +54,10 @@ namespace paludis
const bool fetch_unneeded;
const bool userpriv;
const std::string mirrors_name;
- const bool fetch_restrict;
- const bool no_mirror;
+ tr1::shared_ptr<const URILabel> default_label;
const bool safe_resume;
- tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> > default_label;
- std::list<const LabelsDepSpec<URILabelVisitorTypes> *> labels;
+ std::list<const URILabel *> labels;
Implementation(
const Environment * const e,
@@ -69,8 +67,7 @@ namespace paludis
const bool f,
const bool u,
const std::string & m,
- const bool n,
- const bool nm,
+ const tr1::shared_ptr<const URILabel> & n,
const bool sr) :
env(e),
id(i),
@@ -79,23 +76,9 @@ namespace paludis
fetch_unneeded(f),
userpriv(u),
mirrors_name(m),
- fetch_restrict(n),
- no_mirror(nm),
+ default_label(n),
safe_resume(sr)
{
- if (fetch_restrict)
- {
- default_label.reset(new LabelsDepSpec<URILabelVisitorTypes>);
- default_label->add_label(make_shared_ptr(new URIManualOnlyLabel("fetch-restrict")));
- }
- else if (no_mirror)
- {
- default_label.reset(new LabelsDepSpec<URILabelVisitorTypes>);
- default_label->add_label(make_shared_ptr(new URIListedOnlyLabel("mirror-restrict")));
- }
- else
- default_label = parse_uri_label("default:", eapi);
-
labels.push_front(default_label.get());
}
};
@@ -109,10 +92,9 @@ FetchVisitor::FetchVisitor(
const bool f,
const bool u,
const std::string & m,
- const bool n,
- const bool nm,
+ const tr1::shared_ptr<const URILabel> & n,
const bool sr) :
- PrivateImplementationPattern<FetchVisitor>(new Implementation<FetchVisitor>(e, i, p, d, f, u, m, n, nm, sr))
+ PrivateImplementationPattern<FetchVisitor>(new Implementation<FetchVisitor>(e, i, p, d, f, u, m, n, sr))
{
}
@@ -146,7 +128,9 @@ FetchVisitor::visit_sequence(const AllDepSpec &,
void
FetchVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
{
- *_imp->labels.begin() = &l;
+ for (URILabelDepSpec::ConstIterator i(l.begin()), i_end(l.end()) ;
+ i != i_end ; ++i)
+ *_imp->labels.begin() = i->get();
}
namespace
@@ -166,12 +150,10 @@ FetchVisitor::visit_leaf(const URIDepSpec & u)
if (! *_imp->labels.begin())
throw FetchActionError("No fetch action label available");
- if (1 != std::distance((*_imp->labels.begin())->begin(), (*_imp->labels.begin())->end()))
- throw FetchActionError("Fetch action label does not define exactly one behaviour");
SourceURIFinder source_uri_finder(_imp->env, _imp->id->repository().get(),
u.original_url(), u.filename(), _imp->mirrors_name);
- (*_imp->labels.begin())->begin()->accept(source_uri_finder);
+ (*_imp->labels.begin())->accept(source_uri_finder);
for (SourceURIFinder::ConstIterator i(source_uri_finder.begin()), i_end(source_uri_finder.end()) ;
i != i_end ; ++i)
{
diff --git a/paludis/repositories/e/fetch_visitor.hh b/paludis/repositories/e/fetch_visitor.hh
index 381ba16..886850b 100644
--- a/paludis/repositories/e/fetch_visitor.hh
+++ b/paludis/repositories/e/fetch_visitor.hh
@@ -47,8 +47,7 @@ namespace paludis
const bool fetch_unneeded,
const bool userpriv,
const std::string & mirrors_name,
- const bool fetch_restrict,
- const bool no_mirror,
+ const tr1::shared_ptr<const URILabel> & initial_label,
const bool safe_resume);
~FetchVisitor();
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index 12258f0..19d91ee 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/package_database.hh>
#include <paludis/query.hh>
#include <test/test_runner.hh>
@@ -55,7 +56,7 @@ namespace test_cases
FetchVisitor v(&env, *env.package_database()->query(query::Matches(PackageDepSpec("=cat/pkg-1", pds_pm_permissive)),
qo_require_exactly_one)->begin(),
*eapi, FSEntry("fetch_visitor_TEST_dir/out"),
- false, false, "test", false, false, false);
+ 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);
TEST_CHECK(FSEntry("fetch_visitor_TEST_dir/out/input1").is_regular_file());
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index 7646671..b6aee99 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/e/e_key.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 3dd6bd9..0542417 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -135,6 +135,21 @@ namespace paludis
{
}
};
+
+ template <>
+ struct Implementation<FakeMetadataSpecTreeKey<URISpecTree> >
+ {
+ tr1::shared_ptr<const URISpecTree::ConstItem> value;
+ std::string string_value;
+ const tr1::function<const tr1::shared_ptr<const URISpecTree::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) :
+ func(f),
+ initial_label(new URIListedThenMirrorsLabel("listed-then-mirrors"))
+ {
+ }
+ };
}
template <typename C_>
@@ -181,6 +196,50 @@ 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())
+{
+ set_from_string(v);
+}
+
+FakeMetadataSpecTreeKey<URISpecTree>::~FakeMetadataSpecTreeKey()
+{
+}
+
+void
+FakeMetadataSpecTreeKey<URISpecTree>::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
+{
+ return _imp->value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<URISpecTree>::pretty_print(const URISpecTree::Formatter &) const
+{
+ return _imp->string_value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<URISpecTree>::pretty_print_flat(const URISpecTree::Formatter &) const
+{
+ return _imp->string_value;
+}
+
+const tr1::shared_ptr<const URILabel>
+FakeMetadataSpecTreeKey<URISpecTree>::initial_label() const
+{
+ return _imp->initial_label;
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 20739ce..152d12f 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -105,6 +105,34 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ template <>
+ class PALUDIS_VISIBLE FakeMetadataSpecTreeKey<URISpecTree> :
+ public MetadataSpecTreeKey<URISpecTree>,
+ private PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >
+ {
+ private:
+ Implementation<FakeMetadataSpecTreeKey<URISpecTree> > * 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);
+ ~FakeMetadataSpecTreeKey();
+
+ virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void set_from_string(const std::string &);
+
+ virtual std::string pretty_print(const URISpecTree::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
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class PALUDIS_VISIBLE FakeMetadataPackageIDKey :
public MetadataPackageIDKey,
private PrivateImplementationPattern<FakeMetadataPackageIDKey>
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index c4d343e..e592e1e 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -23,10 +23,12 @@
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
#include <paludis/formatter.hh>
+#include <paludis/dep_label.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/join.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
using namespace paludis;
@@ -390,6 +392,61 @@ struct MetadataSpecTreeKeyWrapper :
}
};
+template <>
+struct MetadataSpecTreeKeyWrapper<URISpecTree> :
+ MetadataSpecTreeKey<URISpecTree>,
+ bp::wrapper<MetadataSpecTreeKey<URISpecTree> >
+{
+ MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataSpecTreeKey<URISpecTree>(r, h, t)
+ {
+ }
+
+ virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("value"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value");
+ }
+
+ virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ // todo: use the formatter
+ if (bp::override f = this->get_override("pretty_print"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print");
+ }
+
+ virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ // todo: use the formatter
+ if (bp::override f = this->get_override("pretty_print_flat"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_flat");
+ }
+
+ virtual const tr1::shared_ptr<const URILabel> initial_label() const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ // todo: override
+ return make_shared_ptr(new URIListedThenMirrorsLabel("listed-then-mirrors"));
+ }
+};
+
template <typename C_>
struct class_set_key :
bp::class_<MetadataSetKeyWrapper<C_>, tr1::shared_ptr<MetadataSetKeyWrapper<C_> >,