aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/virtuals
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-28 19:28:37 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:52 +0000
commit092228a814cd6700b97112b5dcf931c80b6b9431 (patch)
tree4e52622c8ee797a645536d642e98e9292fa7b858 /paludis/repositories/virtuals
parent97c38fc7c02260a2d213d9a16d878a0410b9d57a (diff)
downloadpaludis-092228a814cd6700b97112b5dcf931c80b6b9431.tar.gz
paludis-092228a814cd6700b97112b5dcf931c80b6b9431.tar.xz
PackageID::repository_name rather than ::repository
Diffstat (limited to 'paludis/repositories/virtuals')
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc7
-rw-r--r--paludis/repositories/virtuals/package_id.cc58
-rw-r--r--paludis/repositories/virtuals/package_id.hh4
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc2
4 files changed, 38 insertions, 33 deletions
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 5f72bb8c0..43e73081e 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -155,7 +155,7 @@ InstalledVirtualsRepository::need_ids() const
i = _imp->ids.insert(std::make_pair((*p).virtual_name(), std::make_shared<PackageIDSequence>())).first;
std::shared_ptr<const PackageID> id(std::make_shared<virtuals::VirtualsPackageID>(
- _imp->env, shared_from_this(), (*p).virtual_name(), (*p).provided_by(), false));
+ _imp->env, name(), (*p).virtual_name(), (*p).provided_by(), false));
i->second->push_back(id);
}
}
@@ -363,9 +363,10 @@ InstalledVirtualsRepository::repository_factory_dependencies(
}
bool
-InstalledVirtualsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+InstalledVirtualsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
+ auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "virtuals";
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 81adbc2a3..7aee731ad 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -76,7 +76,7 @@ namespace paludis
n::version_spec() = v->version()))
.slot_requirement(std::make_shared<UserSlotExactRequirement>(
v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN")))
- .in_repository(v->repository()->name()))
+ .in_repository(v->repository_name()))
:
std::make_shared<PackageDepSpec>(
make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
@@ -164,7 +164,7 @@ namespace paludis
struct Imp<VirtualsPackageID>
{
const Environment * const env;
- const std::shared_ptr<const Repository> repository;
+ const RepositoryName repository_name;
const QualifiedPackageName name;
const VersionSpec version;
std::shared_ptr<DependenciesLabelSequence> bdep_labels;
@@ -177,12 +177,12 @@ namespace paludis
Imp(
const Environment * const e,
- const std::shared_ptr<const Repository> & o,
+ const RepositoryName & r,
const QualifiedPackageName & n,
const std::shared_ptr<const PackageID> & p,
const bool b) :
env(e),
- repository(o),
+ repository_name(r),
name(n),
version(p->version()),
bdep_labels(std::make_shared<DependenciesLabelSequence>()),
@@ -202,11 +202,11 @@ namespace paludis
VirtualsPackageID::VirtualsPackageID(
const Environment * const e,
- const std::shared_ptr<const Repository> & owner,
+ const RepositoryName & r,
const QualifiedPackageName & virtual_name,
const std::shared_ptr<const PackageID> & virtual_for,
const bool exact) :
- Pimp<VirtualsPackageID>(e, owner, virtual_name, virtual_for, exact),
+ Pimp<VirtualsPackageID>(e, r, virtual_name, virtual_for, exact),
_imp(Pimp<VirtualsPackageID>::_imp)
{
add_metadata_key(_imp->virtual_for);
@@ -224,18 +224,18 @@ VirtualsPackageID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(_imp->name) + "-" + stringify(_imp->version) + "::" + stringify(_imp->repository->name()) +
+ return stringify(_imp->name) + "-" + stringify(_imp->version) + "::" + stringify(_imp->repository_name) +
" (virtual for " + stringify(*_imp->virtual_for->value()) + ")";
case idcf_no_version:
- return stringify(_imp->name) + "::" + stringify(_imp->repository->name()) +
+ return stringify(_imp->name) + "::" + stringify(_imp->repository_name) +
" (virtual for " + _imp->virtual_for->value()->canonical_form(idcf_no_version) + ")";
case idcf_version:
return stringify(_imp->version) + " (for " + stringify(_imp->virtual_for->value()->canonical_form(idcf_no_version)) + ")";
case idcf_no_name:
- return stringify(_imp->version) + "::" + stringify(_imp->repository->name()) +
+ return stringify(_imp->version) + "::" + stringify(_imp->repository_name) +
" (virtual for " + stringify(*_imp->virtual_for->value()) + ")";
case last_idcf:
@@ -251,7 +251,7 @@ VirtualsPackageID::uniquely_identifying_spec() const
/* hack: ensure the slot key's loaded, so that stringify returns the full form */
_imp->virtual_for->value()->slot_key();
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository()->name()) +
+ (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()) +
"[." + _imp->virtual_for->raw_name() + "=" + stringify(*_imp->virtual_for->value()) + "]",
_imp->env, { });
}
@@ -268,10 +268,10 @@ VirtualsPackageID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-VirtualsPackageID::repository() const
+const RepositoryName
+VirtualsPackageID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
@@ -387,59 +387,62 @@ namespace
{
struct PerformAction
{
+ const Environment * const env;
const PackageID * const id;
- PerformAction(const PackageID * const i) :
- id(i)
- {
- }
-
void visit(const InstallAction & a)
{
SupportsActionTest<InstallAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
- if (! id->repository()->some_ids_might_support_action(t))
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
};
@@ -448,14 +451,15 @@ namespace
void
VirtualsPackageID::perform_action(Action & a) const
{
- PerformAction b(this);
+ PerformAction b{_imp->env, this};
a.accept(b);
}
bool
VirtualsPackageID::supports_action(const SupportsActionTestBase & b) const
{
- return repository()->some_ids_might_support_action(b);
+ auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
+ return repo->some_ids_might_support_action(b);
}
namespace
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index a5e14651d..30513f50f 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -73,7 +73,7 @@ namespace paludis
public:
VirtualsPackageID(
const Environment * const,
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const QualifiedPackageName & virtual_name,
const std::shared_ptr<const PackageID> & virtual_for,
const bool exact);
@@ -84,7 +84,7 @@ namespace paludis
virtual const QualifiedPackageName name() const;
virtual const VersionSpec version() const;
- virtual const std::shared_ptr<const Repository> repository() const;
+ virtual const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index f499eb8db..a17dce361 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -336,7 +336,7 @@ VirtualsRepository::make_virtual_package_id(
throw InternalError(PALUDIS_HERE, "tried to make a virtual package id using '" + stringify(virtual_name) + "', '"
+ stringify(*provider) + "'");
- return std::make_shared<virtuals::VirtualsPackageID>(_imp->env, shared_from_this(), virtual_name, provider, true);
+ return std::make_shared<virtuals::VirtualsPackageID>(_imp->env, name(), virtual_name, provider, true);
}
bool