aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/fake
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/fake')
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_installed_repository.hh2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc43
-rw-r--r--paludis/repositories/fake/fake_package_id.hh4
4 files changed, 26 insertions, 25 deletions
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 33249aa84..aea4dc9bb 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -78,7 +78,7 @@ FakeInstalledRepository::~FakeInstalledRepository()
}
bool
-FakeInstalledRepository::is_suitable_destination_for(const PackageID &) const
+FakeInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
{
return _imp->is_suitable_destination;
}
diff --git a/paludis/repositories/fake/fake_installed_repository.hh b/paludis/repositories/fake/fake_installed_repository.hh
index 2f64d7981..9bce539a0 100644
--- a/paludis/repositories/fake/fake_installed_repository.hh
+++ b/paludis/repositories/fake/fake_installed_repository.hh
@@ -60,7 +60,7 @@ namespace paludis
protected:
/* RepositoryDestinationInterface */
- virtual bool is_suitable_destination_for(const PackageID &) const
+ virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool is_default_destination() const
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index fb49212dc..0d350f10f 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -133,14 +133,14 @@ namespace paludis
struct Imp<FakeMetadataCollectionKey<C_> >
{
std::shared_ptr<C_> collection;
- const PackageID * const id;
+ const std::shared_ptr<const PackageID> id;
const Environment * const env;
const std::string raw_name;
const std::string human_name;
const MetadataKeyType type;
- Imp(const PackageID * const i, const Environment * const e,
+ Imp(const std::shared_ptr<const PackageID> & i, const Environment * const e,
const std::string & r, const std::string & h, const MetadataKeyType t) :
id(i),
env(e),
@@ -154,7 +154,7 @@ namespace paludis
template <typename C_>
FakeMetadataCollectionKey<C_>::FakeMetadataCollectionKey(
- const std::string & r, const std::string & h, const MetadataKeyType t, const PackageID * const i,
+ const std::string & r, const std::string & h, const MetadataKeyType t, const std::shared_ptr<const PackageID> & i,
const Environment * const e) :
Pimp<FakeMetadataCollectionKey<C_> >(i, e, r, h, t),
_imp(Pimp<FakeMetadataCollectionKey<C_> >::_imp)
@@ -196,7 +196,7 @@ FakeMetadataCollectionKey<C_>::type() const
FakeMetadataKeywordSetKey::FakeMetadataKeywordSetKey(const std::string & r,
const std::string & h, const std::string & v, const MetadataKeyType t,
- const PackageID * const i, const Environment * const e) :
+ const std::shared_ptr<const PackageID> & i, const Environment * const e) :
FakeMetadataCollectionKey<KeywordNameSet>(r, h, t, i, e)
{
set_from_string(v);
@@ -720,7 +720,7 @@ namespace paludis
mutable bool has_masks;
Imp(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
- const QualifiedPackageName & q, const VersionSpec & v, const PackageID * const id) :
+ const QualifiedPackageName & q, const VersionSpec & v) :
env(e),
repository(r),
name(q),
@@ -730,7 +730,6 @@ namespace paludis
post_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
suggested_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
slot(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, SlotName("0"))),
- keywords(std::make_shared<FakeMetadataKeywordSetKey>("KEYWORDS", "Keywords", "test", mkt_normal, id, env)),
behaviours_set(std::make_shared<Set<std::string>>()),
has_masks(false)
{
@@ -748,10 +747,9 @@ namespace paludis
FakePackageID::FakePackageID(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
const QualifiedPackageName & q, const VersionSpec & v) :
- Pimp<FakePackageID>(e, r, q, v, this),
+ Pimp<FakePackageID>(e, r, q, v),
_imp(Pimp<FakePackageID>::_imp)
{
- add_metadata_key(_imp->keywords);
}
FakePackageID::~FakePackageID()
@@ -1042,6 +1040,8 @@ FakePackageID::need_keys_added() const
_imp->hitchhiker = std::make_shared<FakeMetadataValueKey<long>>("HITCHHIKER", "Hitchhiker",
mkt_internal, 42);
+ _imp->keywords = std::make_shared<FakeMetadataKeywordSetKey>("KEYWORDS", "Keywords", "test", mkt_normal, shared_from_this(), _imp->env);
+
add_metadata_key(_imp->slot);
add_metadata_key(_imp->build_dependencies);
add_metadata_key(_imp->run_dependencies);
@@ -1054,6 +1054,7 @@ FakePackageID::need_keys_added() const
add_metadata_key(_imp->choices);
add_metadata_key(_imp->behaviours);
add_metadata_key(_imp->hitchhiker);
+ add_metadata_key(_imp->keywords);
}
}
@@ -1075,16 +1076,16 @@ namespace
{
bool ok;
const Environment * const env;
- bool (Environment::* const func) (const std::string &, const PackageID &) const;
- const PackageID * const id;
+ bool (Environment::* const func) (const std::string &, const std::shared_ptr<const PackageID> &) const;
+ const std::shared_ptr<const PackageID> id;
LicenceChecker(const Environment * const e,
- bool (Environment::* const f) (const std::string &, const PackageID &) const,
- const PackageID * const d) :
+ bool (Environment::* const f) (const std::string &, const std::shared_ptr<const PackageID> &) const,
+ const std::shared_ptr<const PackageID> & i) :
ok(true),
env(e),
func(f),
- id(d)
+ id(i)
{
}
@@ -1121,7 +1122,7 @@ namespace
void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
{
- if (! (env->*func)(node.spec()->text(), *id))
+ if (! (env->*func)(node.spec()->text(), id))
ok = false;
}
};
@@ -1140,26 +1141,26 @@ FakePackageID::need_masks_added() const
Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':");
if (keywords_key())
- if (! _imp->env->accept_keywords(keywords_key()->value(), *this))
+ if (! _imp->env->accept_keywords(keywords_key()->value(), shared_from_this()))
add_mask(std::make_shared<FakeUnacceptedMask>('K', "keywords", keywords_key()));
if (license_key())
{
- LicenceChecker c(_imp->env, &Environment::accept_license, this);
+ LicenceChecker c(_imp->env, &Environment::accept_license, shared_from_this());
license_key()->value()->top()->accept(c);
if (! c.ok)
add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()));
}
- if (! _imp->env->unmasked_by_user(*this))
+ if (! _imp->env->unmasked_by_user(shared_from_this()))
{
- std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(*this, false));
+ std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(shared_from_this(), false));
if (user_mask)
add_mask(user_mask);
}
else
{
- std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(*this, true));
+ std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(shared_from_this(), true));
if (user_mask)
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
@@ -1168,7 +1169,7 @@ FakePackageID::need_masks_added() const
)));
}
- std::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(*this));
+ std::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(shared_from_this()));
if (breaks_mask)
add_mask(breaks_mask);
@@ -1325,7 +1326,7 @@ FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) c
std::shared_ptr<KeywordNameSet> k(std::make_shared<KeywordNameSet>());
k->insert(*i);
- if (_imp->env->accept_keywords(k, *_imp->id))
+ if (_imp->env->accept_keywords(k, _imp->id))
result.append(f.format(*i, format::Accepted()));
else
result.append(f.format(*i, format::Unaccepted()));
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index efc4b8c94..f72af3486 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -64,7 +64,7 @@ namespace paludis
typename Pimp<FakeMetadataCollectionKey<C_> >::ImpPtr & _imp;
FakeMetadataCollectionKey(const std::string &, const std::string &, const MetadataKeyType,
- const PackageID * const, const Environment * const);
+ const std::shared_ptr<const PackageID> &, const Environment * const);
public:
~FakeMetadataCollectionKey();
@@ -81,7 +81,7 @@ namespace paludis
{
public:
FakeMetadataKeywordSetKey(const std::string &, const std::string &, const std::string &, const MetadataKeyType,
- const PackageID * const, const Environment * const);
+ const std::shared_ptr<const PackageID> &, const Environment * const);
void set_from_string(const std::string &);