aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-07-23 22:02:04 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-07-24 09:09:42 +0100
commit84f6c9f9908625269d50c4beba7c814bdae19173 (patch)
tree38092e730ecadb85c4c6b2e8ab20bffb4498995c
parentee8951598e753b4639d2e8272f7b6436557c2513 (diff)
downloadpaludis-84f6c9f9908625269d50c4beba7c814bdae19173.tar.gz
paludis-84f6c9f9908625269d50c4beba7c814bdae19173.tar.xz
Make UnavailableRepository use the owning repository for from_repositories_key()
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc31
-rw-r--r--paludis/repositories/unavailable/unavailable_id.hh2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc10
-rw-r--r--paludis/util/keys.hh2
4 files changed, 23 insertions, 22 deletions
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index e93dbb3..ddade44 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -46,7 +46,8 @@ namespace paludis
const UnavailableRepository * const repo;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
- const std::tr1::shared_ptr<const MetadataValueKey<std::string> > owning_repository_key, repository_homepage_key, repository_description_key;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > repository_homepage_key, repository_description_key;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key;
const std::tr1::shared_ptr<const Mask> mask;
Implementation(
@@ -56,9 +57,9 @@ namespace paludis
slot(e[k::slot()]),
repo(e[k::repository()]),
description_key(e[k::description()]),
- owning_repository_key(e[k::owning_repository()]),
repository_homepage_key(e[k::repository_homepage()]),
repository_description_key(e[k::repository_description()]),
+ from_repositories_key(e[k::from_repositories()]),
mask(e[k::mask()])
{
}
@@ -70,7 +71,7 @@ UnavailableID::UnavailableID(const UnavailableIDParams & entry) :
_imp(PrivateImplementationPattern<UnavailableID>::_imp)
{
add_metadata_key(_imp->description_key);
- add_metadata_key(_imp->owning_repository_key);
+ add_metadata_key(_imp->from_repositories_key);
if (_imp->repository_homepage_key)
add_metadata_key(_imp->repository_homepage_key);
if (_imp->repository_description_key)
@@ -100,16 +101,16 @@ UnavailableID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
":" + stringify(_imp->slot) + "::" + stringify(_imp->repo->name()) +
- " (in ::" + stringify(_imp->owning_repository_key->value()) + ")";
+ " (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case idcf_no_version:
return stringify(_imp->name) + ":" + stringify(_imp->slot) +
"::" + stringify(_imp->repo->name()) +
- " (in ::" + stringify(_imp->owning_repository_key->value()) + ")";
+ " (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case idcf_version:
return stringify(_imp->version) +
- " (in ::" + stringify(_imp->owning_repository_key->value()) + ")";
+ " (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case last_idcf:
break;
@@ -168,22 +169,20 @@ UnavailableID::arbitrary_less_than_comparison(const PackageID & other) const
if (slot() > other.slot())
return false;
- UnavailableID::MetadataConstIterator k(other.find_metadata("OWNING_REPOSITORY"));
- if (other.end_metadata() == k)
- throw InternalError(PALUDIS_HERE, "other has no OWNING_REPOSITORY");
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string > > > k(other.from_repositories_key());
+ if (! k)
+ throw InternalError(PALUDIS_HERE, "other has no from_repositories_key()");
+ if (1 != k->value()->size())
+ throw InternalError(PALUDIS_HERE, "other has bad from_repositories_key");
- const MetadataValueKey<std::string> * const kk(visitor_cast<const MetadataValueKey<std::string> >(**k));
- if (! kk)
- throw InternalError(PALUDIS_HERE, "other has bad OWNING_REPOSITORY");
-
- return _imp->owning_repository_key->value() < kk->value();
+ return *_imp->from_repositories_key->value()->begin() < *k->value()->begin();
}
std::size_t
UnavailableID::extra_hash_value() const
{
return Hash<std::pair<SlotName, std::string> >()(std::make_pair(
- slot(), _imp->owning_repository_key->value()));
+ slot(), *_imp->from_repositories_key->value()->begin()));
}
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
@@ -297,7 +296,7 @@ UnavailableID::installed_time_key() const
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
UnavailableID::from_repositories_key() const
{
- return std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >();
+ return _imp->from_repositories_key;
}
template class PrivateImplementationPattern<UnavailableID>;
diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh
index 6d7732a..aafa2b8 100644
--- a/paludis/repositories/unavailable/unavailable_id.hh
+++ b/paludis/repositories/unavailable/unavailable_id.hh
@@ -33,7 +33,7 @@ namespace paludis
kc::Field<k::version, VersionSpec>,
kc::Field<k::slot, SlotName>,
kc::Field<k::repository, const UnavailableRepository *>,
- kc::Field<k::owning_repository, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
+ kc::Field<k::from_repositories, std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > >,
kc::Field<k::repository_homepage, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
kc::Field<k::repository_description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
kc::Field<k::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index 2349cbc..f47cc57 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -121,9 +121,11 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
}
std::tr1::shared_ptr<Mask> mask(new UnavailableMask);
- std::tr1::shared_ptr<MetadataValueKey<std::string> > owning_repository(
- new LiteralMetadataValueKey<std::string>("OWNING_REPOSITORY", "Owning repository",
- mkt_significant, file.repo_name()));
+ std::tr1::shared_ptr<Set<std::string> > from_repositories_set(new Set<std::string>);
+ from_repositories_set->insert(file.repo_name());
+ std::tr1::shared_ptr<MetadataCollectionKey<Set<std::string> > > from_repositories(
+ new LiteralMetadataStringSetKey("OWNING_REPOSITORY", "Owning repository",
+ mkt_significant, from_repositories_set));
std::tr1::shared_ptr<MetadataValueKey<std::string> > repository_homepage, repository_description;
if (! file.homepage().empty())
@@ -166,7 +168,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
(k::version(), (*i)[k::version()])
(k::slot(), (*i)[k::slot()])
(k::description(), (*i)[k::description()])
- (k::owning_repository(), owning_repository)
+ (k::from_repositories(), from_repositories)
(k::repository_homepage(), repository_homepage)
(k::repository_description(), repository_description)
(k::mask(), mask)
diff --git a/paludis/util/keys.hh b/paludis/util/keys.hh
index 4375c79..1716c5c 100644
--- a/paludis/util/keys.hh
+++ b/paludis/util/keys.hh
@@ -176,7 +176,7 @@ namespace paludis
typedef kc::Key<149> on_annotations;
typedef kc::Key<150> sync;
typedef kc::Key<151> sync_options;
- typedef kc::Key<152> owning_repository;
+ typedef kc::Key<152> from_repositories;
typedef kc::Key<153> mask;
typedef kc::Key<154> repository;
typedef kc::Key<155> repository_homepage;