aboutsummaryrefslogtreecommitdiff
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
parent97c38fc7c02260a2d213d9a16d878a0410b9d57a (diff)
downloadpaludis-092228a814cd6700b97112b5dcf931c80b6b9431.tar.gz
paludis-092228a814cd6700b97112b5dcf931c80b6b9431.tar.xz
PackageID::repository_name rather than ::repository
-rw-r--r--doc/api/cplusplus/examples/example_package_id.cc2
-rw-r--r--paludis/environments/paludis/output_conf.cc2
-rw-r--r--paludis/legacy/install_task.cc2
-rw-r--r--paludis/literal_metadata_key.cc12
-rw-r--r--paludis/match_package.cc7
-rw-r--r--paludis/package_database.cc9
-rw-r--r--paludis/package_id.cc12
-rw-r--r--paludis/package_id.hh4
-rw-r--r--paludis/repositories/accounts/accounts_id.cc27
-rw-r--r--paludis/repositories/accounts/accounts_id.hh4
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc29
-rw-r--r--paludis/repositories/accounts/accounts_repository_store.cc46
-rw-r--r--paludis/repositories/accounts/accounts_repository_store.hh14
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc22
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.hh4
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc6
-rw-r--r--paludis/repositories/cran/cran_package_id.cc59
-rw-r--r--paludis/repositories/cran/cran_package_id.hh7
-rw-r--r--paludis/repositories/cran/cran_repository.cc2
-rw-r--r--paludis/repositories/cran/keys.cc8
-rw-r--r--paludis/repositories/cran/keys.hh5
-rw-r--r--paludis/repositories/e/dep_parser.cc16
-rw-r--r--paludis/repositories/e/dep_parser.hh1
-rw-r--r--paludis/repositories/e/e_installed_repository.cc5
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc46
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh4
-rw-r--r--paludis/repositories/e/e_repository.cc11
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc3
-rw-r--r--paludis/repositories/e/e_repository_sets.cc4
-rw-r--r--paludis/repositories/e/ebuild.cc8
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc8
-rw-r--r--paludis/repositories/e/ebuild_id.cc160
-rw-r--r--paludis/repositories/e/ebuild_id.hh7
-rw-r--r--paludis/repositories/e/exndbam_id.cc2
-rw-r--r--paludis/repositories/e/exndbam_id.hh2
-rw-r--r--paludis/repositories/e/exndbam_repository.cc2
-rw-r--r--paludis/repositories/e/fetch_visitor.cc6
-rw-r--r--paludis/repositories/e/vdb_id.cc2
-rw-r--r--paludis/repositories/e/vdb_id.hh2
-rw-r--r--paludis/repositories/e/vdb_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc60
-rw-r--r--paludis/repositories/fake/fake_package_id.hh4
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc2
-rw-r--r--paludis/repositories/gemcutter/gemcutter_id.cc18
-rw-r--r--paludis/repositories/gemcutter/gemcutter_id.hh4
-rw-r--r--paludis/repositories/gemcutter/gemcutter_repository_store.cc2
-rw-r--r--paludis/repositories/repository/repository_id.cc18
-rw-r--r--paludis/repositories/repository/repository_id.hh4
-rw-r--r--paludis/repositories/repository/repository_repository.cc6
-rw-r--r--paludis/repositories/repository/repository_repository_store.cc3
-rw-r--r--paludis/repositories/unavailable/unavailable_package_id.cc18
-rw-r--r--paludis/repositories/unavailable/unavailable_package_id.hh4
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc18
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.hh4
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc5
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc13
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc17
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc8
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc2
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc18
-rw-r--r--paludis/repositories/unwritten/unwritten_id.hh4
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_store.cc3
-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
-rw-r--r--paludis/user_dep_spec.cc17
-rw-r--r--python/package_id.cc4
-rwxr-xr-xpython/package_id_TEST.py4
-rw-r--r--ruby/package_id.cc2
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc2
-rw-r--r--src/clients/cave/cmd_import.cc5
-rw-r--r--src/clients/cave/cmd_print_id_environment_variable.cc10
-rw-r--r--src/clients/cave/cmd_print_ids.cc2
-rw-r--r--src/clients/cave/cmd_show.cc12
-rw-r--r--src/clients/importare/importare.cc5
-rw-r--r--src/clients/inquisitio/do_search.cc8
-rw-r--r--src/clients/paludis/applets.cc5
-rw-r--r--src/clients/paludis/report.cc2
-rw-r--r--src/output/console_install_task.cc6
-rw-r--r--src/output/console_query_task.cc6
84 files changed, 523 insertions, 455 deletions
diff --git a/doc/api/cplusplus/examples/example_package_id.cc b/doc/api/cplusplus/examples/example_package_id.cc
index 040caf1..22c2703 100644
--- a/doc/api/cplusplus/examples/example_package_id.cc
+++ b/doc/api/cplusplus/examples/example_package_id.cc
@@ -59,7 +59,7 @@ int main(int argc, char * argv[])
/* Start by outputting some basic properties: */
cout << left << setw(30) << " Name:" << " " << (*i)->name() << endl;
cout << left << setw(30) << " Version:" << " " << (*i)->version() << endl;
- cout << left << setw(30) << " Repository Name:" << " " << (*i)->repository()->name() << endl;
+ cout << left << setw(30) << " Repository Name:" << " " << (*i)->repository_name() << endl;
/* The PackageID::canonical_form method should be used when
* outputting a package (the ostream << operator uses this). */
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index b5977ff..adef984 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -273,7 +273,7 @@ namespace
if (i.package_id()->slot_key())
m->insert("slot", stringify(i.package_id()->slot_key()->value()));
m->insert("version", stringify(i.package_id()->version()));
- m->insert("repository", stringify(i.package_id()->repository()->name()));
+ m->insert("repository", stringify(i.package_id()->repository_name()));
m->insert("category", stringify(i.package_id()->name().category()));
m->insert("package", stringify(i.package_id()->name().package()));
m->insert("summaries_supported", stringify(i.client_output_features()[cof_summary_at_end]));
diff --git a/paludis/legacy/install_task.cc b/paludis/legacy/install_task.cc
index d1d6eff..2b3b2f5 100644
--- a/paludis/legacy/install_task.cc
+++ b/paludis/legacy/install_task.cc
@@ -559,7 +559,7 @@ InstallTask::_add_package_id(const std::shared_ptr<const PackageID> & target)
PartiallyMadePackageDepSpec part_spec({ });
part_spec.package(target->name());
- part_spec.in_repository(target->repository()->name());
+ part_spec.in_repository(target->repository_name());
part_spec.version_requirement(make_named_values<VersionRequirement>(
n::version_operator() = vo_equal,
n::version_spec() = target->version()));
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 6ccc625..51a6edf 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -371,17 +371,7 @@ std::string
ExtraLiteralMetadataValueKeyMethods<std::shared_ptr<const PackageID> >::pretty_print(const Formatter<PackageID> & f) const
{
std::shared_ptr<const PackageID> v(static_cast<const LiteralMetadataValueKey<std::shared_ptr<const PackageID> > *>(this)->value());
- if (v->repository()->installed_root_key())
- return f.format(*v, format::Installed());
- else if (v->supports_action(SupportsActionTest<InstallAction>()))
- {
- if (v->masked())
- return f.format(*v, format::Plain());
- else
- return f.format(*v, format::Installable());
- }
- else
- return f.format(*v, format::Plain());
+ return f.format(*v, format::Plain());
}
template <typename T_>
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index d3d6292..9509d93 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -124,7 +124,7 @@ paludis::match_package_with_maybe_changes(
}
if (spec.in_repository_ptr())
- if (*spec.in_repository_ptr() != id->repository()->name())
+ if (*spec.in_repository_ptr() != id->repository_name())
return false;
if (spec.from_repository_ptr())
@@ -139,9 +139,10 @@ paludis::match_package_with_maybe_changes(
if (spec.installed_at_path_ptr())
{
- if (! id->repository()->installed_root_key())
+ auto repo(env.package_database()->fetch_repository(id->repository_name()));
+ if (! repo->installed_root_key())
return false;
- if (id->repository()->installed_root_key()->value() != *spec.installed_at_path_ptr())
+ if (repo->installed_root_key()->value() != *spec.installed_at_path_ptr())
return false;
}
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 28f1d66..17e978b 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -285,14 +285,15 @@ PackageDatabase::fetch_unique_qualified_package_name(const PackageNamePart & p,
it_end(pkgs->end()); it_end != it; ++it)
{
Context local_context("When checking category '" + stringify(it->name().category()) + "' in repository '" +
- stringify(it->repository()->name()) + "':");
+ stringify(it->repository_name()) + "':");
- if (! checked.insert(std::make_pair(it->name().category(), it->repository()->name())).second)
+ if (! checked.insert(std::make_pair(it->name().category(), it->repository_name())).second)
continue;
- std::shared_ptr<const CategoryNamePartSet> unimportant_cats(it->repository()->unimportant_category_names());
+ auto repo(fetch_repository(it->repository_name()));
+ std::shared_ptr<const CategoryNamePartSet> unimportant_cats(repo->unimportant_category_names());
bool is_important(unimportant_cats->end() == unimportant_cats->find(it->name().category()));
- bool is_in_important_repo(! it->repository()->is_unimportant());
+ bool is_in_important_repo(! repo->is_unimportant());
QPNIMap::iterator i(result->insert(std::make_pair(it->name(), std::make_pair(is_important, is_in_important_repo))).first);
i->second.first = i->second.first || is_important;
i->second.second = i->second.second || is_in_important_repo;
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index 4b89195..4cd719a 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -150,10 +150,10 @@ PackageIDSetComparator::operator() (const std::shared_ptr<const PackageID> & a,
if (a->version() > b->version())
return false;
- if (a->repository()->name().value() < b->repository()->name().value())
+ if (a->repository_name().value() < b->repository_name().value())
return true;
- if (a->repository()->name().value() > b->repository()->name().value())
+ if (a->repository_name().value() > b->repository_name().value())
return false;
return a->arbitrary_less_than_comparison(*b);
@@ -164,7 +164,7 @@ paludis::operator== (const PackageID & a, const PackageID & b)
{
return (a.name() == b.name())
&& (a.version() == b.version())
- && (a.repository()->name() == b.repository()->name())
+ && (a.repository_name() == b.repository_name())
&& (! a.arbitrary_less_than_comparison(b))
&& (! b.arbitrary_less_than_comparison(a));
}
@@ -214,8 +214,8 @@ PackageIDComparator::operator() (const std::shared_ptr<const PackageID> & a,
return false;
std::unordered_map<RepositoryName, unsigned, Hash<RepositoryName> >::const_iterator
- ma(_imp->m.find(a->repository()->name())),
- mb(_imp->m.find(b->repository()->name()));
+ ma(_imp->m.find(a->repository_name())),
+ mb(_imp->m.find(b->repository_name()));
if (ma == _imp->m.end() || mb == _imp->m.end())
throw InternalError(PALUDIS_HERE, "Repository not in database");
@@ -234,7 +234,7 @@ PackageID::hash() const
return
(Hash<QualifiedPackageName>()(name()) << 0) ^
(Hash<VersionSpec>()(version()) << 5) ^
- (Hash<RepositoryName>()(repository()->name()) << 9) ^
+ (Hash<RepositoryName>()(repository_name()) << 9) ^
(extra_hash_value() << 13);
}
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 97ecf88..71005a8 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -159,8 +159,10 @@ namespace paludis
/**
* What is our owning repository?
+ *
+ * \since 0.58
*/
- virtual const std::shared_ptr<const Repository> repository() const = 0;
+ virtual const RepositoryName repository_name() const = 0;
/**
* Return a PackageDepSpec that uniquely identifies us.
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 64aa7ee..8995fac 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -36,7 +36,9 @@
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/environment.hh>
#include <paludis/repository.hh>
+#include <paludis/package_database.hh>
#include <paludis/action.hh>
#include <paludis/user_dep_spec.hh>
#include <algorithm>
@@ -71,7 +73,7 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
- const std::shared_ptr<const Repository> repository;
+ const RepositoryName repository_name;
const std::shared_ptr<const LiteralMetadataValueKey<FSPath> > fs_location_key;
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key;
@@ -97,13 +99,13 @@ namespace paludis
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > preferred_gid_key;
Imp(const Environment * const e,
- const QualifiedPackageName & q, const std::shared_ptr<const Repository> & r,
+ const QualifiedPackageName & q, const RepositoryName & r,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & f,
const FSPath & l, const bool u, const bool m) :
env(e),
name(q),
version("0", { }),
- repository(r),
+ repository_name(r),
fs_location_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("location", "Location", mkt_internal, l)),
from_repositories_key(f),
behaviours_key(AccountsIDBehaviours::get_instance()->behaviours_key),
@@ -117,7 +119,7 @@ namespace paludis
}
AccountsID::AccountsID(const Environment * const e,
- const QualifiedPackageName & q, const std::shared_ptr<const Repository> & r,
+ const QualifiedPackageName & q, const RepositoryName & r,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & f, const FSPath & l,
const bool u, const bool m) :
Pimp<AccountsID>(e, q, r, f, l, u, m),
@@ -270,10 +272,10 @@ AccountsID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-AccountsID::repository() const
+const RepositoryName
+AccountsID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::string
@@ -282,16 +284,16 @@ AccountsID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
- return stringify(name()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository_name());
case idcf_version:
return stringify(version());
case idcf_no_name:
- return stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(version()) + "::" + stringify(repository_name());
case last_idcf:
break;
@@ -303,7 +305,7 @@ AccountsID::canonical_form(const PackageIDCanonicalForm f) const
PackageDepSpec
AccountsID::uniquely_identifying_spec() const
{
- return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository()->name()),
+ return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -538,7 +540,8 @@ AccountsID::perform_action(Action & action) const
i != i_end ; ++i)
{
Context local_context("When cleaning '" + stringify(**i) + "':");
- if ((*i)->repository()->format_key() && (*i)->repository()->format_key()->value() == "installed-accounts"
+ auto repo(_imp->env->package_database()->fetch_repository((*i)->repository_name()));
+ if (repo->format_key() && repo->format_key()->value() == "installed-accounts"
&& (*i)->name() == name())
continue;
else
diff --git a/paludis/repositories/accounts/accounts_id.hh b/paludis/repositories/accounts/accounts_id.hh
index 6285e42..88b90b2 100644
--- a/paludis/repositories/accounts/accounts_id.hh
+++ b/paludis/repositories/accounts/accounts_id.hh
@@ -47,7 +47,7 @@ namespace paludis
public:
AccountsID(const Environment * const,
- const QualifiedPackageName &, const std::shared_ptr<const Repository> &,
+ const QualifiedPackageName &, const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > &,
const FSPath &, const bool is_user, const bool masked);
~AccountsID();
@@ -56,7 +56,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;
///\name Specific metadata keys
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index 18d87d6..02af095 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -40,6 +40,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
+#include <paludis/package_database.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -57,15 +58,15 @@ namespace
}
std::shared_ptr<AccountsRepositoryStore>
- make_store(const AccountsRepository * const repo, const AccountsRepositoryParams & p)
+ make_store(const RepositoryName & repository_name, const AccountsRepositoryParams & p)
{
- return std::make_shared<AccountsRepositoryStore>(p.environment(), repo, false);
+ return std::make_shared<AccountsRepositoryStore>(p.environment(), repository_name, false);
}
std::shared_ptr<AccountsRepositoryStore>
- make_installed_store(const AccountsRepository * const repo, const InstalledAccountsRepositoryParams & p)
+ make_installed_store(const RepositoryName & repository_name, const InstalledAccountsRepositoryParams & p)
{
- return std::make_shared<AccountsRepositoryStore>(p.environment(), repo, true);
+ return std::make_shared<AccountsRepositoryStore>(p.environment(), repository_name, true);
}
}
@@ -84,29 +85,29 @@ namespace paludis
const ActiveObjectPtr<DeferredConstructionPtr<std::shared_ptr<AccountsRepositoryStore> > > store;
- Imp(AccountsRepository * const repo, const AccountsRepositoryParams & p) :
+ Imp(const RepositoryName & repository_name, const AccountsRepositoryParams & p) :
params_if_not_installed(std::make_shared<AccountsRepositoryParams>(p)),
format_key(std::make_shared<LiteralMetadataValueKey<std::string> >("format", "format", mkt_significant, "accounts")),
store(DeferredConstructionPtr<std::shared_ptr<AccountsRepositoryStore> > (
- std::bind(&make_store, repo, std::cref(*params_if_not_installed))))
+ std::bind(&make_store, repository_name, std::cref(*params_if_not_installed))))
{
}
- Imp(AccountsRepository * const repo, const InstalledAccountsRepositoryParams & p) :
+ Imp(const RepositoryName & repository_name, const InstalledAccountsRepositoryParams & p) :
params_if_installed(std::make_shared<InstalledAccountsRepositoryParams>(p)),
handler_if_installed(make_handler(p.handler())),
format_key(std::make_shared<LiteralMetadataValueKey<std::string> >("format", "format", mkt_significant, "installed-accounts")),
handler_key(std::make_shared<LiteralMetadataValueKey<std::string> >("handler", "handler", mkt_normal, p.handler())),
installed_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "root", mkt_normal, p.root())),
store(DeferredConstructionPtr<std::shared_ptr<AccountsRepositoryStore> > (
- std::bind(&make_installed_store, repo, std::cref(*params_if_installed))))
+ std::bind(&make_installed_store, repository_name, std::cref(*params_if_installed))))
{
}
};
}
AccountsRepository::AccountsRepository(const AccountsRepositoryParams & p) :
- Pimp<AccountsRepository>(this, p),
+ Pimp<AccountsRepository>(p.name(), p),
Repository(
p.environment(),
p.name(),
@@ -124,7 +125,7 @@ AccountsRepository::AccountsRepository(const AccountsRepositoryParams & p) :
}
AccountsRepository::AccountsRepository(const InstalledAccountsRepositoryParams & p) :
- Pimp<AccountsRepository>(this, p),
+ Pimp<AccountsRepository>(p.name(), p),
Repository(
p.environment(),
p.name(),
@@ -275,9 +276,9 @@ void
AccountsRepository::invalidate()
{
if (_imp->params_if_not_installed)
- _imp.reset(new Imp<AccountsRepository>(this, *_imp->params_if_not_installed));
+ _imp.reset(new Imp<AccountsRepository>(name(), *_imp->params_if_not_installed));
else
- _imp.reset(new Imp<AccountsRepository>(this, *_imp->params_if_installed));
+ _imp.reset(new Imp<AccountsRepository>(name(), *_imp->params_if_installed));
_add_metadata_keys();
}
@@ -403,7 +404,9 @@ AccountsRepository::some_ids_might_not_be_masked() const
bool
AccountsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- std::string f(id->repository()->format_key() ? id->repository()->format_key()->value() : "");
+ auto env(_imp->params_if_installed ? _imp->params_if_installed->environment() : _imp->params_if_not_installed->environment());
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return _imp->handler_if_installed && f == "accounts";
}
diff --git a/paludis/repositories/accounts/accounts_repository_store.cc b/paludis/repositories/accounts/accounts_repository_store.cc
index 02208f0..279c72b 100644
--- a/paludis/repositories/accounts/accounts_repository_store.cc
+++ b/paludis/repositories/accounts/accounts_repository_store.cc
@@ -64,16 +64,16 @@ namespace paludis
struct Imp<AccountsRepositoryStore>
{
const Environment * const env;
- const AccountsRepository * const repo;
+ const RepositoryName repository_name;
const bool installed;
std::shared_ptr<CategoryNamePartSet> categories;
mutable PackageNames package_names;
mutable IDs ids;
- Imp(const Environment * const e, const AccountsRepository * const r, const bool i) :
+ Imp(const Environment * const e, const RepositoryName & r, const bool i) :
env(e),
- repo(r),
+ repository_name(r),
installed(i),
categories(std::make_shared<CategoryNamePartSet>())
{
@@ -85,11 +85,11 @@ namespace paludis
AccountsRepositoryStore::AccountsRepositoryStore(
const Environment * const env,
- const AccountsRepository * const repo,
+ const RepositoryName & r,
const bool installed) :
- Pimp<AccountsRepositoryStore>(env, repo, installed)
+ Pimp<AccountsRepositoryStore>(env, r, installed)
{
- _load(repo->shared_from_this());
+ _load(r);
}
AccountsRepositoryStore::~AccountsRepositoryStore()
@@ -97,7 +97,7 @@ AccountsRepositoryStore::~AccountsRepositoryStore()
}
void
-AccountsRepositoryStore::_load(const std::shared_ptr<const Repository> & repo)
+AccountsRepositoryStore::_load(const RepositoryName & repository_name)
{
Context context("When loading data for AccountsRepository:");
@@ -134,13 +134,13 @@ AccountsRepositoryStore::_load(const std::shared_ptr<const Repository> & repo)
std::shared_ptr<Set<std::string> > r_set(std::make_shared<Set<std::string>>());
r_set->insert(stringify((*r)->name()));
std::shared_ptr<LiteralMetadataStringSetKey> r_key(std::make_shared<LiteralMetadataStringSetKey>("defined_by", "Defined by repository", mkt_internal, r_set));
- _load_one(repo, r_key, dir);
+ _load_one(repository_name, r_key, dir);
}
}
void
AccountsRepositoryStore::_load_one(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName & repository_name,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir)
{
@@ -148,29 +148,29 @@ AccountsRepositoryStore::_load_one(
FSPath users_dir(dir / "users");
if (users_dir.stat().is_directory_or_symlink_to_directory())
- _load_one_users(repo, from_repo, users_dir);
+ _load_one_users(repository_name, from_repo, users_dir);
else
Log::get_instance()->message("accounts.no_users", ll_debug, lc_context) <<
- "Repository " << repo->name() << " has accounts_repository_data_location " << dir << ", but no users subdirectory";
+ "Repository " << repository_name << " has accounts_repository_data_location " << dir << ", but no users subdirectory";
FSPath groups_dir(dir / "groups");
if (groups_dir.stat().is_directory_or_symlink_to_directory())
- _load_one_groups(repo, from_repo, groups_dir);
+ _load_one_groups(repository_name, from_repo, groups_dir);
else
Log::get_instance()->message("accounts.no_groups", ll_debug, lc_context) <<
- "Repository " << repo->name() << " has accounts_repository_data_location " << dir << ", but no groups subdirectory";
+ "Repository " << repository_name << " has accounts_repository_data_location " << dir << ", but no groups subdirectory";
}
void
AccountsRepositoryStore::_load_one_users(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName & repository_name,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir)
{
for (FSIterator d(dir, { fsio_inode_sort }), d_end ; d != d_end ; ++d)
if (is_file_with_extension(*d, ".conf", { }))
- _load_one_user(repo, from_repo, *d);
+ _load_one_user(repository_name, from_repo, *d);
else
Log::get_instance()->message("accounts.unknown_file", ll_debug, lc_context) <<
"Don't know what to do with '" << *d << "'";
@@ -178,7 +178,7 @@ AccountsRepositoryStore::_load_one_users(
void
AccountsRepositoryStore::_load_one_user(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName & repository_name,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & filename)
{
@@ -213,20 +213,20 @@ AccountsRepositoryStore::_load_one_user(
q->second = std::make_shared<PackageIDSequence>();
if (_imp->installed)
- q->second->push_back(std::make_shared<InstalledAccountsID>(_imp->env, qpn, repo, true));
+ q->second->push_back(std::make_shared<InstalledAccountsID>(_imp->env, qpn, repository_name, true));
else
- q->second->push_back(std::make_shared<AccountsID>(_imp->env, qpn, repo, from_repo, filename, true, masked));
+ q->second->push_back(std::make_shared<AccountsID>(_imp->env, qpn, repository_name, from_repo, filename, true, masked));
}
void
AccountsRepositoryStore::_load_one_groups(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName & repository_name,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir)
{
for (FSIterator d(dir, { fsio_inode_sort }), d_end ; d != d_end ; ++d)
if (is_file_with_extension(*d, ".conf", { }))
- _load_one_group(repo, from_repo, *d);
+ _load_one_group(repository_name, from_repo, *d);
else
Log::get_instance()->message("accounts.unknown_file", ll_debug, lc_context) <<
"Don't know what to do with '" << *d << "'";
@@ -234,7 +234,7 @@ AccountsRepositoryStore::_load_one_groups(
void
AccountsRepositoryStore::_load_one_group(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName & repository_name,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & filename)
{
@@ -269,9 +269,9 @@ AccountsRepositoryStore::_load_one_group(
q->second = std::make_shared<PackageIDSequence>();
if (_imp->installed)
- q->second->push_back(std::make_shared<InstalledAccountsID>(_imp->env, qpn, repo, false));
+ q->second->push_back(std::make_shared<InstalledAccountsID>(_imp->env, qpn, repository_name, false));
else
- q->second->push_back(std::make_shared<AccountsID>(_imp->env, qpn, repo, from_repo, filename, false, masked));
+ q->second->push_back(std::make_shared<AccountsID>(_imp->env, qpn, repository_name, from_repo, filename, false, masked));
}
bool
diff --git a/paludis/repositories/accounts/accounts_repository_store.hh b/paludis/repositories/accounts/accounts_repository_store.hh
index c27ab12..271cf3c 100644
--- a/paludis/repositories/accounts/accounts_repository_store.hh
+++ b/paludis/repositories/accounts/accounts_repository_store.hh
@@ -39,37 +39,37 @@ namespace paludis
private Pimp<AccountsRepositoryStore>
{
private:
- void _load(const std::shared_ptr<const Repository> & repo);
+ void _load(const RepositoryName &);
void _load_one(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir);
void _load_one_users(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir);
void _load_one_user(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & file);
void _load_one_groups(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & dir);
void _load_one_group(
- const std::shared_ptr<const Repository> & repo,
+ const RepositoryName &,
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > & from_repo,
const FSPath & file);
public:
AccountsRepositoryStore(
const Environment * const,
- const AccountsRepository * const,
+ const RepositoryName &,
const bool installed);
~AccountsRepositoryStore();
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index f84bdfd..295e2bf 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -74,7 +74,7 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
- const std::shared_ptr<const Repository> repository;
+ const RepositoryName repository_name;
const std::shared_ptr<const LiteralMetadataStringSetKey> behaviours_key;
mutable Mutex mutex;
@@ -83,12 +83,12 @@ namespace paludis
const bool is_user;
Imp(const Environment * const e,
- const QualifiedPackageName & q, const std::shared_ptr<const Repository> & r,
+ const QualifiedPackageName & q, const RepositoryName & r,
const bool u) :
env(e),
name(q),
version("0", { }),
- repository(r),
+ repository_name(r),
behaviours_key(InstalledAccountsIDBehaviours::get_instance()->behaviours_key),
is_user(u)
{
@@ -97,7 +97,7 @@ namespace paludis
}
InstalledAccountsID::InstalledAccountsID(const Environment * const e,
- const QualifiedPackageName & q, const std::shared_ptr<const Repository> & r, const bool u) :
+ const QualifiedPackageName & q, const RepositoryName & r, const bool u) :
Pimp<InstalledAccountsID>(e, q, r, u),
_imp(Pimp<InstalledAccountsID>::_imp)
{
@@ -191,10 +191,10 @@ InstalledAccountsID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-InstalledAccountsID::repository() const
+const RepositoryName
+InstalledAccountsID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::string
@@ -203,16 +203,16 @@ InstalledAccountsID::canonical_form(const PackageIDCanonicalForm f) const
switch (f)
{
case idcf_full:
- return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
- return stringify(name()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository_name());
case idcf_version:
return stringify(version());
case idcf_no_name:
- return stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(version()) + "::" + stringify(repository_name());
case last_idcf:
break;
@@ -224,7 +224,7 @@ InstalledAccountsID::canonical_form(const PackageIDCanonicalForm f) const
PackageDepSpec
InstalledAccountsID::uniquely_identifying_spec() const
{
- return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository()->name()), _imp->env, { });
+ return parse_user_package_dep_spec(stringify(name()) + "::" + stringify(repository_name()), _imp->env, { });
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
diff --git a/paludis/repositories/accounts/installed_accounts_id.hh b/paludis/repositories/accounts/installed_accounts_id.hh
index 2e7d9de..6d09a2e 100644
--- a/paludis/repositories/accounts/installed_accounts_id.hh
+++ b/paludis/repositories/accounts/installed_accounts_id.hh
@@ -46,7 +46,7 @@ namespace paludis
public:
InstalledAccountsID(const Environment * const,
- const QualifiedPackageName &, const std::shared_ptr<const Repository> &,
+ const QualifiedPackageName &, const RepositoryName &,
const bool is_user);
~InstalledAccountsID();
@@ -54,7 +54,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;
///\name Specific metadata keys
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index ff5de6a..6e86871 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -33,6 +33,7 @@
#include <paludis/selection.hh>
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
+#include <paludis/package_database.hh>
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/cran_installed_repository.hh>
@@ -460,9 +461,10 @@ CRANInstalledRepository::invalidate_masks()
}
bool
-CRANInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+CRANInstalledRepository::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->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "cran";
}
bool
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 2047ca7..9ad4313 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -41,6 +41,8 @@
#include <paludis/action.hh>
#include <paludis/dep_label.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
#include <paludis/util/tokeniser.hh>
#include <string>
#include <algorithm>
@@ -56,10 +58,7 @@ namespace paludis
struct Imp<CRANPackageID>
{
const Environment * const env;
-
- const std::shared_ptr<const Repository> repository;
- const std::shared_ptr<const CRANRepository> cran_repository;
- const std::shared_ptr<const CRANInstalledRepository> cran_installed_repository;
+ const RepositoryName repository_name;
QualifiedPackageName name;
VersionSpec version;
@@ -77,11 +76,9 @@ namespace paludis
std::shared_ptr<DependenciesLabelSequence> suggests_labels;
std::shared_ptr<DependenciesLabelSequence> depends_labels;
- Imp(const Environment * const e,
- const std::shared_ptr<const CRANRepository> & r, const FSPath & f) :
+ Imp(const Environment * const e, const RepositoryName & r, const FSPath & f) :
env(e),
- repository(r),
- cran_repository(r),
+ repository_name(r),
name("cran/" + cran_name_to_internal(strip_trailing_string(f.basename(), ".DESCRIPTION"))),
version("0", { }),
suggests_labels(std::make_shared<DependenciesLabelSequence>()),
@@ -91,14 +88,12 @@ namespace paludis
depends_labels->push_back(std::make_shared<DependenciesBuildLabel>("Depends", return_literal_function(true)));
}
- Imp(const Environment * const e,
- const std::shared_ptr<const CRANRepository> & c, const CRANPackageID * const r, const std::string & t) :
+ Imp(const Environment * const e, const RepositoryName & c, const CRANPackageID * const r, const std::string & t) :
env(e),
- repository(c),
- cran_repository(c),
+ repository_name(c),
name("cran/" + cran_name_to_internal(t)),
version(r->version()),
- contained_in_key(std::make_shared<PackageIDKey>("Contained", "Contained in", r, mkt_normal)),
+ contained_in_key(std::make_shared<PackageIDKey>(e, "Contained", "Contained in", r, mkt_normal)),
suggests_labels(std::make_shared<DependenciesLabelSequence>()),
depends_labels(std::make_shared<DependenciesLabelSequence>())
{
@@ -108,7 +103,7 @@ namespace paludis
};
}
-CRANPackageID::CRANPackageID(const Environment * const env, const std::shared_ptr<const CRANRepository> & r, const FSPath & f) :
+CRANPackageID::CRANPackageID(const Environment * const env, const RepositoryName & r, const FSPath & f) :
Pimp<CRANPackageID>(env, r, f),
_imp(Pimp<CRANPackageID>::_imp)
{
@@ -229,7 +224,7 @@ CRANPackageID::CRANPackageID(const Environment * const env, const std::shared_pt
t != t_end ; ++t)
{
if (*t != stringify(name().package()))
- _imp->contains_key->push_back(std::make_shared<CRANPackageID>(_imp->env, _imp->cran_repository, this, *t));
+ _imp->contains_key->push_back(std::make_shared<CRANPackageID>(_imp->env, r, this, *t));
else
{
/* yay CRAN... */
@@ -277,7 +272,7 @@ CRANPackageID::CRANPackageID(const Environment * const env, const std::shared_pt
}
CRANPackageID::CRANPackageID(const Environment * const e,
- const std::shared_ptr<const CRANRepository> & c, const CRANPackageID * const r, const std::string & t) :
+ const RepositoryName & c, const CRANPackageID * const r, const std::string & t) :
Pimp<CRANPackageID>(e, c, r, t),
_imp(Pimp<CRANPackageID>::_imp)
{
@@ -313,10 +308,10 @@ CRANPackageID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-CRANPackageID::repository() const
+const RepositoryName
+CRANPackageID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
@@ -441,16 +436,16 @@ CRANPackageID::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);
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + "::" + stringify(_imp->repository_name);
case idcf_no_name:
- return stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(version()) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -462,7 +457,7 @@ CRANPackageID::canonical_form(const PackageIDCanonicalForm f) const
PackageDepSpec
CRANPackageID::uniquely_identifying_spec() const
{
- return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name()),
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + "::" + stringify(_imp->repository_name),
_imp->env, { });
}
@@ -470,28 +465,21 @@ namespace
{
struct SupportsActionQuery
{
- const std::shared_ptr<const CRANRepository> cran_repository;
- const std::shared_ptr<const CRANInstalledRepository> cran_installed_repository;
-
- SupportsActionQuery(const std::shared_ptr<const CRANRepository> & c, const std::shared_ptr<const CRANInstalledRepository> & r) :
- cran_repository(c),
- cran_installed_repository(r)
- {
- }
+ bool is_installed;
bool visit(const SupportsActionTest<FetchAction> &) const
{
- return bool(cran_repository);
+ return ! is_installed;
}
bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- return bool(cran_repository);
+ return ! is_installed;
}
bool visit(const SupportsActionTest<InstallAction> &) const
{
- return bool(cran_repository);
+ return ! is_installed;
}
bool visit(const SupportsActionTest<ConfigAction> &) const
@@ -519,7 +507,8 @@ namespace
bool
CRANPackageID::supports_action(const SupportsActionTestBase & b) const
{
- SupportsActionQuery q(_imp->cran_repository, _imp->cran_installed_repository);
+ auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
+ SupportsActionQuery q{bool(repo->installed_root_key())};
return b.accept_returning<bool>(q);
}
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index af8acb3..7cbc26e 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -43,9 +43,9 @@ namespace paludis
virtual void need_masks_added() const;
public:
- CRANPackageID(const Environment * const, const std::shared_ptr<const CRANRepository> &,
+ CRANPackageID(const Environment * const, const RepositoryName &,
const FSPath &);
- CRANPackageID(const Environment * const, const std::shared_ptr<const CRANRepository> &,
+ CRANPackageID(const Environment * const, const RepositoryName &,
const CRANPackageID * const, const std::string &);
~CRANPackageID();
@@ -53,7 +53,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;
@@ -77,7 +77,6 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > fs_location_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > behaviours_key() const;
virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
-
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const PALUDIS_ATTRIBUTE((noreturn));
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 8e84671..b09bcf9 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -228,7 +228,7 @@ CRANRepository::need_ids() const
if (is_file_with_extension(*d, ".DESCRIPTION", { }))
{
std::shared_ptr<cranrepository::CRANPackageID> id(std::make_shared<cranrepository::CRANPackageID>(_imp->params.environment(),
- shared_from_this(), *d));
+ name(), *d));
if (! _imp->ids.insert(std::make_pair(id->name(), id)).second)
Log::get_instance()->message("cran.id.duplicate", ll_warning, lc_context)
<< "Couldn't insert package '" << *id << "' due to name collision";
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index 5def6da..02f0e4c 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -32,6 +32,8 @@
#include <paludis/formatter.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
#include <functional>
using namespace paludis;
@@ -87,8 +89,9 @@ PackageIDSequenceKey::pretty_print_flat(const Formatter<PackageID> & f) const
std::cref(f), _1, format::Plain()));
}
-PackageIDKey::PackageIDKey(const std::string & r, const std::string & h,
+PackageIDKey::PackageIDKey(const Environment * const e, const std::string & r, const std::string & h,
const CRANPackageID * const v, const MetadataKeyType t) :
+ _env(e),
_v(v),
_r(r),
_h(h),
@@ -123,7 +126,8 @@ PackageIDKey::type() const
std::string
PackageIDKey::pretty_print(const Formatter<PackageID> & f) const
{
- if (_v->repository()->installed_root_key())
+ auto repo(_env->package_database()->fetch_repository(_v->repository_name()));
+ if (repo->installed_root_key())
return f.format(*_v, format::Installed());
else if (_v->supports_action(SupportsActionTest<InstallAction>()))
{
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index 1a0eca5..c2b3888 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -62,6 +62,7 @@ namespace paludis
public MetadataValueKey<std::shared_ptr<const PackageID> >
{
private:
+ const Environment * const _env;
const CRANPackageID * const _v;
const std::string _r;
@@ -69,7 +70,7 @@ namespace paludis
const MetadataKeyType _t;
public:
- PackageIDKey(const std::string &, const std::string &, const CRANPackageID * const, const MetadataKeyType);
+ PackageIDKey(const Environment * const, const std::string &, const std::string &, const CRANPackageID * const, const MetadataKeyType);
virtual const std::shared_ptr<const PackageID> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 5f97d7f..14b06d9 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -42,6 +42,7 @@
#include <paludis/choice.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/package_database.hh>
#include <map>
#include <list>
#include <set>
@@ -248,13 +249,14 @@ namespace
template <typename T_>
void dependency_label_handler(
+ const Environment * const env,
const typename ParseStackTypes<T_>::Stack & h,
const typename ParseStackTypes<T_>::AnnotationsGoHere & annotations_go_here,
const std::shared_ptr<const PackageID> & id,
const std::string & s,
const EAPI & eapi)
{
- std::shared_ptr<DependenciesLabelsDepSpec> spec(parse_dependency_label(id, s, eapi));
+ std::shared_ptr<DependenciesLabelsDepSpec> spec(parse_dependency_label(env, id, s, eapi));
h.begin()->item()->append(spec);
annotations_go_here(spec, make_null_shared_ptr());
}
@@ -300,9 +302,10 @@ namespace
const std::shared_ptr<const PackageID> & id,
const EAPI & eapi)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
std::shared_ptr<ConditionalDepSpec> spec(std::make_shared<ConditionalDepSpec>(parse_elike_conditional_dep_spec(
u, env, id,
- bool(id->repository()->installed_root_key()) || ! eapi.supported()->package_dep_spec_parse_options()[epdso_missing_use_deps_is_qa])));
+ bool(repo->installed_root_key()) || ! eapi.supported()->package_dep_spec_parse_options()[epdso_missing_use_deps_is_qa])));
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
n::item() = stack.begin()->item()->append(spec),
n::spec() = spec
@@ -495,7 +498,7 @@ paludis::erepository::parse_depend(const std::string & s,
n::on_arrow() = std::bind(&arrows_not_allowed_handler, s, _1, _2),
n::on_error() = std::bind(&error_handler, s, _1),
n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s),
- n::on_label() = std::bind(&dependency_label_handler<DependencySpecTree>,
+ n::on_label() = std::bind(&dependency_label_handler<DependencySpecTree>, env,
std::ref(stack),
ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate_maybe_block, std::ref(thing_to_annotate), _1, std::ref(thing_to_annotate_if_block), _2)),
@@ -879,11 +882,13 @@ paludis::erepository::parse_plain_text_label(const std::string & s)
namespace
{
bool enabled_if_option(
+ const Environment * const env,
const std::shared_ptr<const PackageID> & id,
const std::string label,
const ChoiceNameWithPrefix n)
{
- if (id->repository()->installed_root_key())
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ if (repo->installed_root_key())
return false;
if (! id->choices_key())
@@ -953,6 +958,7 @@ namespace
std::shared_ptr<DependenciesLabelsDepSpec>
paludis::erepository::parse_dependency_label(
+ const Environment * const env,
const std::shared_ptr<const PackageID> & id,
const std::string & s,
const EAPI & e)
@@ -995,7 +1001,7 @@ paludis::erepository::parse_dependency_label(
l->add_label(std::make_shared<DependenciesTestLabel>(*it, return_literal_function(true)));
else
l->add_label(std::make_shared<DependenciesTestLabel>(*it, std::bind(
- &enabled_if_option, id, *it, ChoiceNameWithPrefix(cc))));
+ &enabled_if_option, env, id, *it, ChoiceNameWithPrefix(cc))));
}
else if (c == "WarnAndIgnore")
{
diff --git a/paludis/repositories/e/dep_parser.hh b/paludis/repositories/e/dep_parser.hh
index 2cf0507..64f5356 100644
--- a/paludis/repositories/e/dep_parser.hh
+++ b/paludis/repositories/e/dep_parser.hh
@@ -59,6 +59,7 @@ namespace paludis
* Parse a dep spec label.
*/
std::shared_ptr<DependenciesLabelsDepSpec> parse_dependency_label(
+ const Environment * const,
const std::shared_ptr<const PackageID> &,
const std::string & s,
const EAPI &) PALUDIS_VISIBLE;
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 50584d0..8bd29ab 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -139,9 +139,10 @@ EInstalledRepository::some_ids_might_not_be_masked() const
}
bool
-EInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+EInstalledRepository::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->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "e" || f == "ebuild" || f == "exheres" || f == "portage";
}
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index d5d612a..ce9b7ce 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -50,6 +50,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/elike_choices.hh>
+#include <paludis/package_database.hh>
#include <iterator>
@@ -147,7 +148,7 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
const Environment * const environment;
- const std::shared_ptr<const Repository> repository;
+ const RepositoryName repository_name;
const FSPath dir;
mutable std::shared_ptr<EInstalledRepositoryIDKeys> keys;
@@ -158,11 +159,11 @@ namespace paludis
Imp(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const Repository> r, const FSPath & f) :
+ const RepositoryName & r, const FSPath & f) :
name(q),
version(v),
environment(e),
- repository(r),
+ repository_name(r),
dir(f)
{
}
@@ -171,7 +172,7 @@ namespace paludis
EInstalledRepositoryID::EInstalledRepositoryID(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const Repository> & r,
+ const RepositoryName & r,
const FSPath & f) :
Pimp<EInstalledRepositoryID>(q, v, e, r, f),
_imp(Pimp<EInstalledRepositoryID>::_imp)
@@ -617,16 +618,16 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_full:
if (_imp->keys && _imp->keys->slot)
return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->keys->slot->value()) + "::" +
- stringify(repository()->name());
+ stringify(repository_name());
- return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
if (_imp->keys && _imp->keys->slot)
return stringify(name()) + ":" + stringify(_imp->keys->slot->value()) + "::" +
- stringify(repository()->name());
+ stringify(repository_name());
- return stringify(name()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository_name());
case idcf_version:
return stringify(version());
@@ -634,9 +635,9 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
if (_imp->keys && _imp->keys->slot)
return stringify(version()) + ":" + stringify(_imp->keys->slot->value()) + "::" +
- stringify(repository()->name());
+ stringify(repository_name());
- return stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(version()) + "::" + stringify(repository_name());
case last_idcf:
break;
@@ -649,7 +650,7 @@ PackageDepSpec
EInstalledRepositoryID::uniquely_identifying_spec() const
{
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->environment, { });
}
@@ -665,10 +666,10 @@ EInstalledRepositoryID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-EInstalledRepositoryID::repository() const
+const RepositoryName
+EInstalledRepositoryID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::shared_ptr<const EAPI>
@@ -974,26 +975,25 @@ namespace
{
struct PerformAction
{
+ const Environment * const env;
const std::shared_ptr<const erepository::ERepositoryID> id;
- PerformAction(const std::shared_ptr<const erepository::ERepositoryID> i) :
- id(i)
- {
- }
-
void visit(const UninstallAction & a)
{
- std::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(id, a);
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ std::static_pointer_cast<const EInstalledRepository>(repo)->perform_uninstall(id, a);
}
void visit(const ConfigAction & a)
{
- std::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_config(id, a);
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ std::static_pointer_cast<const EInstalledRepository>(repo)->perform_config(id, a);
}
void visit(const InfoAction & a)
{
- std::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_info(id, a);
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ std::static_pointer_cast<const EInstalledRepository>(repo)->perform_info(id, a);
}
void visit(const InstallAction & a) PALUDIS_ATTRIBUTE((noreturn));
@@ -1026,7 +1026,7 @@ namespace
void
EInstalledRepositoryID::perform_action(Action & a) const
{
- PerformAction b(shared_from_this());
+ PerformAction b{_imp->environment, shared_from_this()};
a.accept(b);
}
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index d61c66b..330d546 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -43,7 +43,7 @@ namespace paludis
EInstalledRepositoryID(const QualifiedPackageName &, const VersionSpec &,
const Environment * const,
- const std::shared_ptr<const Repository> &,
+ const RepositoryName &,
const FSPath & file);
public:
@@ -54,7 +54,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 const std::shared_ptr<const EAPI> eapi() const;
virtual const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 808d162..32e1c3e 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -982,11 +982,12 @@ ERepository::params() const
}
bool
-ERepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+ERepository::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->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
if (f == "e")
- return static_cast<const ERepositoryID &>(*e).eapi()->supported()->can_be_pbin();
+ return static_cast<const ERepositoryID &>(*id).eapi()->supported()->can_be_pbin();
else
return false;
}
@@ -1775,7 +1776,7 @@ ERepository::make_id(const QualifiedPackageName & q, const FSPath & f) const
std::shared_ptr<EbuildID> result(std::make_shared<EbuildID>(q, extract_package_file_version(q, f),
_imp->params.environment(),
- shared_from_this(), f, _guess_eapi(q, f),
+ name(), f, _guess_eapi(q, f),
_imp->master_mtime, _imp->eclass_mtimes));
return result;
}
@@ -1959,7 +1960,7 @@ ERepository::merge(const MergeParams & m)
if (is_replace && (*r)->name() == is_replace->name() && (*r)->version() == is_replace->version())
continue;
- if ((*r)->repository()->name() != name())
+ if ((*r)->repository_name() != name())
continue;
FSPath p((*r)->fs_location_key()->value());
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index b593474..d3b4a31 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -389,6 +389,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -434,6 +435,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -874,6 +876,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
+ env.package_database()->add_repository(1, repo);
repo->make_manifest(QualifiedPackageName("category/package"));
std::multiset<std::string> made_manifest, reference_manifest;
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 1f8771c..4f5dfd8 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -310,7 +310,7 @@ ERepositorySets::security_set(bool insecurity) const
.version_requirement(make_named_values<VersionRequirement>(
n::version_operator() = vo_equal,
n::version_spec() = (*c)->version()))
- .in_repository((*c)->repository()->name())));
+ .in_repository((*c)->repository_name())));
spec->set_tag(glsa_tags.find(glsa->id())->second);
security_packages->top()->append(spec);
}
@@ -343,7 +343,7 @@ ERepositorySets::security_set(bool insecurity) const
.version_requirement(make_named_values<VersionRequirement>(
n::version_operator() = vo_equal,
n::version_spec() = (*r)->version()))
- .in_repository((*r)->repository()->name())));
+ .in_repository((*r)->repository_name())));
spec->set_tag(glsa_tags.find(glsa->id())->second);
security_packages->top()->append(spec);
ok = true;
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 5f4abe1..a51c1c8 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -160,7 +160,7 @@ EbuildCommand::operator() ()
.setenv("PN", stringify(params.package_id()->name().package()))
.setenv("PVR", stringify(params.package_id()->version()))
.setenv("CATEGORY", stringify(params.package_id()->name().category()))
- .setenv("REPOSITORY", stringify(params.package_id()->repository()->name()))
+ .setenv("REPOSITORY", stringify(params.package_id()->repository_name()))
.setenv("EAPI", stringify(params.package_id()->eapi()->exported_name()))
.setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
@@ -511,7 +511,11 @@ EbuildMetadataCommand::load(const std::shared_ptr<const EbuildID> & id)
if (! ((s = get(keys, id->eapi()->supported()->ebuild_metadata_variables()->eapi()->name()))).empty())
id->set_eapi(s);
else
- id->set_eapi(id->e_repository()->params().eapi_when_unspecified());
+ {
+ auto repo(params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+ id->set_eapi(e_repo->params().eapi_when_unspecified());
+ }
if (! id->eapi()->supported())
{
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 4c85e8a..30d9c8f 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -36,6 +36,8 @@
#include <paludis/stringify_formatter.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/pimp-impl.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
#include <set>
#include <map>
#include <list>
@@ -130,7 +132,8 @@ namespace
{
std::set<std::string> tokens;
tokenise_whitespace(lines[m.inherited()->flat_list_index()], std::inserter(tokens, tokens.begin()));
- FSPath eclassdir((id->repository()->location_key()->value() / "eclass").realpath_if_exists());
+ auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists());
for (std::set<std::string>::const_iterator it(tokens.begin()),
it_end(tokens.end()); it_end != it; ++it)
{
@@ -401,7 +404,8 @@ EbuildFlatMetadataCache::load(const std::shared_ptr<const EbuildID> & id, const
{
std::vector<std::string> eclasses;
tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(keys["_eclasses_"], "\t", "", std::back_inserter(eclasses));
- FSPath eclassdir((id->repository()->location_key()->value() / "eclass").realpath_if_exists());
+ auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists());
for (std::vector<std::string>::const_iterator it(eclasses.begin()),
it_end(eclasses.end()); it_end != it; ++it)
{
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 22d021b..50c077f 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -117,7 +117,7 @@ namespace paludis
const QualifiedPackageName name;
const VersionSpec version;
const Environment * const environment;
- const std::shared_ptr<const ERepository> repository;
+ const RepositoryName repository_name;
const FSPath ebuild;
mutable std::shared_ptr<const EAPI> eapi;
const std::string guessed_eapi;
@@ -168,12 +168,12 @@ namespace paludis
Imp(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const ERepository> r, const FSPath & f, const std::string & g,
+ const RepositoryName & r, const FSPath & f, const std::string & g,
const time_t t, const std::shared_ptr<const EclassMtimes> & m) :
name(q),
version(v),
environment(e),
- repository(r),
+ repository_name(r),
ebuild(f),
guessed_eapi(g),
master_mtime(t),
@@ -185,14 +185,26 @@ namespace paludis
};
}
+namespace
+{
+ std::string guess_eapi(const std::string & g, const Environment * const env, const RepositoryName & repo_name)
+ {
+ if (! g.empty())
+ return g;
+ auto repo(env->package_database()->fetch_repository(repo_name));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+ return e_repo->params().eapi_when_unknown();
+ }
+}
+
EbuildID::EbuildID(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const ERepository> & r,
+ const RepositoryName & r,
const FSPath & f,
const std::string & g,
const time_t t,
const std::shared_ptr<const EclassMtimes> & m) :
- Pimp<EbuildID>(q, v, e, r, f, g.empty() ? r->params().eapi_when_unknown() : g, t, m),
+ Pimp<EbuildID>(q, v, e, r, f, guess_eapi(g, e, r), t, m),
_imp(Pimp<EbuildID>::_imp)
{
}
@@ -221,25 +233,27 @@ EbuildID::need_keys_added() const
Context context("When generating metadata for ID '" + canonical_form(idcf_full) + "':");
- FSPath cache_file(_imp->repository->params().cache());
+ auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+ FSPath cache_file(e_repo->params().cache());
cache_file /= stringify(name().category());
cache_file /= stringify(name().package()) + "-" + stringify(version());
- FSPath write_cache_file(_imp->repository->params().write_cache());
- if (_imp->repository->params().append_repository_name_to_write_cache())
- write_cache_file /= stringify(repository()->name());
+ FSPath write_cache_file(e_repo->params().write_cache());
+ if (e_repo->params().append_repository_name_to_write_cache())
+ write_cache_file /= stringify(repository_name());
write_cache_file /= stringify(name().category());
write_cache_file /= stringify(name().package()) + "-" + stringify(version());
bool ok(false);
- if (_imp->repository->params().cache().basename() != "empty")
+ if (e_repo->params().cache().basename() != "empty")
{
EbuildFlatMetadataCache metadata_cache(_imp->environment, cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, false);
if (metadata_cache.load(shared_from_this(), false))
ok = true;
}
- if ((! ok) && _imp->repository->params().write_cache().basename() != "empty")
+ if ((! ok) && e_repo->params().write_cache().basename() != "empty")
{
EbuildFlatMetadataCache write_metadata_cache(_imp->environment,
write_cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, true);
@@ -261,12 +275,11 @@ EbuildID::need_keys_added() const
if (! ok)
{
- if (_imp->repository->params().cache().basename() != "empty")
+ if (e_repo->params().cache().basename() != "empty")
Log::get_instance()->message("e.ebuild.cache.no_usable", ll_qa, lc_no_context)
<< "No usable cache entry for '" + canonical_form(idcf_full);
- _imp->environment->trigger_notifier_callback(NotifierCallbackGeneratingMetadataEvent(
- _imp->repository->name()));
+ _imp->environment->trigger_notifier_callback(NotifierCallbackGeneratingMetadataEvent(repository_name()));
_imp->eapi = EAPIData::get_instance()->eapi_from_string(_imp->guessed_eapi);
@@ -283,22 +296,22 @@ EbuildID::need_keys_added() const
+ (count == 0 ? "no" : stringify(count)) + " ebuild variable phases but expected exactly one");
EbuildMetadataCommand cmd(make_named_values<EbuildCommandParams>(
- n::builddir() = _imp->repository->params().builddir(),
+ n::builddir() = e_repo->params().builddir(),
n::clearenv() = phases.begin_phases()->option("clearenv"),
n::commands() = join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "),
- n::distdir() = _imp->repository->params().distdir(),
- n::ebuild_dir() = _imp->repository->layout()->package_directory(name()),
+ n::distdir() = e_repo->params().distdir(),
+ n::ebuild_dir() = e_repo->layout()->package_directory(name()),
n::ebuild_file() = _imp->ebuild,
- n::eclassdirs() = _imp->repository->params().eclassdirs(),
+ n::eclassdirs() = e_repo->params().eclassdirs(),
n::environment() = _imp->environment,
- n::exlibsdirs() = _imp->repository->layout()->exlibsdirs(name()),
- n::files_dir() = _imp->repository->layout()->package_directory(name()) / "files",
+ n::exlibsdirs() = e_repo->layout()->exlibsdirs(name()),
+ n::files_dir() = e_repo->layout()->package_directory(name()) / "files",
n::maybe_output_manager() = make_null_shared_ptr(),
- n::package_builddir() = _imp->repository->params().builddir() / (stringify(name().category()) + "-" + stringify(name().package()) + "-" + stringify(version()) + "-metadata"),
+ n::package_builddir() = e_repo->params().builddir() / (stringify(name().category()) + "-" + stringify(name().package()) + "-" + stringify(version()) + "-metadata"),
n::package_id() = shared_from_this(),
n::portdir() =
- (_imp->repository->params().master_repositories() && ! _imp->repository->params().master_repositories()->empty()) ?
- (*_imp->repository->params().master_repositories()->begin())->params().location() : _imp->repository->params().location(),
+ (e_repo->params().master_repositories() && ! e_repo->params().master_repositories()->empty()) ?
+ (*e_repo->params().master_repositories()->begin())->params().location() : e_repo->params().location(),
n::root() = "/",
n::sandbox() = phases.begin_phases()->option("sandbox"),
n::sydbox() = phases.begin_phases()->option("sydbox"),
@@ -314,7 +327,7 @@ EbuildID::need_keys_added() const
Log::get_instance()->message("e.ebuild.metadata.generated_eapi", ll_debug, lc_context) << "Generated metadata for '"
<< canonical_form(idcf_full) << "' has EAPI '" << _imp->eapi->name() << "'";
- if (_imp->repository->params().write_cache().basename() != "empty" && _imp->eapi->supported())
+ if (e_repo->params().write_cache().basename() != "empty" && _imp->eapi->supported())
{
EbuildFlatMetadataCache metadata_cache(_imp->environment, write_cache_file, _imp->ebuild, _imp->master_mtime,
_imp->eclass_mtimes, false);
@@ -331,10 +344,10 @@ EbuildID::need_keys_added() const
add_metadata_key(std::make_shared<LiteralMetadataValueKey<std::string>>("EAPI", "EAPI", mkt_internal, _imp->eapi->name()));
_imp->repository_mask = std::make_shared<EMutableRepositoryMaskInfoKey>(shared_from_this(), "repository_mask", "Repository masked",
- std::static_pointer_cast<const ERepository>(repository())->repository_masked(shared_from_this()), mkt_internal);
+ e_repo->repository_masked(shared_from_this()), mkt_internal);
add_metadata_key(_imp->repository_mask);
_imp->profile_mask = std::make_shared<EMutableRepositoryMaskInfoKey>(shared_from_this(), "profile_mask", "Profile masked",
- std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(shared_from_this()), mkt_internal);
+ e_repo->profile()->profile_masked(shared_from_this()), mkt_internal);
add_metadata_key(_imp->profile_mask);
std::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > maybe_use_descriptions;
@@ -344,12 +357,12 @@ EbuildID::need_keys_added() const
_imp->eapi->supported()->ebuild_metadata_variables()->use_expand()->name(),
_imp->eapi->supported()->ebuild_metadata_variables()->use_expand()->description(),
mkt_internal,
- e_repository()->profile()->use_expand());
+ e_repo->profile()->use_expand());
_imp->raw_use_expand_hidden = std::make_shared<LiteralMetadataStringSetKey>(
_imp->eapi->supported()->ebuild_metadata_variables()->use_expand_hidden()->name(),
_imp->eapi->supported()->ebuild_metadata_variables()->use_expand_hidden()->description(),
mkt_internal,
- e_repository()->profile()->use_expand_hidden());
+ e_repo->profile()->use_expand_hidden());
std::shared_ptr<const MetadataXML> m(MetadataXMLPool::get_instance()->metadata_if_exists(
_imp->fs_location->value().dirname() / "metadata.xml"));
@@ -372,15 +385,15 @@ EbuildID::need_keys_added() const
throw InternalError(PALUDIS_HERE, "no raw_iuse?");
std::copy(_imp->raw_iuse->value()->begin(), _imp->raw_iuse->value()->end(), iuse_effective->inserter());
- std::copy(e_repository()->profile()->iuse_implicit()->begin(), e_repository()->profile()->iuse_implicit()->end(),
+ std::copy(e_repo->profile()->iuse_implicit()->begin(), e_repo->profile()->iuse_implicit()->end(),
iuse_effective->inserter());
- const std::shared_ptr<const Set<std::string> > use_expand(e_repository()->profile()->use_expand());
- const std::shared_ptr<const Set<std::string> > use_expand_unprefixed(e_repository()->profile()->use_expand_unprefixed());
+ const std::shared_ptr<const Set<std::string> > use_expand(e_repo->profile()->use_expand());
+ const std::shared_ptr<const Set<std::string> > use_expand_unprefixed(e_repo->profile()->use_expand_unprefixed());
const std::string separator(stringify(_imp->eapi->supported()->choices_options()->use_expand_separator()));
- for (Set<std::string>::ConstIterator x(e_repository()->profile()->use_expand_implicit()->begin()),
- x_end(e_repository()->profile()->use_expand_implicit()->end()) ;
+ for (Set<std::string>::ConstIterator x(e_repo->profile()->use_expand_implicit()->begin()),
+ x_end(e_repo->profile()->use_expand_implicit()->end()) ;
x != x_end ; ++x)
{
std::string lower_x;
@@ -393,7 +406,7 @@ EbuildID::need_keys_added() const
Log::get_instance()->message("e.ebuild.iuse_effective.neither", ll_qa, lc_context)
<< "USE_EXPAND_IMPLICIT value " << *x << " is not in either USE_EXPAND or USE_EXPAND_UNPREFIXED";
- const std::shared_ptr<const Set<std::string> > values(e_repository()->profile()->use_expand_values(*x));
+ const std::shared_ptr<const Set<std::string> > values(e_repo->profile()->use_expand_values(*x));
for (Set<std::string>::ConstIterator v(values->begin()), v_end(values->end()) ;
v != v_end ; ++v)
{
@@ -414,7 +427,7 @@ EbuildID::need_keys_added() const
_imp->choices = std::make_shared<EChoicesKey>(_imp->environment, shared_from_this(), "PALUDIS_CHOICES",
_imp->eapi->supported()->ebuild_environment_variables()->description_choices(),
- mkt_normal, e_repository(),
+ mkt_normal, e_repo,
maybe_use_descriptions);
if (_imp->eapi->supported()->is_pbin())
@@ -425,7 +438,7 @@ EbuildID::need_keys_added() const
}
else
_imp->choices = std::make_shared<EChoicesKey>(_imp->environment, shared_from_this(), "PALUDIS_CHOICES", "Choices", mkt_normal,
- e_repository(), maybe_use_descriptions);
+ e_repo, maybe_use_descriptions);
add_metadata_key(_imp->choices);
}
@@ -602,8 +615,11 @@ EbuildID::invalidate_masks() const
_imp->has_masks = false;
PackageID::invalidate_masks();
- _imp->repository_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->repository_masked(shared_from_this()));
- _imp->profile_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(shared_from_this()));
+
+ auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+ _imp->repository_mask->set_value(e_repo->repository_masked(shared_from_this()));
+ _imp->profile_mask->set_value(e_repo->profile()->profile_masked(shared_from_this()));
}
const std::string
@@ -614,16 +630,16 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_full:
if (_imp->slot)
return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->value()) +
- "::" + stringify(repository()->name());
+ "::" + stringify(repository_name());
- return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name());
case idcf_no_version:
if (_imp->slot)
return stringify(name()) + ":" + stringify(_imp->slot->value()) +
- "::" + stringify(repository()->name());
+ "::" + stringify(repository_name());
- return stringify(name()) + "::" + stringify(repository()->name());
+ return stringify(name()) + "::" + stringify(repository_name());
case idcf_version:
return stringify(version());
@@ -631,9 +647,9 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
if (_imp->slot)
return stringify(version()) + ":" + stringify(_imp->slot->value()) + "::" +
- stringify(repository()->name());
+ stringify(repository_name());
- return stringify(version()) + "::" + stringify(repository()->name());
+ return stringify(version()) + "::" + stringify(repository_name());
case last_idcf:
break;
@@ -646,7 +662,7 @@ PackageDepSpec
EbuildID::uniquely_identifying_spec() const
{
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->environment, { });
}
@@ -662,10 +678,10 @@ EbuildID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-EbuildID::repository() const
+const RepositoryName
+EbuildID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::shared_ptr<const EAPI>
@@ -917,12 +933,6 @@ EbuildID::guessed_eapi_name() const
return _imp->guessed_eapi;
}
-std::shared_ptr<const ERepository>
-EbuildID::e_repository() const
-{
- return _imp->repository;
-}
-
void
EbuildID::load_captured_stderr(const std::string & r, const std::string & h, const MetadataKeyType t, const std::string & v) const
{
@@ -1230,36 +1240,44 @@ namespace
void visit(InstallAction & a)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_install_action(
env,
- std::static_pointer_cast<const ERepository>(id->repository()).get(),
+ e_repo.get(),
std::static_pointer_cast<const ERepositoryID>(id),
a);
}
void visit(FetchAction & a)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_fetch_action(
env,
- std::static_pointer_cast<const ERepository>(id->repository()).get(),
+ e_repo.get(),
std::static_pointer_cast<const ERepositoryID>(id),
a);
}
void visit(PretendFetchAction & a)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_pretend_fetch_action(
env,
- std::static_pointer_cast<const ERepository>(id->repository()).get(),
+ e_repo.get(),
std::static_pointer_cast<const ERepositoryID>(id),
a);
}
void visit(PretendAction & action)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
if (! do_pretend_action(
env,
- std::static_pointer_cast<const ERepository>(id->repository()).get(),
+ e_repo.get(),
std::static_pointer_cast<const ERepositoryID>(id),
action))
action.set_failed();
@@ -1267,9 +1285,11 @@ namespace
void visit(InfoAction & action)
{
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_info_action(
env,
- std::static_pointer_cast<const ERepository>(id->repository()).get(),
+ e_repo.get(),
std::static_pointer_cast<const ERepositoryID>(id),
action);
}
@@ -1395,6 +1415,9 @@ EbuildID::make_choice_value(
if (! eapi()->supported())
throw InternalError(PALUDIS_HERE, "Unsupported EAPI");
+ auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+
std::string name_with_prefix_s;
if (stringify(choice->prefix()).empty())
name_with_prefix_s = stringify(value_name);
@@ -1415,12 +1438,12 @@ EbuildID::make_choice_value(
}
else
{
- if (_imp->repository->profile()->use_masked(shared_from_this(), choice, value_name, name_with_prefix))
+ if (e_repo->profile()->use_masked(shared_from_this(), choice, value_name, name_with_prefix))
{
locked = true;
enabled = enabled_by_default = false;
}
- else if (_imp->repository->profile()->use_forced(shared_from_this(), choice, value_name, name_with_prefix))
+ else if (e_repo->profile()->use_forced(shared_from_this(), choice, value_name, name_with_prefix))
{
locked = true;
enabled = enabled_by_default = true;
@@ -1436,7 +1459,7 @@ EbuildID::make_choice_value(
}
else
{
- Tribool profile_want(_imp->repository->profile()->use_state_ignoring_masks(shared_from_this(), choice, value_name, name_with_prefix));
+ Tribool profile_want(e_repo->profile()->use_state_ignoring_masks(shared_from_this(), choice, value_name, name_with_prefix));
if (profile_want.is_true())
enabled_by_default = true;
else if (profile_want.is_false())
@@ -1458,7 +1481,7 @@ EbuildID::make_choice_value(
}
return std::make_shared<EChoiceValue>(choice->prefix(), value_name, ChoiceNameWithPrefix(name_with_prefix), name(),
- _imp->repository->use_desc(),
+ e_repo->use_desc(),
enabled, enabled_by_default, force_locked || locked, explicitly_listed, override_description, "");
}
@@ -1585,15 +1608,18 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
void
EbuildID::purge_invalid_cache() const
{
- FSPath write_cache_file(_imp->repository->params().write_cache());
- if (_imp->repository->params().append_repository_name_to_write_cache())
- write_cache_file /= stringify(repository()->name());
+ auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+
+ FSPath write_cache_file(e_repo->params().write_cache());
+ if (e_repo->params().append_repository_name_to_write_cache())
+ write_cache_file /= stringify(repository_name());
write_cache_file /= stringify(name().category());
write_cache_file /= stringify(name().package()) + "-" + stringify(version());
if (write_cache_file.stat().exists())
{
- if (_imp->repository->params().write_cache().basename() != "empty")
+ if (e_repo->params().write_cache().basename() != "empty")
{
EbuildFlatMetadataCache write_metadata_cache(_imp->environment,
write_cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, true);
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 299ef3a..ebac1a6 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -27,7 +27,6 @@
namespace paludis
{
- class ERepository;
class EclassMtimes;
namespace erepository
@@ -49,7 +48,7 @@ namespace paludis
public:
EbuildID(const QualifiedPackageName &, const VersionSpec &,
const Environment * const e,
- const std::shared_ptr<const ERepository> &,
+ const RepositoryName &,
const FSPath & file,
const std::string & guessed_eapi,
const time_t master_mtime,
@@ -62,7 +61,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 const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > > virtual_for_key() const;
@@ -116,8 +115,6 @@ namespace paludis
virtual std::size_t extra_hash_value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::shared_ptr<const ERepository> e_repository() const;
-
void set_eapi(const std::string &) const;
std::string guessed_eapi_name() const;
diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc
index 6cfca56..51ed864 100644
--- a/paludis/repositories/e/exndbam_id.cc
+++ b/paludis/repositories/e/exndbam_id.cc
@@ -88,7 +88,7 @@ namespace
ExndbamID::ExndbamID(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const Repository> & r,
+ const RepositoryName & r,
const FSPath & f, const NDBAM * const n) :
EInstalledRepositoryID(q, v, e, r, f),
_ndbam(n)
diff --git a/paludis/repositories/e/exndbam_id.hh b/paludis/repositories/e/exndbam_id.hh
index 54d1cfd..945c78a 100644
--- a/paludis/repositories/e/exndbam_id.hh
+++ b/paludis/repositories/e/exndbam_id.hh
@@ -36,7 +36,7 @@ namespace paludis
public:
ExndbamID(const QualifiedPackageName &, const VersionSpec &,
const Environment * const,
- const std::shared_ptr<const Repository> &,
+ const RepositoryName &,
const FSPath & file,
const NDBAM * const);
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 3cf7194..c59feb8 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -217,7 +217,7 @@ ExndbamRepository::package_ids(const QualifiedPackageName & q) const
Lock l(*(*e).mutex());
if (! (*e).package_id())
(*e).package_id() = std::make_shared<ExndbamID>((*e).name(), (*e).version(), _imp->params.environment(),
- shared_from_this(), (*e).fs_location(), &_imp->ndbam);
+ name(), (*e).fs_location(), &_imp->ndbam);
result->push_back((*e).package_id());
}
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 68031c1..e63a510 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -39,6 +39,7 @@
#include <paludis/util/fs_path.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/output_manager.hh>
+#include <paludis/package_database.hh>
#include <algorithm>
#include <list>
@@ -158,7 +159,8 @@ FetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::T
if (! *_imp->labels.begin())
throw ActionFailedError("No fetch action label available");
- SourceURIFinder source_uri_finder(_imp->env, _imp->id->repository().get(),
+ auto repo(_imp->env->package_database()->fetch_repository(_imp->id->repository_name()));
+ SourceURIFinder source_uri_finder(_imp->env, repo.get(),
node.spec()->original_url(), node.spec()->filename(), _imp->mirrors_name, _imp->get_mirrors_fn);
(*_imp->labels.begin())->accept(source_uri_finder);
for (SourceURIFinder::ConstIterator i(source_uri_finder.begin()), i_end(source_uri_finder.end()) ;
@@ -221,7 +223,7 @@ FetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::T
.setenv("PNVR", stringify(_imp->id->name().package()) + "-" +
stringify(_imp->id->version()))
.setenv("CATEGORY", stringify(_imp->id->name().category()))
- .setenv("REPOSITORY", stringify(_imp->id->repository()->name()))
+ .setenv("REPOSITORY", stringify(_imp->id->repository_name()))
.setenv("EAPI", stringify(_imp->eapi.name()))
.setenv("SLOT", "")
.setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index 45c58bf..d708e37 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -26,7 +26,7 @@ using namespace paludis::erepository;
VDBID::VDBID(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
- const std::shared_ptr<const Repository> & r,
+ const RepositoryName & r,
const FSPath & f) :
EInstalledRepositoryID(q, v, e, r, f)
{
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index 500d92b..9032a6c 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -32,7 +32,7 @@ namespace paludis
public:
VDBID(const QualifiedPackageName &, const VersionSpec &,
const Environment * const,
- const std::shared_ptr<const Repository> &,
+ const RepositoryName &,
const FSPath & file);
virtual std::string fs_location_raw_name() const;
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index c88944b..e9e7511 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -1134,7 +1134,7 @@ VDBRepository::make_id(const QualifiedPackageName & q, const VersionSpec & v, co
Context context("When creating ID for '" + stringify(q) + "-" + stringify(v) + "' from '" + stringify(f) + "':");
- std::shared_ptr<VDBID> result(std::make_shared<VDBID>(q, v, _imp->params.environment(), shared_from_this(), f));
+ std::shared_ptr<VDBID> result(std::make_shared<VDBID>(q, v, _imp->params.environment(), name(), f));
return result;
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 0d350f1..d1f6f62 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -29,6 +29,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/choice.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/package_database.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/pimp-impl.hh>
@@ -688,7 +689,7 @@ namespace paludis
mutable Mutex mutex;
const Environment * const env;
- const std::shared_ptr<const FakeRepositoryBase> repository;
+ const RepositoryName repository_name;
const QualifiedPackageName name;
const VersionSpec version;
@@ -698,8 +699,6 @@ namespace paludis
mutable std::shared_ptr<DependenciesLabelSequence> suggested_dependencies_labels;
std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot;
- std::shared_ptr<LiteralMetadataValueKey<std::shared_ptr<const PackageID> > > package_id;
- std::shared_ptr<LiteralMetadataValueKey<std::shared_ptr<const PackageID> > > virtual_for;
std::shared_ptr<FakeMetadataKeywordSetKey> keywords;
std::shared_ptr<FakeMetadataSpecTreeKey<LicenseSpecTree> > license;
std::shared_ptr<FakeMetadataSpecTreeKey<ProvideSpecTree> > provide;
@@ -719,10 +718,10 @@ namespace paludis
std::shared_ptr<Mask> unsupported_mask;
mutable bool has_masks;
- Imp(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
+ Imp(const Environment * const e, const RepositoryName & r,
const QualifiedPackageName & q, const VersionSpec & v) :
env(e),
- repository(r),
+ repository_name(r),
name(q),
version(v),
build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
@@ -745,7 +744,7 @@ namespace paludis
};
}
-FakePackageID::FakePackageID(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
+FakePackageID::FakePackageID(const Environment * const e, const RepositoryName & r,
const QualifiedPackageName & q, const VersionSpec & v) :
Pimp<FakePackageID>(e, r, q, v),
_imp(Pimp<FakePackageID>::_imp)
@@ -763,17 +762,17 @@ FakePackageID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->value())
- + "::" + stringify(_imp->repository->name());
+ + "::" + stringify(repository_name());
case idcf_version:
return stringify(_imp->version);
case idcf_no_version:
- return stringify(_imp->name) + ":" + stringify(_imp->slot->value()) + "::" + stringify(_imp->repository->name());
+ return stringify(_imp->name) + ":" + stringify(_imp->slot->value()) + "::" + stringify(repository_name());
case idcf_no_name:
return stringify(_imp->version) + ":" + stringify(_imp->slot->value())
- + "::" + stringify(_imp->repository->name());
+ + "::" + stringify(repository_name());
case last_idcf:
break;
@@ -786,7 +785,7 @@ PackageDepSpec
FakePackageID::uniquely_identifying_spec() const
{
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->env, { });
}
@@ -802,17 +801,16 @@ FakePackageID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-FakePackageID::repository() const
+const RepositoryName
+FakePackageID::repository_name() const
{
- return _imp->repository;
+ return _imp->repository_name;
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
FakePackageID::virtual_for_key() const
{
- need_keys_added();
- return _imp->virtual_for;
+ return make_null_shared_ptr();
}
const std::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >
@@ -1067,7 +1065,8 @@ FakePackageID::extra_hash_value() const
bool
FakePackageID::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
@@ -1200,59 +1199,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 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 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 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());
}
};
@@ -1261,7 +1263,7 @@ namespace
void
FakePackageID::perform_action(Action & a) const
{
- PerformAction b(this);
+ PerformAction b{_imp->env, this};
a.accept(b);
}
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index f72af34..ad2ecb3 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -256,7 +256,7 @@ namespace paludis
///\{
FakePackageID(const Environment * const e,
- const std::shared_ptr<const FakeRepositoryBase> &,
+ const RepositoryName &,
const QualifiedPackageName &, const VersionSpec &);
~FakePackageID();
@@ -266,7 +266,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/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index b3d4f04..0f2793e 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -159,7 +159,7 @@ FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpe
_imp->ids.find(q)->second->end(), VersionIs(v)))
throw InternalError(PALUDIS_HERE, "duplicate id added");
- std::shared_ptr<FakePackageID> id(std::make_shared<FakePackageID>(_imp->env, shared_from_this(), q, v));
+ std::shared_ptr<FakePackageID> id(std::make_shared<FakePackageID>(_imp->env, name(), q, v));
_imp->ids.find(q)->second->push_back(id);
return id;
}
diff --git a/paludis/repositories/gemcutter/gemcutter_id.cc b/paludis/repositories/gemcutter/gemcutter_id.cc
index 85a7bd6..1d70f81 100644
--- a/paludis/repositories/gemcutter/gemcutter_id.cc
+++ b/paludis/repositories/gemcutter/gemcutter_id.cc
@@ -125,7 +125,7 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const GemcutterRepository * const repo;
+ const RepositoryName repository_name;
std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key;
std::shared_ptr<LiteralMetadataValueKey<std::string> > authors_key;
@@ -143,7 +143,7 @@ namespace paludis
env(e.environment()),
name(CategoryNamePart("gem"), PackageNamePart(e.info().name())),
version(e.info().version(), { }),
- repo(e.repository()),
+ repository_name(e.repository()),
slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, SlotName(e.info().version()))),
authors_key(make_string_key("authors", "Authors", mkt_author, e.info().authors())),
info_key(make_string_key("info", "Info", mkt_significant, e.info().info())),
@@ -244,16 +244,16 @@ GemcutterID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- "::" + stringify(_imp->repo->name());
+ "::" + stringify(_imp->repository_name);
case idcf_no_version:
- return stringify(_imp->name) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->name) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_name:
- return stringify(_imp->version) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->version) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -266,7 +266,7 @@ PackageDepSpec
GemcutterID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- + "::" + stringify(repository()->name()),
+ + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -282,10 +282,10 @@ GemcutterID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-GemcutterID::repository() const
+const RepositoryName
+GemcutterID::repository_name() const
{
- return _imp->repo->shared_from_this();
+ return _imp->repository_name;
}
bool
diff --git a/paludis/repositories/gemcutter/gemcutter_id.hh b/paludis/repositories/gemcutter/gemcutter_id.hh
index a0b7afd..a118756 100644
--- a/paludis/repositories/gemcutter/gemcutter_id.hh
+++ b/paludis/repositories/gemcutter/gemcutter_id.hh
@@ -42,7 +42,7 @@ namespace paludis
{
NamedValue<n::environment, const Environment *> environment;
NamedValue<n::info, GemJSONInfo> info;
- NamedValue<n::repository, const GemcutterRepository *> repository;
+ NamedValue<n::repository, RepositoryName> repository;
};
class PALUDIS_VISIBLE GemcutterID :
@@ -63,7 +63,7 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const std::shared_ptr<const Repository> repository() const;
+ const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/gemcutter/gemcutter_repository_store.cc b/paludis/repositories/gemcutter/gemcutter_repository_store.cc
index 7ee0861..2878beb 100644
--- a/paludis/repositories/gemcutter/gemcutter_repository_store.cc
+++ b/paludis/repositories/gemcutter/gemcutter_repository_store.cc
@@ -129,7 +129,7 @@ GemcutterRepositoryStore::_populate_one(const GemJSONInfo & info)
const std::shared_ptr<GemcutterID> id(std::make_shared<GemcutterID>(make_named_values<GemcutterIDParams>(
n::environment() = _imp->env,
n::info() = info,
- n::repository() = _imp->repo
+ n::repository() = _imp->repo->name()
)));
_imp->categories->insert(id->name().category());
diff --git a/paludis/repositories/repository/repository_id.cc b/paludis/repositories/repository/repository_id.cc
index 769e472..512a148 100644
--- a/paludis/repositories/repository/repository_id.cc
+++ b/paludis/repositories/repository/repository_id.cc
@@ -64,7 +64,7 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const RepositoryRepository * const repo;
+ const RepositoryName repository_name;
const std::shared_ptr<LiteralMetadataStringSetKey> behaviours_key;
@@ -72,7 +72,7 @@ namespace paludis
env(e.environment()),
name(e.name()),
version("0", { }),
- repo(e.repository()),
+ repository_name(e.repository()),
behaviours_key(RepositoryIDBehaviours::get_instance()->behaviours_key)
{
}
@@ -107,16 +107,16 @@ RepositoryID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- "::" + stringify(_imp->repo->name());
+ "::" + stringify(_imp->repository_name);
case idcf_no_version:
- return stringify(_imp->name) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->name) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_name:
- return stringify(_imp->version) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->version) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -129,7 +129,7 @@ PackageDepSpec
RepositoryID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
- + "::" + stringify(repository()->name()),
+ + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -145,10 +145,10 @@ RepositoryID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-RepositoryID::repository() const
+const RepositoryName
+RepositoryID::repository_name() const
{
- return _imp->repo->shared_from_this();
+ return _imp->repository_name;
}
bool
diff --git a/paludis/repositories/repository/repository_id.hh b/paludis/repositories/repository/repository_id.hh
index 44e17f9..1c3ab82 100644
--- a/paludis/repositories/repository/repository_id.hh
+++ b/paludis/repositories/repository/repository_id.hh
@@ -40,7 +40,7 @@ namespace paludis
{
NamedValue<n::environment, const Environment *> environment;
NamedValue<n::name, QualifiedPackageName> name;
- NamedValue<n::repository, const RepositoryRepository *> repository;
+ NamedValue<n::repository, RepositoryName> repository;
};
class PALUDIS_VISIBLE RepositoryID :
@@ -61,7 +61,7 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const std::shared_ptr<const Repository> repository() const;
+ const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/repository/repository_repository.cc b/paludis/repositories/repository/repository_repository.cc
index feb2e9f..bfcceb8 100644
--- a/paludis/repositories/repository/repository_repository.cc
+++ b/paludis/repositories/repository/repository_repository.cc
@@ -38,6 +38,7 @@
#include <paludis/package_id.hh>
#include <paludis/output_manager.hh>
#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
#include <list>
using namespace paludis;
@@ -345,9 +346,10 @@ RepositoryRepository::sync_host_key() const
}
bool
-RepositoryRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+RepositoryRepository::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->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "unavailable";
}
diff --git a/paludis/repositories/repository/repository_repository_store.cc b/paludis/repositories/repository/repository_repository_store.cc
index 4314134..cfa62f9 100644
--- a/paludis/repositories/repository/repository_repository_store.cc
+++ b/paludis/repositories/repository/repository_repository_store.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/repositories/repository/repository_repository_store.hh>
+#include <paludis/repositories/repository/repository_repository.hh>
#include <paludis/repositories/repository/repository_id.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
@@ -94,7 +95,7 @@ RepositoryRepositoryStore::_populate_one(const RepositoryName & repo_name)
const std::shared_ptr<RepositoryID> id(std::make_shared<RepositoryID>(make_named_values<RepositoryIDParams>(
n::environment() = _imp->env,
n::name() = CategoryNamePart("repository") + PackageNamePart(stringify(repo_name)),
- n::repository() = _imp->repo
+ n::repository() = _imp->repo->name()
)));
_imp->categories->insert(id->name().category());
diff --git a/paludis/repositories/unavailable/unavailable_package_id.cc b/paludis/repositories/unavailable/unavailable_package_id.cc
index 0c4e7c7..3b46998 100644
--- a/paludis/repositories/unavailable/unavailable_package_id.cc
+++ b/paludis/repositories/unavailable/unavailable_package_id.cc
@@ -45,7 +45,7 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const UnavailableRepository * const repo;
+ const RepositoryName repository_name;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
@@ -59,7 +59,7 @@ namespace paludis
env(e.environment()),
name(e.name()),
version(e.version()),
- repo(e.repository()),
+ repository_name(e.repository()),
slot_key(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, e.slot())),
description_key(e.description()),
repository_homepage_key(e.repository_homepage()),
@@ -107,12 +107,12 @@ UnavailablePackageID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repo->name()) +
+ ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case idcf_no_version:
return stringify(_imp->name) + ":" + stringify(_imp->slot_key->value()) +
- "::" + stringify(_imp->repo->name()) +
+ "::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case idcf_version:
@@ -121,7 +121,7 @@ UnavailablePackageID::canonical_form(const PackageIDCanonicalForm f) const
case idcf_no_name:
return stringify(_imp->version) +
- ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repo->name()) +
+ ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repository_name) +
" (in ::" + *_imp->from_repositories_key->value()->begin() + ")";
case last_idcf:
@@ -135,7 +135,7 @@ PackageDepSpec
UnavailablePackageID::uniquely_identifying_spec() const
{
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->from_repositories_key->raw_name() + "=" + *_imp->from_repositories_key->value()->begin() + "]",
_imp->env, { });
}
@@ -152,10 +152,10 @@ UnavailablePackageID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-UnavailablePackageID::repository() const
+const RepositoryName
+UnavailablePackageID::repository_name() const
{
- return _imp->repo->shared_from_this();
+ return _imp->repository_name;
}
bool
diff --git a/paludis/repositories/unavailable/unavailable_package_id.hh b/paludis/repositories/unavailable/unavailable_package_id.hh
index fcad0d6..0bfabc6 100644
--- a/paludis/repositories/unavailable/unavailable_package_id.hh
+++ b/paludis/repositories/unavailable/unavailable_package_id.hh
@@ -50,7 +50,7 @@ namespace paludis
NamedValue<n::from_repositories, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > from_repositories;
NamedValue<n::mask, std::shared_ptr<const Mask> > mask;
NamedValue<n::name, QualifiedPackageName> name;
- NamedValue<n::repository, const UnavailableRepository *> repository;
+ NamedValue<n::repository, RepositoryName> repository;
NamedValue<n::repository_description, std::shared_ptr<const MetadataValueKey<std::string> > > repository_description;
NamedValue<n::repository_homepage, std::shared_ptr<const MetadataValueKey<std::string> > > repository_homepage;
NamedValue<n::slot, SlotName> slot;
@@ -75,7 +75,7 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const std::shared_ptr<const Repository> repository() const;
+ const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
index 6019982..95d0e43 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -66,7 +66,7 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const UnavailableRepository * const repo;
+ const RepositoryName repository_name;
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
@@ -80,7 +80,7 @@ namespace paludis
env(e.environment()),
name(e.name()),
version("0", { }),
- repo(e.repository()),
+ repository_name(e.repository()),
dependencies_key(e.dependencies()),
description_key(e.description()),
homepage_key(e.homepage()),
@@ -134,16 +134,16 @@ UnavailableRepositoryID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- "::" + stringify(_imp->repo->name());
+ "::" + stringify(_imp->repository_name);
case idcf_no_version:
- return stringify(_imp->name) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->name) + "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_name:
- return stringify(_imp->version) + "::" + stringify(_imp->repo->name());
+ return stringify(_imp->version) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -156,7 +156,7 @@ PackageDepSpec
UnavailableRepositoryID::uniquely_identifying_spec() const
{
return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version())
- + "::" + stringify(repository()->name()),
+ + "::" + stringify(repository_name()),
_imp->env, { });
}
@@ -172,10 +172,10 @@ UnavailableRepositoryID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-UnavailableRepositoryID::repository() const
+const RepositoryName
+UnavailableRepositoryID::repository_name() const
{
- return _imp->repo->shared_from_this();
+ return _imp->repository_name;
}
bool
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.hh b/paludis/repositories/unavailable/unavailable_repository_id.hh
index 6cfe456..9b35cd4 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_id.hh
@@ -52,7 +52,7 @@ namespace paludis
NamedValue<n::homepage, std::shared_ptr<const MetadataValueKey<std::string> > > homepage;
NamedValue<n::mask, std::shared_ptr<const Mask> > mask;
NamedValue<n::name, QualifiedPackageName> name;
- NamedValue<n::repository, const UnavailableRepository *> repository;
+ NamedValue<n::repository, RepositoryName> repository;
NamedValue<n::sync, std::shared_ptr<const MetadataValueKey<std::string> > > sync;
};
@@ -75,7 +75,7 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const std::shared_ptr<const Repository> repository() const;
+ const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index 58792aa..d246b68 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/unavailable/unavailable_repository_id.hh>
#include <paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh>
#include <paludis/repositories/unavailable/unavailable_mask.hh>
+#include <paludis/repositories/unavailable/unavailable_repository.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/set.hh>
@@ -173,7 +174,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
n::from_repositories() = from_repositories,
n::mask() = mask,
n::name() = (*i).name(),
- n::repository() = _imp->repo,
+ n::repository() = _imp->repo->name(),
n::repository_description() = repository_description,
n::repository_homepage() = repository_homepage,
n::slot() = (*i).slot(),
@@ -205,7 +206,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
n::homepage() = repository_homepage,
n::mask() = mask,
n::name() = CategoryNamePart("repository") + PackageNamePart(file.repo_name()),
- n::repository() = _imp->repo,
+ n::repository() = _imp->repo->name(),
n::sync() = repository_sync
)));
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 73173f8..dbe0c08 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -530,7 +530,7 @@ PackageDepSpec
InstalledUnpackagedID::uniquely_identifying_spec() const
{
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->env, { });
}
@@ -546,10 +546,10 @@ InstalledUnpackagedID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-InstalledUnpackagedID::repository() const
+const RepositoryName
+InstalledUnpackagedID::repository_name() const
{
- return _imp->env->package_database()->fetch_repository(_imp->repository_name);
+ return _imp->repository_name;
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
@@ -842,10 +842,11 @@ InstalledUnpackagedID::uninstall(const bool replace,
{
Context context("When uninstalling '" + stringify(*this) + "':");
+ auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
bool last((! replace) && (! if_for_install_id));
if (last)
{
- std::shared_ptr<const PackageIDSequence> ids(repository()->package_ids(name()));
+ std::shared_ptr<const PackageIDSequence> ids(repo->package_ids(name()));
for (PackageIDSequence::ConstIterator v(ids->begin()), v_end(ids->end()) ;
v != v_end ; ++v)
if (**v != *this)
@@ -885,7 +886,7 @@ InstalledUnpackagedID::uninstall(const bool replace,
FSPath pkg_dir(fs_location_key()->value().dirname());
pkg_dir.rmdir();
- std::static_pointer_cast<const InstalledUnpackagedRepository>(repository())->deindex(name());
+ std::static_pointer_cast<const InstalledUnpackagedRepository>(repo)->deindex(name());
}
}
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index 95c5d99..4a85b10 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -54,7 +54,7 @@ namespace paludis
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
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/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index bff2a51..357f02c 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -49,6 +49,7 @@
#include <paludis/selection.hh>
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
+#include <paludis/package_database.hh>
#include <sstream>
#include <sys/time.h>
@@ -274,10 +275,11 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
if (! is_suitable_destination_for(m.package_id()))
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
+ auto repo(_imp->params.environment()->package_database()->fetch_repository(m.package_id()->repository_name()));
FSPath install_under("/");
{
- Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("install_under"));
- if (k == m.package_id()->repository()->end_metadata())
+ Repository::MetadataConstIterator k(repo->find_metadata("install_under"));
+ if (k == repo->end_metadata())
throw ActionFailedError("Could not fetch install_under key from owning repository");
const MetadataValueKey<FSPath> * kk(simple_visitor_cast<const MetadataValueKey<FSPath> >(**k));
if (! kk)
@@ -287,8 +289,8 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
int rewrite_ids_over_to_root(-1);
{
- Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("rewrite_ids_over_to_root"));
- if (k == m.package_id()->repository()->end_metadata())
+ Repository::MetadataConstIterator k(repo->find_metadata("rewrite_ids_over_to_root"));
+ if (k == repo->end_metadata())
throw ActionFailedError("Could not fetch rewrite_ids_over_to_root key from owning repository");
const MetadataValueKey<long> * kk(simple_visitor_cast<const MetadataValueKey<long> >(**k));
if (! kk)
@@ -333,7 +335,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
{
SafeOFStream source_repository_file(target_ver_dir / "source_repository", -1, true);
- source_repository_file << m.package_id()->repository()->name() << std::endl;
+ source_repository_file << m.package_id()->repository_name() << std::endl;
}
if (m.package_id()->short_description_key())
@@ -394,9 +396,10 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
}
bool
-InstalledUnpackagedRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
+InstalledUnpackagedRepository::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->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "unpackaged";
}
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index a7030c9..cd83a65 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -143,7 +143,7 @@ namespace test_cases
TEST_CHECK_EQUAL(id1->version(), VersionSpec("1", { }));
TEST_CHECK_EQUAL(id1->slot_key()->value(), SlotName("0"));
TEST_CHECK_EQUAL(id1->name(), QualifiedPackageName("cat-one/foo"));
- TEST_CHECK_EQUAL(id1->repository()->name(), RepositoryName("installed-unpackaged"));
+ TEST_CHECK_EQUAL(id1->repository_name(), RepositoryName("installed-unpackaged"));
TEST_CHECK(bool(id1->fs_location_key()));
TEST_CHECK_EQUAL(id1->fs_location_key()->value(),
FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/1:0:foo/");
@@ -161,7 +161,7 @@ namespace test_cases
TEST_CHECK_EQUAL(id2->version(), VersionSpec("2", { }));
TEST_CHECK_EQUAL(id2->slot_key()->value(), SlotName("1"));
TEST_CHECK_EQUAL(id2->name(), QualifiedPackageName("cat-one/foo"));
- TEST_CHECK_EQUAL(id2->repository()->name(), RepositoryName("installed-unpackaged"));
+ TEST_CHECK_EQUAL(id2->repository_name(), RepositoryName("installed-unpackaged"));
TEST_CHECK(bool(id2->fs_location_key()));
TEST_CHECK_EQUAL(id2->fs_location_key()->value(),
FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/2:1:bar/");
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index ceedaf1..bb346ca 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -168,7 +168,7 @@ PackageDepSpec
UnpackagedID::uniquely_identifying_spec() const
{
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->env, { });
}
@@ -184,10 +184,10 @@ UnpackagedID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-UnpackagedID::repository() const
+const RepositoryName
+UnpackagedID::repository_name() const
{
- return _imp->env->package_database()->fetch_repository(_imp->repository_name);
+ return _imp->repository_name;
}
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > >
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 79159f3..6350576 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -53,7 +53,7 @@ namespace paludis
virtual const std::string canonical_form(const PackageIDCanonicalForm) const;
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/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 985e466..cd91cb2 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -129,7 +129,7 @@ namespace test_cases
TEST_CHECK_EQUAL(id->version(), VersionSpec("1.0", { }));
TEST_CHECK_EQUAL(id->slot_key()->value(), SlotName("foo"));
TEST_CHECK_EQUAL(id->name(), QualifiedPackageName("cat/pkg"));
- TEST_CHECK_EQUAL(id->repository()->name(), RepositoryName("unpackaged"));
+ TEST_CHECK_EQUAL(id->repository_name(), RepositoryName("unpackaged"));
TEST_CHECK(bool(id->fs_location_key()));
TEST_CHECK_EQUAL(id->fs_location_key()->value(), FSPath("unpackaged_repository_TEST_dir/pkg"));
}
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index 6a5f30a..2aada4f 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -43,7 +43,7 @@ namespace paludis
const Environment * const env;
const QualifiedPackageName name;
const VersionSpec version;
- const UnwrittenRepository * const repo;
+ const RepositoryName repository_name;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
@@ -63,7 +63,7 @@ namespace paludis
env(e.environment()),
name(e.name()),
version(e.version()),
- repo(e.repository()),
+ repository_name(e.repository()),
slot_key(e.slot()),
description_key(e.description()),
added_by_key(e.added_by()),
@@ -129,18 +129,18 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const
{
case idcf_full:
return stringify(_imp->name) + "-" + stringify(_imp->version) +
- ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repo->name());
+ ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name);
case idcf_no_version:
return stringify(_imp->name) + ":" + stringify(slot_key()->value()) +
- "::" + stringify(_imp->repo->name());
+ "::" + stringify(_imp->repository_name);
case idcf_version:
return stringify(_imp->version);
case idcf_no_name:
return stringify(_imp->version) +
- ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repo->name());
+ ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name);
case last_idcf:
break;
@@ -153,7 +153,7 @@ PackageDepSpec
UnwrittenID::uniquely_identifying_spec() const
{
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->env, { });
}
@@ -169,10 +169,10 @@ UnwrittenID::version() const
return _imp->version;
}
-const std::shared_ptr<const Repository>
-UnwrittenID::repository() const
+const RepositoryName
+UnwrittenID::repository_name() const
{
- return _imp->repo->shared_from_this();
+ return _imp->repository_name;
}
bool
diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh
index 43c28d1..9cc15e5 100644
--- a/paludis/repositories/unwritten/unwritten_id.hh
+++ b/paludis/repositories/unwritten/unwritten_id.hh
@@ -64,7 +64,7 @@ namespace paludis
NamedValue<n::remote_ids, std::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > > remote_ids;
NamedValue<n::removed_by, std::shared_ptr<const MetadataValueKey<std::string> > > removed_by;
NamedValue<n::removed_from, std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > removed_from;
- NamedValue<n::repository, const UnwrittenRepository *> repository;
+ NamedValue<n::repository, RepositoryName> repository;
NamedValue<n::slot, std::shared_ptr<const MetadataValueKey<SlotName> > > slot;
NamedValue<n::version, VersionSpec> version;
};
@@ -87,7 +87,7 @@ namespace paludis
const std::string canonical_form(const PackageIDCanonicalForm) const;
const QualifiedPackageName name() const;
const VersionSpec version() const;
- const std::shared_ptr<const Repository> repository() const;
+ const RepositoryName repository_name() const;
virtual PackageDepSpec uniquely_identifying_spec() const;
const std::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
diff --git a/paludis/repositories/unwritten/unwritten_repository_store.cc b/paludis/repositories/unwritten/unwritten_repository_store.cc
index dd6912f..0592825 100644
--- a/paludis/repositories/unwritten/unwritten_repository_store.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_store.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/unwritten/unwritten_repository_file.hh>
#include <paludis/repositories/unwritten/unwritten_id.hh>
#include <paludis/repositories/unwritten/unwritten_mask.hh>
+#include <paludis/repositories/unwritten/unwritten_repository.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/set.hh>
@@ -165,7 +166,7 @@ UnwrittenRepositoryStore::_populate_one(const Environment * const env, const FSP
n::remote_ids() = (*i).remote_ids(),
n::removed_by() = (*i).removed_by(),
n::removed_from() = (*i).removed_from(),
- n::repository() = _imp->repo,
+ n::repository() = _imp->repo->name(),
n::slot() = (*i).slot(),
n::version() = (*i).version()
)));
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 5f72bb8..43e7308 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 81adbc2..7aee731 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 a5e1465..30513f5 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 f499eb8..a17dce3 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
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 880fc63..9466bf3 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -780,7 +780,7 @@ namespace
const std::pair<bool, std::string>
UserKeyRequirement::requirement_met(
- const Environment * const,
+ const Environment * const env,
const ChangedChoices * const,
const std::shared_ptr<const PackageID> & id,
const ChangedChoices * const) const
@@ -789,18 +789,19 @@ UserKeyRequirement::requirement_met(
const MetadataKey * key(0);
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
if (0 == _imp->key.compare(0, 3, "::$"))
{
if (_imp->key == "::$format")
- key = id->repository()->format_key().get();
+ key = repo->format_key().get();
else if (_imp->key == "::$location")
- key = id->repository()->location_key().get();
+ key = repo->location_key().get();
else if (_imp->key == "::$installed_root")
- key = id->repository()->installed_root_key().get();
+ key = repo->installed_root_key().get();
else if (_imp->key == "::$accept_keywords")
- key = id->repository()->accept_keywords_key().get();
+ key = repo->accept_keywords_key().get();
else if (_imp->key == "::$sync_host")
- key = id->repository()->sync_host_key().get();
+ key = repo->sync_host_key().get();
}
else if (0 == _imp->key.compare(0, 1, "$"))
{
@@ -849,8 +850,8 @@ UserKeyRequirement::requirement_met(
}
else if (0 == _imp->key.compare(0, 2, "::"))
{
- Repository::MetadataConstIterator m(id->repository()->find_metadata(_imp->key.substr(2)));
- if (m != id->repository()->end_metadata())
+ Repository::MetadataConstIterator m(repo->find_metadata(_imp->key.substr(2)));
+ if (m != repo->end_metadata())
key = m->get();
}
else
diff --git a/python/package_id.cc b/python/package_id.cc
index 2c08a51..1301db1 100644
--- a/python/package_id.cc
+++ b/python/package_id.cc
@@ -74,8 +74,8 @@ void expose_package_id()
"[ro] VersionSpec\n"
)
- .add_property("repository", &PackageID::repository,
- "[ro] Repository\n"
+ .add_property("repository_name", &PackageID::repository_name,
+ "[ro] RepositoryName\n"
)
.def("supports_action", &PackageID::supports_action,
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index ef7a747..24d43d8 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -54,8 +54,8 @@ class TestCase_01_PackageID(unittest.TestCase):
self.assertEquals(str(self.pid.slot_key().value()), "0")
def test_05_repository(self):
- self.assertEquals(str(self.pid.repository.name), "testrepo")
- self.assertEquals(str(self.ipid.repository.name), "installed")
+ self.assertEquals(str(self.pid.repository_name), "testrepo")
+ self.assertEquals(str(self.ipid.repository_name), "installed")
def test_07_canonical_form(self):
# Load the metadata
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 45ac02b..edaef2c 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -165,7 +165,7 @@ namespace
Data_Get_Struct(self, std::shared_ptr<const PackageID>, self_ptr);
try
{
- return rb_str_new2(stringify((*self_ptr)->repository()->name()).c_str());
+ return rb_str_new2(stringify((*self_ptr)->repository_name()).c_str());
}
catch (const std::exception & e)
{
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 3fb7266..fb6f5f2 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -1247,7 +1247,7 @@ namespace
! (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->empty() &&
(*decision.destination()->replacing()->begin())->from_repositories_key()->value()->end() ==
(*decision.destination()->replacing()->begin())->from_repositories_key()->value()->find(stringify(
- decision.origin_id()->repository()->name())))
+ decision.origin_id()->repository_name())))
{
cout << fuc(fs_change_formerly_from(), fv<'r'>(join(
(*decision.destination()->replacing()->begin())->from_repositories_key()->value()->begin(),
diff --git a/src/clients/cave/cmd_import.cc b/src/clients/cave/cmd_import.cc
index 889c89b..6c1734f 100644
--- a/src/clients/cave/cmd_import.cc
+++ b/src/clients/cave/cmd_import.cc
@@ -224,9 +224,10 @@ ImportCommand::run(
for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
i != i_end ; ++i)
{
- if (! (*i)->repository()->format_key())
+ auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ if (! repo->format_key())
continue;
- if ((*i)->repository()->format_key()->value() != "installed_unpackaged")
+ if (repo->format_key()->value() != "installed_unpackaged")
continue;
old_id = *i;
break;
diff --git a/src/clients/cave/cmd_print_id_environment_variable.cc b/src/clients/cave/cmd_print_id_environment_variable.cc
index 63e6ea7..b7c96e9 100644
--- a/src/clients/cave/cmd_print_id_environment_variable.cc
+++ b/src/clients/cave/cmd_print_id_environment_variable.cc
@@ -31,6 +31,7 @@
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
+#include <paludis/package_database.hh>
#include <iostream>
#include <cstdlib>
@@ -90,19 +91,20 @@ namespace
};
void do_one_var(
+ const Environment * const env,
const PackageDepSpec & s,
const std::shared_ptr<const PackageID> & id,
const std::string & n,
const PrintIDEnvironmentVariableCommandLine & cmdline
)
{
- std::shared_ptr<const Repository> r(id->repository());
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
- if (0 != r->environment_variable_interface())
+ if (0 != repo->environment_variable_interface())
{
std::shared_ptr<Map<char, std::string> > m(std::make_shared<Map<char, std::string>>());
m->insert('n', n);
- m->insert('v', r->environment_variable_interface()->get_environment_variable(id, n));
+ m->insert('v', repo->environment_variable_interface()->get_environment_variable(id, n));
cout << format_string(cmdline.a_format.argument(), m);
}
@@ -148,7 +150,7 @@ PrintIDEnvironmentVariableCommand::run(
i != i_end ; ++i)
for (args::StringSequenceArg::ConstIterator v(cmdline.a_variable_name.begin_args()), v_end(cmdline.a_variable_name.end_args()) ;
v != v_end ; ++v)
- do_one_var(spec, *i, *v, cmdline);
+ do_one_var(env.get(), spec, *i, *v, cmdline);
return EXIT_SUCCESS;
}
diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc
index 27231ca..aa1427b 100644
--- a/src/clients/cave/cmd_print_ids.cc
+++ b/src/clients/cave/cmd_print_ids.cc
@@ -254,7 +254,7 @@ namespace
m->insert('v', stringify(i->version()));
m->insert('s', i->slot_key() ? stringify(i->slot_key()->value()) : "");
m->insert(':', i->slot_key() ? ":" : "");
- m->insert('r', stringify(i->repository()->name()));
+ m->insert('r', stringify(i->repository_name()));
m->insert('F', i->canonical_form(idcf_full));
m->insert('V', i->canonical_form(idcf_version));
m->insert('W', i->canonical_form(idcf_no_version));
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index e9ea57d..02bd903 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -1120,7 +1120,8 @@ namespace
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
- if ((*i)->repository()->installed_root_key())
+ auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ if (repo->installed_root_key())
all_installed->push_back(*i);
else
{
@@ -1142,7 +1143,7 @@ namespace
best_not_installed = *i;
}
- repos.insert((*i)->repository()->name());
+ repos.insert((*i)->repository_name());
}
if (! best_installable)
@@ -1161,7 +1162,7 @@ namespace
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
- if ((*i)->repository()->name() != *r)
+ if ((*i)->repository_name() != *r)
continue;
if (slot_name != slot_as_string(*i))
@@ -1175,7 +1176,8 @@ namespace
header_out << " ";
need_space = true;
- if ((*i)->repository()->installed_root_key())
+ auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ if (repo->installed_root_key())
header_out << fuc(fs_package_version_installed(), fv<'s'>(stringify((*i)->canonical_form(idcf_version))));
else
{
@@ -1259,7 +1261,7 @@ namespace
{
std::set<RepositoryName> repos;
for (auto i(ids->begin()), i_end(ids->end()) ; i != i_end ; ++i)
- repos.insert((*i)->repository()->name());
+ repos.insert((*i)->repository_name());
std::stringstream rest_out;
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index b5ad7eb..62bce7a 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -158,9 +158,10 @@ main(int argc, char *argv[])
for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
i != i_end ; ++i)
{
- if (! (*i)->repository()->format_key())
+ auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ if (! repo->format_key())
continue;
- if ((*i)->repository()->format_key()->value() != "installed_unpackaged")
+ if (repo->format_key()->value() != "installed_unpackaged")
continue;
old_id = *i;
break;
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index cd90526..996e7e5 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -166,10 +166,12 @@ namespace
{
typedef bool result;
+ const Environment * const env;
const bool visible_only;
bool installed, installable;
- Eligible(const bool v, const std::string & k) :
+ Eligible(const Environment * const e, const bool v, const std::string & k) :
+ env(e),
visible_only(v),
installed(true),
installable(true)
@@ -187,7 +189,8 @@ namespace
bool operator() (const PackageID & id) const
{
- if ((! installed) && id.repository()->installed_root_key())
+ auto repo(env->package_database()->fetch_repository(id.repository_name()));
+ if ((! installed) && repo->installed_root_key())
return false;
if ((! installable) && id.supports_action(SupportsActionTest<InstallAction>()))
@@ -420,6 +423,7 @@ do_search(Environment & env)
}
Eligible eligible(
+ &env,
CommandLine::get_instance()->a_visible_only.specified(),
CommandLine::get_instance()->a_kind.argument());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 746b5a7..5050fb7 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -312,11 +312,12 @@ int do_environment_variable(const std::shared_ptr<Environment> & env)
if (entries->empty())
throw NoSuchPackageError(spec_str);
- RepositoryEnvironmentVariableInterface * env_if((*(*entries->last())->repository()).environment_variable_interface());
+ auto repo(env->package_database()->fetch_repository((*entries->last())->repository_name()));
+ RepositoryEnvironmentVariableInterface * env_if(repo->environment_variable_interface());
if (! env_if)
{
- std::cerr << "Repository '" << (*entries->last())->repository()->name() <<
+ std::cerr << "Repository '" << (*entries->last())->repository_name() <<
"' cannot be queried for environment variables" << std::endl;
return_code |= 1;
}
diff --git a/src/clients/paludis/report.cc b/src/clients/paludis/report.cc
index 583dd90..490e594 100644
--- a/src/clients/paludis/report.cc
+++ b/src/clients/paludis/report.cc
@@ -123,7 +123,7 @@ namespace
comma = true;
}
- cout << " in '" << (*o)->repository()->name() << "'";
+ cout << " in '" << (*o)->repository_name() << "'";
outer_comma = true;
}
++_n_errors;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index c371e0c..7a3956e 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -981,10 +981,10 @@ ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d,
! inst->empty() && (*inst->begin())->from_repositories_key() &&
(*inst->begin())->from_repositories_key()->value()->end() ==
(*inst->begin())->from_repositories_key()->value()->find(
- stringify(d.package_id()->repository()->name())));
+ stringify(d.package_id()->repository_name())));
- if (changed || environment()->package_database()->favourite_repository() != d.package_id()->repository()->name())
- output_no_endl("::" + stringify(d.package_id()->repository()->name()));
+ if (changed || environment()->package_database()->favourite_repository() != d.package_id()->repository_name())
+ output_no_endl("::" + stringify(d.package_id()->repository_name()));
if (changed)
output_no_endl(" (previously ::" + join((*inst->begin())->from_repositories_key()->value()->begin(),
(*inst->begin())->from_repositories_key()->value()->end(), ", ::") + ")");
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 7b2cbf1..1c080c9 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -211,8 +211,8 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
std::list<RepositoryName> repo_names;
PackageIDSequence::ConstIterator e(entries->begin()), e_end(entries->end());
for ( ; e != e_end ; ++e)
- if (repo_names.end() == std::find(repo_names.begin(), repo_names.end(), (*e)->repository()->name()))
- repo_names.push_back((*e)->repository()->name());
+ if (repo_names.end() == std::find(repo_names.begin(), repo_names.end(), (*e)->repository_name()))
+ repo_names.push_back((*e)->repository_name());
/* display versions, by repository. */
std::list<RepositoryName>::const_iterator r(repo_names.begin()), r_end(repo_names.end());
@@ -225,7 +225,7 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
{
Context context("When displaying entry '" + stringify(**e) + "':'");
- if ((*e)->repository()->name() == *r)
+ if ((*e)->repository_name() == *r)
{
/* show the slot, if we're about to move onto a new slot */
std::string slot_name(slot_as_string(*e));