aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-16 19:09:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-16 19:09:18 +0000
commitd91e364ec2194766b7477cf482eedaa88d6acebc (patch)
tree479d9ac5ead34c630f0d771bdb527f54ebd8bc53
parenta71cdd3cdc1873659745b742ed1b1756c4aa2722 (diff)
downloadpaludis-d91e364ec2194766b7477cf482eedaa88d6acebc.tar.gz
paludis-d91e364ec2194766b7477cf482eedaa88d6acebc.tar.xz
Add initial_labels to the newly specialised MetadataSpecTreeKey<DependencySpecTree>. Add EAPI paludis-1 support for labels. Let FakeRepository's EAPI be overridden.
-rw-r--r--paludis/metadata_key.cc5
-rw-r--r--paludis/metadata_key.hh53
-rw-r--r--paludis/repositories/cran/cran_package_id.cc26
-rw-r--r--paludis/repositories/cran/keys.cc17
-rw-r--r--paludis/repositories/cran/keys.hh6
-rw-r--r--paludis/repositories/e/e_key.cc18
-rw-r--r--paludis/repositories/e/e_key.hh7
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf12
-rw-r--r--paludis/repositories/e/ebuild_id.cc21
-rw-r--r--paludis/repositories/e/vdb_id.cc22
-rw-r--r--paludis/repositories/fake/Makefile.am18
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc102
-rw-r--r--paludis/repositories/fake/fake_package_id.hh32
-rw-r--r--paludis/repositories/fake/fake_repository.cc29
-rw-r--r--paludis/repositories/fake/fake_repository.hh6
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc28
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc26
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc14
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc16
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.hh4
-rw-r--r--paludis/repositories/virtuals/package_id.cc30
-rw-r--r--paludis/repositories/virtuals/package_id.hh7
-rw-r--r--python/metadata_key.cc104
25 files changed, 534 insertions, 74 deletions
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 93896ce..c1f75c1 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -195,6 +195,11 @@ MetadataSpecTreeKey<FetchableURISpecTree>::MetadataSpecTreeKey(const std::string
{
}
+MetadataSpecTreeKey<DependencySpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
template class MetadataCollectionKey<KeywordNameSet>;
#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class MetadataCollectionKey<IUseFlagSet>;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 2a82199..862830a 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -553,6 +553,59 @@ namespace paludis
virtual const tr1::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+
+ /**
+ * A MetadataSpecTreeKey<DependencySpecTree> is a MetadataKey that holds
+ * a FetchableURISpecTree as its value.
+ *
+ * This specialisation of MetadataSpecTreeKey provides an additional
+ * initial_label method.
+ *
+ * \ingroup g_metadata_key
+ * \since 0.26
+ * \nosubgrouping
+ */
+ template <>
+ class PALUDIS_VISIBLE MetadataSpecTreeKey<DependencySpecTree> :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<DependencySpecTree> >
+ {
+ protected:
+ ///\name Basic operations
+ ///\{
+
+ MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ ///\}
+
+ public:
+ /**
+ * Fetch our value.
+ */
+ virtual const tr1::shared_ptr<const DependencySpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a multiline-line indented and formatted version of our
+ * value, using the supplied Formatter to format individual items.
+ */
+ virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a single-line formatted version of our value, using the
+ * supplied Formatter to format individual items.
+ */
+ virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a DependencyLabelSequence that represents the initial labels to use when
+ * deciding the behaviour of individual items in the heirarchy.
+ */
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
}
#endif
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 612f7de..e2539ca 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -37,6 +37,7 @@
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/action.hh>
+#include <paludis/dep_label.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/visitor-impl.hh>
#include <string>
@@ -72,14 +73,22 @@ namespace paludis
tr1::shared_ptr<DepKey> depends_key;
tr1::shared_ptr<DepKey> suggests_key;
+ tr1::shared_ptr<DependencyLabelSequence> suggests_labels;
+ tr1::shared_ptr<DependencyLabelSequence> depends_labels;
+
Implementation(const Environment * const e,
const tr1::shared_ptr<const CRANRepository> & r, const FSEntry & f) :
env(e),
repository(r),
cran_repository(r),
name("cran/" + cran_name_to_internal(strip_trailing_string(f.basename(), ".DESCRIPTION"))),
- version("0")
+ version("0"),
+ suggests_labels(new DependencyLabelSequence),
+ depends_labels(new DependencyLabelSequence)
{
+ suggests_labels->push_back(make_shared_ptr(new DependencySuggestedLabel("Suggests")));
+ suggests_labels->push_back(make_shared_ptr(new DependencyPostLabel("Suggests")));
+ depends_labels->push_back(make_shared_ptr(new DependencyBuildLabel("Depends")));
}
Implementation(const Environment * const e,
@@ -89,8 +98,13 @@ namespace paludis
cran_repository(c),
name("cran/" + cran_name_to_internal(t)),
version(r->version()),
- contained_in_key(new PackageIDKey("Contained", "Contained in", r, mkt_normal))
+ contained_in_key(new PackageIDKey("Contained", "Contained in", r, mkt_normal)),
+ suggests_labels(new DependencyLabelSequence),
+ depends_labels(new DependencyLabelSequence)
{
+ suggests_labels->push_back(make_shared_ptr(new DependencySuggestedLabel("Suggests")));
+ suggests_labels->push_back(make_shared_ptr(new DependencyPostLabel("Suggests")));
+ depends_labels->push_back(make_shared_ptr(new DependencyBuildLabel("Depends")));
}
};
}
@@ -229,7 +243,8 @@ CRANPackageID::CRANPackageID(const Environment * const env, const tr1::shared_pt
if (! file.get("Suggests").empty())
{
Context local_context("When handling Suggests: key:");
- _imp->suggests_key.reset(new DepKey(_imp->env, "Suggests", "Suggests", file.get("Suggests"), mkt_dependencies));
+ _imp->suggests_key.reset(new DepKey(_imp->env, "Suggests", "Suggests", file.get("Suggests"),
+ _imp->suggests_labels, mkt_dependencies));
add_metadata_key(_imp->suggests_key);
}
@@ -243,10 +258,11 @@ CRANPackageID::CRANPackageID(const Environment * const env, const tr1::shared_pt
if (! file.get("Depends").empty())
{
Context local_context("When handling Depends: key:");
- _imp->depends_key.reset(new DepKey(_imp->env, "Depends", "Depends", file.get("Depends") + ", R", mkt_dependencies));
+ _imp->depends_key.reset(new DepKey(_imp->env, "Depends", "Depends", file.get("Depends") + ", R",
+ _imp->depends_labels, mkt_dependencies));
}
else
- _imp->depends_key.reset(new DepKey(_imp->env, "Depends", "Depends", "R", mkt_dependencies));
+ _imp->depends_key.reset(new DepKey(_imp->env, "Depends", "Depends", "R", _imp->depends_labels, mkt_dependencies));
add_metadata_key(_imp->depends_key);
}
catch (const Exception & e)
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index a195802..68c83b3 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -88,19 +88,22 @@ namespace paludis
mutable Mutex mutex;
mutable tr1::shared_ptr<const DependencySpecTree::ConstItem> c;
+ const tr1::shared_ptr<const DependencyLabelSequence> labels;
- Implementation(const Environment * const e, const std::string & vv) :
+ Implementation(const Environment * const e, const std::string & vv,
+ const tr1::shared_ptr<const DependencyLabelSequence> & s) :
env(e),
- v(vv)
+ v(vv),
+ labels(s)
{
}
};
}
DepKey::DepKey(const Environment * const e, const std::string & r, const std::string & h, const std::string & v,
- const MetadataKeyType t) :
+ const tr1::shared_ptr<const DependencyLabelSequence> & s, const MetadataKeyType t) :
MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<DepKey>(new Implementation<DepKey>(e, v)),
+ PrivateImplementationPattern<DepKey>(new Implementation<DepKey>(e, v, s)),
_imp(PrivateImplementationPattern<DepKey>::_imp)
{
}
@@ -139,3 +142,9 @@ DepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
return stringify(p);
}
+const tr1::shared_ptr<const DependencyLabelSequence>
+DepKey::initial_labels() const
+{
+ return _imp->labels;
+}
+
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index a77d39c..3c5b211 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -73,7 +73,8 @@ namespace paludis
public:
DepKey(const Environment * const,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ const std::string &, const std::string &, const std::string &,
+ const tr1::shared_ptr<const DependencyLabelSequence> &, const MetadataKeyType);
~DepKey();
@@ -85,6 +86,9 @@ namespace paludis
virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 876e7d6..1910eac 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -84,13 +84,16 @@ namespace paludis
mutable Mutex value_mutex;
mutable tr1::shared_ptr<const DependencySpecTree::ConstItem> value;
mutable tr1::function<void () throw ()> value_used;
+ const tr1::shared_ptr<const DependencyLabelSequence> labels;
Implementation(
const Environment * const e,
- const tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const tr1::shared_ptr<const DependencyLabelSequence> & s) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ labels(s)
{
}
};
@@ -99,9 +102,10 @@ namespace paludis
EDependenciesKey::EDependenciesKey(
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) :
+ const std::string & r, const std::string & h, const std::string & v,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l, const MetadataKeyType t) :
MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<EDependenciesKey>(new Implementation<EDependenciesKey>(e, id, v)),
+ PrivateImplementationPattern<EDependenciesKey>(new Implementation<EDependenciesKey>(e, id, v, l)),
_imp(PrivateImplementationPattern<EDependenciesKey>::_imp)
{
}
@@ -129,6 +133,12 @@ EDependenciesKey::value() const
return _imp->value;
}
+const tr1::shared_ptr<const DependencyLabelSequence>
+EDependenciesKey::initial_labels() const
+{
+ return _imp->labels;
+}
+
std::string
EDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index b6af486..aee28d8 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -58,7 +58,9 @@ namespace paludis
EDependenciesKey(
const Environment * const,
const tr1::shared_ptr<const ERepositoryID> &,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ const std::string &, const std::string &, const std::string &,
+ const tr1::shared_ptr<const DependencyLabelSequence> &,
+ const MetadataKeyType);
~EDependenciesKey();
virtual const tr1::shared_ptr<const DependencySpecTree::ConstItem> value() const
@@ -69,6 +71,9 @@ namespace paludis
virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EFetchableURIKey :
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 9d70c64..41c741a 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -153,6 +153,18 @@ uri_labels = \
default-restrict-fetch = URIManualOnlyLabel ; \
default-restrict-mirror = URILocalMirrorsOnlyLabel
+dependency_labels = \
+ host = DependencyHostLabel ; \
+ target = DependencyTargetLabel ; \
+ build = DependencyBuildLabel ; \
+ run = DependencyRunLabel ; \
+ install = DependencyInstallLabel ; \
+ compile-against = DependencyCompileLabel ; \
+ suggested = DependencySuggestedLabel ; \
+ recommended = DependencyRecommendedLabel ; \
+ required = DependencyRequiredLabel ; \
+ @ = DependencyABILabel
+
restrict_mirror = mirror
restrict_fetch = fetch
restrict_primaryuri =
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index a77de43..0ea7897 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -99,6 +99,10 @@ namespace paludis
mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> repository_mask;
mutable tr1::shared_ptr<EMutableRepositoryMaskInfoKey> profile_mask;
+ tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
+
Implementation(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
const tr1::shared_ptr<const ERepository> r, const FSEntry & f, const std::string & g,
@@ -112,8 +116,14 @@ namespace paludis
master_mtime(t),
eclass_mtimes(m),
has_keys(false),
- has_masks(false)
+ has_masks(false),
+ build_dependencies_labels(new DependencyLabelSequence),
+ run_dependencies_labels(new DependencyLabelSequence),
+ post_dependencies_labels(new DependencyLabelSequence)
{
+ build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
+ run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
+ post_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("PDEPEND")));
}
};
}
@@ -647,7 +657,8 @@ void
EbuildID::load_build_depend(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
+ _imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
+ _imp->build_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->build_dependencies);
}
@@ -655,7 +666,8 @@ void
EbuildID::load_run_depend(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->run_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
+ _imp->run_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
+ _imp->run_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->run_dependencies);
}
@@ -663,7 +675,8 @@ void
EbuildID::load_post_depend(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->post_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
+ _imp->post_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
+ _imp->post_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->post_dependencies);
}
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index b7bc794..d4371f0 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -36,6 +36,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/literal_metadata_key.hh>
#include <iterator>
#include <fstream>
@@ -101,6 +102,10 @@ namespace paludis
tr1::shared_ptr<const MetadataStringKey> pkgmanager;
tr1::shared_ptr<const MetadataStringKey> vdb_format;
+ tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
+
Implementation(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
const tr1::shared_ptr<const Repository> r, const FSEntry & f) :
@@ -109,8 +114,14 @@ namespace paludis
environment(e),
repository(r),
dir(f),
- has_keys(false)
+ has_keys(false),
+ build_dependencies_labels(new DependencyLabelSequence),
+ run_dependencies_labels(new DependencyLabelSequence),
+ post_dependencies_labels(new DependencyLabelSequence)
{
+ build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
+ run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
+ post_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("PDEPEND")));
}
};
}
@@ -207,7 +218,8 @@ VDBID::need_keys_added() const
if ((_imp->dir / vars->metadata_build_depend).exists())
{
_imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->metadata_build_depend,
- vars->description_build_depend, file_contents(_imp->dir / vars->metadata_build_depend), mkt_dependencies));
+ vars->description_build_depend, file_contents(_imp->dir / vars->metadata_build_depend),
+ _imp->build_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->build_dependencies);
}
@@ -215,7 +227,8 @@ VDBID::need_keys_added() const
if ((_imp->dir / vars->metadata_run_depend).exists())
{
_imp->run_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->metadata_run_depend,
- vars->description_run_depend, file_contents(_imp->dir / vars->metadata_run_depend), mkt_dependencies));
+ vars->description_run_depend, file_contents(_imp->dir / vars->metadata_run_depend),
+ _imp->run_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->run_dependencies);
}
@@ -223,7 +236,8 @@ VDBID::need_keys_added() const
if ((_imp->dir / vars->metadata_pdepend).exists())
{
_imp->post_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->metadata_pdepend,
- vars->description_pdepend, file_contents(_imp->dir / vars->metadata_pdepend), mkt_dependencies));
+ vars->description_pdepend, file_contents(_imp->dir / vars->metadata_pdepend),
+ _imp->post_dependencies_labels, mkt_dependencies));
add_metadata_key(_imp->post_dependencies);
}
diff --git a/paludis/repositories/fake/Makefile.am b/paludis/repositories/fake/Makefile.am
index 9edf162..115d855 100644
--- a/paludis/repositories/fake/Makefile.am
+++ b/paludis/repositories/fake/Makefile.am
@@ -27,7 +27,9 @@ check_PROGRAMS = $(TESTS)
EXTRA_DIST = \
fake_repository_TEST.cc \
- fake_installed_repository_TEST.cc
+ fake_installed_repository_TEST.cc \
+ fake_repository-sr.hh \
+ fake_repository-sr.cc
fake_repository_TEST_LDADD = \
libpaludisfakerepository.la \
@@ -73,7 +75,18 @@ paludis_repositories_fake_include_HEADERS = \
fake_repository.hh \
fake_repository_base.hh \
fake_installed_repository.hh \
- fake_package_id.hh
+ fake_package_id.hh \
+ fake_repository-sr.hh
+
+BUILT_SOURCES = \
+ fake_repository-sr.hh \
+ fake_repository-sr.cc
+
+fake_repository-sr.hh : fake_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/fake_repository.sr > $@
+
+fake_repository-sr.cc : fake_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/fake_repository.sr > $@
built-sources : $(BUILT_SOURCES)
for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
@@ -85,3 +98,4 @@ distcheck-deps : distcheck-deps-subdirs
distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index ba31ae5..1d1f86c 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -67,7 +67,8 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
.make_virtuals_interface(0)
.qa_interface(0)
.hook_interface(0)
- .manifest_interface(0)),
+ .manifest_interface(0),
+ "0"),
PrivateImplementationPattern<FakeInstalledRepository>(new Implementation<FakeInstalledRepository>),
_imp(PrivateImplementationPattern<FakeInstalledRepository>::_imp)
{
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index ede593c..8cc5ad3 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -152,6 +152,22 @@ namespace paludis
{
}
};
+
+ template <>
+ struct Implementation<FakeMetadataSpecTreeKey<DependencySpecTree> >
+ {
+ tr1::shared_ptr<const DependencySpecTree::ConstItem> value;
+ std::string string_value;
+ const tr1::function<const tr1::shared_ptr<const DependencySpecTree::ConstItem> (const std::string &)> func;
+ tr1::shared_ptr<const DependencyLabelSequence> labels;
+
+ Implementation(const tr1::function<const tr1::shared_ptr<const DependencySpecTree::ConstItem> (const std::string &)> & f,
+ const tr1::shared_ptr<const DependencyLabelSequence> & s) :
+ func(f),
+ labels(s)
+ {
+ }
+ };
}
template <typename C_>
@@ -243,6 +259,52 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::initial_label() const
return _imp->initial_label;
}
+FakeMetadataSpecTreeKey<DependencySpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
+ const tr1::function<const tr1::shared_ptr<const DependencySpecTree::ConstItem> (const std::string &)> & f,
+ const tr1::shared_ptr<const DependencyLabelSequence> & s, const MetadataKeyType t) :
+ MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
+ PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >(
+ new Implementation<FakeMetadataSpecTreeKey<DependencySpecTree> >(f, s)),
+ _imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >::_imp)
+{
+ set_from_string(v);
+}
+
+FakeMetadataSpecTreeKey<DependencySpecTree>::~FakeMetadataSpecTreeKey()
+{
+}
+
+void
+FakeMetadataSpecTreeKey<DependencySpecTree>::set_from_string(const std::string & s)
+{
+ _imp->string_value = s;
+ _imp->value = _imp->func(s);
+}
+
+const tr1::shared_ptr<const DependencySpecTree::ConstItem>
+FakeMetadataSpecTreeKey<DependencySpecTree>::value() const
+{
+ return _imp->value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print(const DependencySpecTree::ItemFormatter &) const
+{
+ return _imp->string_value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
+{
+ return _imp->string_value;
+}
+
+const tr1::shared_ptr<const DependencyLabelSequence>
+FakeMetadataSpecTreeKey<DependencySpecTree>::initial_labels() const
+{
+ return _imp->labels;
+}
+
namespace paludis
{
template <>
@@ -303,6 +365,11 @@ namespace paludis
const VersionSpec version;
SlotName slot;
+ tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> suggested_dependencies_labels;
+
tr1::shared_ptr<LiteralMetadataPackageIDKey> package_id;
tr1::shared_ptr<LiteralMetadataPackageIDKey> virtual_for;
tr1::shared_ptr<FakeMetadataKeywordSetKey> keywords;
@@ -320,44 +387,58 @@ namespace paludis
mutable bool has_masks;
Implementation(const Environment * const e, const tr1::shared_ptr<const FakeRepositoryBase> & r,
- const QualifiedPackageName & q, const VersionSpec & v, const PackageID * const id) :
+ const QualifiedPackageName & q, const VersionSpec & v, const PackageID * const id,
+ const std::string & eapi) :
env(e),
repository(r),
name(q),
version(v),
slot("0"),
+ build_dependencies_labels(new DependencyLabelSequence),
+ run_dependencies_labels(new DependencyLabelSequence),
+ post_dependencies_labels(new DependencyLabelSequence),
+ suggested_dependencies_labels(new DependencyLabelSequence),
keywords(new FakeMetadataKeywordSetKey("KEYWORDS", "Keywords", "test", mkt_normal, id, env)),
iuse(new FakeMetadataIUseSetKey("IUSE", "Used USE flags", "", iuse_pm_permissive, mkt_normal, id, env)),
license(new FakeMetadataSpecTreeKey<LicenseSpecTree>("LICENSE", "Licenses",
"", tr1::bind(&erepository::parse_license, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_normal)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)), mkt_normal)),
provide(new FakeMetadataSpecTreeKey<ProvideSpecTree>("PROVIDE", "Provided packages",
"", tr1::bind(&erepository::parse_provide, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_normal)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)), mkt_normal)),
build_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("DEPEND", "Build dependencies",
"", tr1::bind(&erepository::parse_depend, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)),
+ build_dependencies_labels, mkt_dependencies)),
run_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("RDEPEND", "Run dependencies",
"", tr1::bind(&erepository::parse_depend, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)),
+ run_dependencies_labels, mkt_dependencies)),
post_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("PDEPEND", "Post dependencies",
"", tr1::bind(&erepository::parse_depend, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)),
+ post_dependencies_labels, mkt_dependencies)),
suggested_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("SDEPEND", "Suggested dependencies",
"", tr1::bind(&erepository::parse_depend, _1,
- *erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)),
+ suggested_dependencies_labels, mkt_dependencies)),
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)),
+ *erepository::EAPIData::get_instance()->eapi_from_string(eapi)), mkt_dependencies)),
has_masks(false)
{
+ build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
+ run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
+ post_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("PDEPEND")));
+ suggested_dependencies_labels->push_back(make_shared_ptr(new DependencySuggestedLabel("SDEPEND")));
+ suggested_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("SDEPEND")));
}
};
}
FakePackageID::FakePackageID(const Environment * const e, const tr1::shared_ptr<const FakeRepositoryBase> & r,
- const QualifiedPackageName & q, const VersionSpec & v) :
- PrivateImplementationPattern<FakePackageID>(new Implementation<FakePackageID>(e, r, q, v, this)),
+ const QualifiedPackageName & q, const VersionSpec & v, const std::string & eapi) :
+ PrivateImplementationPattern<FakePackageID>(new Implementation<FakePackageID>(e, r, q, v, this, eapi)),
_imp(PrivateImplementationPattern<FakePackageID>::_imp)
{
add_metadata_key(_imp->keywords);
@@ -908,6 +989,7 @@ template class FakeMetadataSpecTreeKey<DependencySpecTree>;
template class FakeMetadataSpecTreeKey<RestrictSpecTree>;
#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class FakeMetadataSpecTreeKey<FetchableURISpecTree>;
+template class FakeMetadataSpecTreeKey<DependencySpecTree>;
#endif
template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 71a63d8..ccee19a 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -134,6 +134,36 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ template <>
+ class PALUDIS_VISIBLE FakeMetadataSpecTreeKey<DependencySpecTree> :
+ public MetadataSpecTreeKey<DependencySpecTree>,
+ private PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >
+ {
+ private:
+ PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >::ImpPtr & _imp;
+
+ public:
+ FakeMetadataSpecTreeKey(const std::string &, const std::string &, const std::string &,
+ const tr1::function<const tr1::shared_ptr<const DependencySpecTree::ConstItem> (const std::string &)> &,
+ const tr1::shared_ptr<const DependencyLabelSequence> &,
+ const MetadataKeyType);
+ ~FakeMetadataSpecTreeKey();
+
+ virtual const tr1::shared_ptr<const DependencySpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void set_from_string(const std::string &);
+
+ virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class PALUDIS_VISIBLE FakeUnacceptedMask :
public UnacceptedMask,
private PrivateImplementationPattern<FakeUnacceptedMask>
@@ -161,7 +191,7 @@ namespace paludis
public:
FakePackageID(const Environment * const e,
const tr1::shared_ptr<const FakeRepositoryBase> &,
- const QualifiedPackageName &, const VersionSpec &);
+ const QualifiedPackageName &, const VersionSpec &, const std::string & eapi);
~FakePackageID();
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 49c733f..477f7eb 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -34,6 +34,8 @@
using namespace paludis;
+#include <paludis/repositories/fake/fake_repository-sr.cc>
+
namespace paludis
{
template<>
@@ -72,7 +74,32 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
.make_virtuals_interface(0)
.qa_interface(0)
.hook_interface(0)
- .manifest_interface(0)),
+ .manifest_interface(0),
+ "0"),
+ _imp(PrivateImplementationPattern<FakeRepository>::_imp)
+{
+ add_metadata_key(_imp->format_key);
+}
+
+FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
+ PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>),
+ FakeRepositoryBase(params.environment, params.name, RepositoryCapabilities::create()
+ .sets_interface(this)
+ .syncable_interface(0)
+ .use_interface(this)
+ .world_interface(0)
+ .mirrors_interface(this)
+ .environment_variable_interface(0)
+ .provides_interface(0)
+ .virtuals_interface(DistributionData::get_instance()->distribution_from_string(
+ params.environment->default_distribution())->support_old_style_virtuals ? this : 0)
+ .destination_interface(0)
+ .e_interface(0)
+ .make_virtuals_interface(0)
+ .qa_interface(0)
+ .hook_interface(0)
+ .manifest_interface(0),
+ params.eapi),
_imp(PrivateImplementationPattern<FakeRepository>::_imp)
{
add_metadata_key(_imp->format_key);
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index efdc61a..65ff6da 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -24,6 +24,8 @@
namespace paludis
{
+#include <paludis/repositories/fake/fake_repository-sr.hh>
+
/**
* Fake repository for use in test cases.
*
@@ -45,6 +47,10 @@ namespace paludis
FakeRepository(const Environment * const, const RepositoryName &);
~FakeRepository();
+ ///\since 0.26
+ FakeRepository(const FakeRepositoryParams &);
+
+
///\}
/**
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index e2d0ba1..082781c 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -39,45 +39,35 @@ using namespace paludis;
namespace paludis
{
- /**
- * Implementation data for FakeRepositoryBase.
- *
- * \ingroup grpfakerepository
- */
template<>
struct Implementation<FakeRepositoryBase> :
private InstantiationPolicy<Implementation<FakeRepositoryBase>, instantiation_method::NonCopyableTag>
{
- /// Our category names.
tr1::shared_ptr<CategoryNamePartSet> category_names;
-
- /// Our package names.
std::map<CategoryNamePart, tr1::shared_ptr<PackageNamePartSet> > package_names;
-
- /// Our IDs.
std::map<QualifiedPackageName, tr1::shared_ptr<PackageIDSequence> > ids;
-
- /// Our sets.
std::map<SetName, tr1::shared_ptr<SetSpecTree::ConstItem> > sets;
const Environment * const env;
+ const std::string eapi;
- /// Constructor.
- Implementation(const Environment * const);
+ Implementation(const Environment * const, const std::string & ea);
};
- Implementation<FakeRepositoryBase>::Implementation(const Environment * const e) :
+ Implementation<FakeRepositoryBase>::Implementation(const Environment * const e, const std::string & ea) :
category_names(new CategoryNamePartSet),
- env(e)
+ env(e),
+ eapi(ea)
{
}
}
FakeRepositoryBase::FakeRepositoryBase(const Environment * const e,
- const RepositoryName & our_name, const RepositoryCapabilities & caps) :
+ const RepositoryName & our_name, const RepositoryCapabilities & caps,
+ const std::string & eapi) :
Repository(our_name, caps),
RepositoryUseInterface(),
- PrivateImplementationPattern<FakeRepositoryBase>(new Implementation<FakeRepositoryBase>(e)),
+ PrivateImplementationPattern<FakeRepositoryBase>(new Implementation<FakeRepositoryBase>(e, eapi)),
_imp(PrivateImplementationPattern<FakeRepositoryBase>::_imp)
{
}
@@ -149,7 +139,7 @@ tr1::shared_ptr<FakePackageID>
FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpec & v)
{
add_package(q);
- tr1::shared_ptr<FakePackageID> id(new FakePackageID(_imp->env, shared_from_this(), q, v));
+ tr1::shared_ptr<FakePackageID> id(new FakePackageID(_imp->env, shared_from_this(), q, v, _imp->eapi));
_imp->ids.find(q)->second->push_back(id);
return id;
}
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index eaf20f9..ff64703 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -57,7 +57,7 @@ namespace paludis
* Constructor.
*/
FakeRepositoryBase(const Environment * const env, const RepositoryName & name,
- const RepositoryCapabilities & caps);
+ const RepositoryCapabilities & caps, const std::string & eapi);
virtual void need_keys_added() const;
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 5b13f35..178e18b 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -175,13 +175,16 @@ namespace
mutable tr1::shared_ptr<const DependencySpecTree::ConstItem> _v;
mutable Mutex _mutex;
const FSEntry _f;
+ const tr1::shared_ptr<const DependencyLabelSequence> _labels;
public:
InstalledUnpackagedDependencyKey(const Environment * const e,
- const std::string & r, const std::string & h, const FSEntry & f, const MetadataKeyType t) :
+ const std::string & r, const std::string & h, const FSEntry & f,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l, const MetadataKeyType t) :
MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
_env(e),
- _f(f)
+ _f(f),
+ _labels(l)
{
}
@@ -217,6 +220,11 @@ namespace
value()->accept(p);
return p.result();
}
+
+ const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ {
+ return _labels;
+ }
};
}
@@ -233,6 +241,9 @@ namespace paludis
const FSEntry root;
const NDBAM * const ndbam;
+ tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+
tr1::shared_ptr<InstalledUnpackagedFSEntryKey> fs_location_key;
tr1::shared_ptr<InstalledUnpackagedContentsKey> contents_key;
tr1::shared_ptr<InstalledUnpackagedTimeKey> installed_time_key;
@@ -259,8 +270,13 @@ namespace paludis
repository_name(r),
root(ro),
ndbam(d),
+ build_dependencies_labels(new DependencyLabelSequence),
+ run_dependencies_labels(new DependencyLabelSequence),
fs_location_key(new InstalledUnpackagedFSEntryKey(l))
{
+ build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build_dependencies")));
+ run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("run_dependencies")));
+
if ((l / "contents").exists())
{
contents_key.reset(new InstalledUnpackagedContentsKey(id, d));
@@ -280,11 +296,13 @@ namespace paludis
if ((l / "build_dependencies").exists())
build_dependencies_key.reset(new InstalledUnpackagedDependencyKey(env,
- "build_dependencies", "Build dependencies", l / "build_dependencies", mkt_dependencies));
+ "build_dependencies", "Build dependencies", l / "build_dependencies",
+ build_dependencies_labels, mkt_dependencies));
if ((l / "run_dependencies").exists())
run_dependencies_key.reset(new InstalledUnpackagedDependencyKey(env,
- "run_dependencies", "Run dependencies", l / "run_dependencies", mkt_dependencies));
+ "run_dependencies", "Run dependencies", l / "run_dependencies",
+ run_dependencies_labels, mkt_dependencies));
}
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 6db6f9f..427405b 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -26,6 +26,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_database.hh>
@@ -49,6 +50,9 @@ namespace paludis
const SlotName slot;
const RepositoryName repository_name;
+ tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
+ tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
+
const tr1::shared_ptr<LiteralMetadataFSEntryKey> fs_location_key;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key;
@@ -68,11 +72,17 @@ namespace paludis
version(v),
slot(s),
repository_name(n),
+ build_dependencies_labels(new DependencyLabelSequence),
+ run_dependencies_labels(new DependencyLabelSequence),
fs_location_key(new LiteralMetadataFSEntryKey("location", "Location", mkt_normal, l)),
- build_dependencies_key(new UnpackagedDependencyKey(env, "build_dependencies", "Build dependencies", mkt_dependencies, b)),
- run_dependencies_key(new UnpackagedDependencyKey(env, "run_dependencies", "Run dependencies", mkt_dependencies, r)),
+ build_dependencies_key(new UnpackagedDependencyKey(env, "build_dependencies", "Build dependencies", mkt_dependencies,
+ build_dependencies_labels, b)),
+ run_dependencies_key(new UnpackagedDependencyKey(env, "run_dependencies", "Run dependencies", mkt_dependencies,
+ run_dependencies_labels, r)),
description_key(new LiteralMetadataStringKey("description", "Description", mkt_significant, d))
{
+ build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build_dependencies")));
+ run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("run_dependencies")));
}
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 921186c..ae0e2bf 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -33,10 +33,13 @@ namespace paludis
{
const Environment * const env;
const tr1::shared_ptr<const DependencySpecTree::ConstItem> value;
+ const tr1::shared_ptr<const DependencyLabelSequence> labels;
- Implementation(const Environment * const e, const std::string & v) :
+ Implementation(const Environment * const e, const std::string & v,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l) :
env(e),
- value(DepParser::parse(v))
+ value(DepParser::parse(v)),
+ labels(l)
{
}
};
@@ -44,9 +47,10 @@ namespace paludis
UnpackagedDependencyKey::UnpackagedDependencyKey(const Environment * const env,
const std::string & r, const std::string & h, const MetadataKeyType t,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l,
const std::string & v) :
MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<UnpackagedDependencyKey>(new Implementation<UnpackagedDependencyKey>(env, v)),
+ PrivateImplementationPattern<UnpackagedDependencyKey>(new Implementation<UnpackagedDependencyKey>(env, v, l)),
_imp(PrivateImplementationPattern<UnpackagedDependencyKey>::_imp)
{
}
@@ -77,3 +81,9 @@ UnpackagedDependencyKey::pretty_print_flat(const DependencySpecTree::ItemFormatt
return p.result();
}
+const tr1::shared_ptr<const DependencyLabelSequence>
+UnpackagedDependencyKey::initial_labels() const
+{
+ return _imp->labels;
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh
index 65c2c9d..c20e60a 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.hh
+++ b/paludis/repositories/unpackaged/unpackaged_key.hh
@@ -37,6 +37,7 @@ namespace paludis
public:
UnpackagedDependencyKey(const Environment * const env,
const std::string & r, const std::string & h, const MetadataKeyType t,
+ const tr1::shared_ptr<const DependencyLabelSequence> &,
const std::string & v);
~UnpackagedDependencyKey();
@@ -45,6 +46,9 @@ namespace paludis
std::string pretty_print(const DependencySpecTree::ItemFormatter & f) const;
std::string pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const;
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index dcfca2b..6304423 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -49,8 +49,11 @@ namespace paludis
{
const Environment * const env;
const tr1::shared_ptr<const TreeLeaf<DependencySpecTree, PackageDepSpec> > value;
+ const tr1::shared_ptr<const DependencyLabelSequence> labels;
- Implementation(const Environment * const e, const tr1::shared_ptr<const PackageID> & v, bool exact) :
+ Implementation(const Environment * const e, const tr1::shared_ptr<const PackageID> & v,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l,
+ bool exact) :
env(e),
value(exact ?
new TreeLeaf<DependencySpecTree, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(
@@ -64,16 +67,19 @@ namespace paludis
make_package_dep_spec()
.package(v->name())
)))
- )
+ ),
+ labels(l)
{
}
};
}
VirtualsDepKey::VirtualsDepKey(const Environment * const e, const std::string & r, const std::string & h,
- const tr1::shared_ptr<const PackageID> & v, const bool exact) :
+ const tr1::shared_ptr<const PackageID> & v,
+ const tr1::shared_ptr<const DependencyLabelSequence> & l,
+ const bool exact) :
MetadataSpecTreeKey<DependencySpecTree>(r, h, mkt_dependencies),
- PrivateImplementationPattern<VirtualsDepKey>(new Implementation<VirtualsDepKey>(e, v, exact)),
+ PrivateImplementationPattern<VirtualsDepKey>(new Implementation<VirtualsDepKey>(e, v, l, exact)),
_imp(PrivateImplementationPattern<VirtualsDepKey>::_imp)
{
}
@@ -124,6 +130,12 @@ VirtualsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) c
return f.format(*_imp->value->item(), format::Plain());
}
+const tr1::shared_ptr<const DependencyLabelSequence>
+VirtualsDepKey::initial_labels() const
+{
+ return _imp->labels;
+}
+
namespace paludis
{
template <>
@@ -133,6 +145,8 @@ namespace paludis
const tr1::shared_ptr<const Repository> repository;
const QualifiedPackageName name;
const VersionSpec version;
+ tr1::shared_ptr<DependencyLabelSequence> bdep_labels;
+ tr1::shared_ptr<DependencyLabelSequence> rdep_labels;
const tr1::shared_ptr<const MetadataPackageIDKey> virtual_for;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > bdep;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > rdep;
@@ -149,11 +163,15 @@ namespace paludis
repository(o),
name(n),
version(p->version()),
+ bdep_labels(new DependencyLabelSequence),
+ rdep_labels(new DependencyLabelSequence),
virtual_for(new LiteralMetadataPackageIDKey("VIRTUAL_FOR", "Virtual for", mkt_normal, p)),
- bdep(new virtuals::VirtualsDepKey(e, "DEPEND", "Build dependencies", p, b)),
- rdep(new virtuals::VirtualsDepKey(e, "RDEPEND", "Run dependencies", p, b)),
+ bdep(new virtuals::VirtualsDepKey(e, "DEPEND", "Build dependencies", p, bdep_labels, b)),
+ rdep(new virtuals::VirtualsDepKey(e, "RDEPEND", "Run dependencies", p, rdep_labels, b)),
has_masks(false)
{
+ bdep_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
+ rdep_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
}
};
}
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index b60bfc0..fe33c8c 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -37,7 +37,9 @@ namespace paludis
public:
VirtualsDepKey(const Environment * const, const std::string &, const std::string &,
- const tr1::shared_ptr<const PackageID> &, const bool);
+ const tr1::shared_ptr<const PackageID> &,
+ const tr1::shared_ptr<const DependencyLabelSequence> &,
+ const bool);
~VirtualsDepKey();
virtual const tr1::shared_ptr<const DependencySpecTree::ConstItem> value() const
@@ -48,6 +50,9 @@ namespace paludis
virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
class VirtualsPackageID :
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index abbcd78..8902fb3 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -508,6 +508,61 @@ struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> :
}
};
+template <>
+struct MetadataSpecTreeKeyWrapper<DependencySpecTree> :
+ MetadataSpecTreeKey<DependencySpecTree>,
+ bp::wrapper<MetadataSpecTreeKey<DependencySpecTree> >
+{
+ MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataSpecTreeKey<DependencySpecTree>(r, h, t)
+ {
+ }
+
+ virtual const tr1::shared_ptr<const DependencySpecTree::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 DependencySpecTree::ItemFormatter & formatter) const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("pretty_print"))
+ return f(boost::cref(formatter));
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print");
+ }
+
+ virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter & formatter) const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("pretty_print_flat"))
+ return f(boost::cref(formatter));
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_flat");
+ }
+
+ virtual const tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
+ PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("initial_labels"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "initial_labels");
+ }
+};
+
template <typename C_>
struct class_set_key :
bp::class_<MetadataCollectionKeyWrapper<C_>, tr1::shared_ptr<MetadataCollectionKeyWrapper<C_> >,
@@ -677,6 +732,55 @@ struct class_spec_tree_key<FetchableURISpecTree> :
}
};
+template <>
+struct class_spec_tree_key<DependencySpecTree> :
+ bp::class_<MetadataSpecTreeKeyWrapper<DependencySpecTree>,
+ tr1::shared_ptr<MetadataSpecTreeKeyWrapper<DependencySpecTree> >,
+ bp::bases<MetadataKey>, boost::noncopyable>
+{
+ class_spec_tree_key(const std::string & spec_tree) :
+ bp::class_<MetadataSpecTreeKeyWrapper<DependencySpecTree>,
+ tr1::shared_ptr<MetadataSpecTreeKeyWrapper<DependencySpecTree> >,
+ bp::bases<MetadataKey>, boost::noncopyable>(
+ ("Metadata" + spec_tree + "Key").c_str(),
+ "A MetadataSpecTreeKey is a MetadataKey that holds a spec tree of some\n"
+ "kind as its value.\n\n"
+
+ "This class can be subclassed in Python.",
+ bp::init<const std::string &, const std::string &, MetadataKeyType>(
+ "__init__(raw_name, human_name, MetadataKeyType)"
+ )
+ )
+ {
+ bp::register_ptr_to_python<tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > >();
+ bp::implicitly_convertible<tr1::shared_ptr<MetadataSpecTreeKeyWrapper<DependencySpecTree> >,
+ tr1::shared_ptr<MetadataKey> >();
+
+ def("value", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::value),
+ ("value() -> " + spec_tree + "\n"
+ "Fetch our value").c_str()
+ );
+
+ def("pretty_print", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::pretty_print),
+ ("pretty_print(" + spec_tree + "Formatter) -> string\n"
+ "Return a multiline-line indented and formatted version of our\n"
+ "value, using the supplied Formatter to format individual items.").c_str()
+ );
+
+ def("pretty_print_flat", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::pretty_print_flat),
+ ("pretty_print_flat(" + spec_tree + "Formatter) -> string\n"
+ "Return a single-line formatted version of our value, using the\n"
+ "supplied Formatter to format individual items.").c_str()
+ );
+
+ def("initial_labels", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::initial_labels),
+ "initial_label() -> DependencyLabelSequence\n"
+ "Return a DependencyLabelSequence that represents the initial labels to use when\n"
+ "deciding the behaviour of individual items in the heirarchy."
+ );
+ }
+};
+
void expose_metadata_key()
{
/**