aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-26 17:13:55 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-26 17:13:55 +0000
commitb0a4d48400c9efb461d8655424db98f8c930bad6 (patch)
tree47dcb674e03050ffc55ad09b67dfe9fc23828969
parent11f790d46039a5ec4817307dd6877aa4b83761c8 (diff)
downloadpaludis-b0a4d48400c9efb461d8655424db98f8c930bad6.tar.gz
paludis-b0a4d48400c9efb461d8655424db98f8c930bad6.tar.xz
Make license_key and inherited_key available in ERepositoryID.
-rw-r--r--paludis/repositories/e/e_repository_id.hh2
-rw-r--r--paludis/repositories/e/qa/inherited_key.cc22
-rw-r--r--paludis/repositories/e/qa/inherited_key.hh2
-rw-r--r--paludis/repositories/e/vdb_id.cc7
-rw-r--r--paludis/repositories/e/vdb_id.hh3
5 files changed, 20 insertions, 16 deletions
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index d3682ca..d75921f 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.hh
@@ -32,6 +32,8 @@ namespace paludis
{
public:
virtual const tr1::shared_ptr<const EAPI> eapi() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const = 0;
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const = 0;
virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const = 0;
virtual const tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > eclass_keywords_key() const = 0;
diff --git a/paludis/repositories/e/qa/inherited_key.cc b/paludis/repositories/e/qa/inherited_key.cc
index 481108f..05518b7 100644
--- a/paludis/repositories/e/qa/inherited_key.cc
+++ b/paludis/repositories/e/qa/inherited_key.cc
@@ -66,39 +66,33 @@ bool
paludis::erepository::inherited_key_check(
const FSEntry & entry,
QAReporter & reporter,
- const tr1::shared_ptr<const PackageID> & id,
+ const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
{
Context context("When performing check '" + name + "' using inherited_key_check on ID '" + stringify(*id) + "':");
Log::get_instance()->message(ll_debug, lc_context) << "inherited_key_check '"
<< entry << "', " << *id << "', " << name << "'";
- if (id->end_metadata() != id->find_metadata("INHERITED"))
+ if (id->inherited_key())
{
try
{
- tr1::shared_ptr<const MetadataKey> key_sptr(*id->find_metadata("INHERITED"));
- const MetadataCollectionKey<Set<std::string> > * key(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(*key_sptr));
- if (! key)
- throw InternalError(PALUDIS_HERE, "'" + key->raw_name() + "' key for '" + stringify(*id) + "' is of the wrong type");
-
const std::set<std::string> & inherited_blacklist(InheritedBlacklist::get_instance()->inherited_blacklist);
- for (Set<std::string>::ConstIterator it(key->value()->begin()),
- it_end(key->value()->end()); it_end != it; ++it)
+ for (Set<std::string>::ConstIterator it(id->inherited_key()->value()->begin()),
+ it_end(id->inherited_key()->value()->end()); it_end != it; ++it)
if (inherited_blacklist.end() != inherited_blacklist.find(*it))
- reporter.message(QAMessage(entry, qaml_normal, name, "Deprecated inherit '" + *it + "' in '" + key->raw_name() + "'")
+ reporter.message(QAMessage(entry, qaml_normal, name, "Deprecated inherit '" + *it + "' in '" + id->inherited_key()->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(id, key_sptr));
+ .with_associated_key(id, id->inherited_key()));
}
catch (const Exception & e)
{
reporter.message(QAMessage(entry, qaml_severe, name,
"Caught exception '" + stringify(e.message()) + "' ("
- + stringify(e.what()) + ") when handling key 'INHERITED'")
+ + stringify(e.what()) + ") when handling key '" + id->inherited_key()->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(id, *id->find_metadata("INHERITED")));
+ .with_associated_key(id, id->inherited_key()));
}
}
diff --git a/paludis/repositories/e/qa/inherited_key.hh b/paludis/repositories/e/qa/inherited_key.hh
index e2751ef..14b135b 100644
--- a/paludis/repositories/e/qa/inherited_key.hh
+++ b/paludis/repositories/e/qa/inherited_key.hh
@@ -31,7 +31,7 @@ namespace paludis
bool inherited_key_check(
const FSEntry &,
QAReporter &,
- const tr1::shared_ptr<const PackageID> &,
+ const tr1::shared_ptr<const ERepositoryID> &,
const std::string &);
}
}
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index be64b79..b86899b 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -506,6 +506,13 @@ VDBID::iuse_key() const
return _imp->iuse;
}
+const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> >
+VDBID::license_key() const
+{
+ need_keys_added();
+ return _imp->license;
+}
+
const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
VDBID::inherited_key() const
{
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index 59a905f..6c1481c 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -83,7 +83,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
- const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
+ virtual const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
+ virtual const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;