aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 21:55:53 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 21:55:53 +0000
commit48654c330e14db70c0a8b3736b77ea2738382edd (patch)
tree76e859f4f885165b2385757d3f2a6fa9c54b5dfb
parentdc6cdcbdc1430403fb52ad4baf859d09b5bed1c4 (diff)
downloadpaludis-48654c330e14db70c0a8b3736b77ea2738382edd.tar.gz
paludis-48654c330e14db70c0a8b3736b77ea2738382edd.tar.xz
Don't use repo mask keys
-rw-r--r--paludis/repositories/e/e_key.cc43
-rw-r--r--paludis/repositories/e/e_key.hh24
-rw-r--r--paludis/repositories/e/ebuild_id.cc43
-rw-r--r--ruby/package_id_TEST.rb11
4 files changed, 19 insertions, 102 deletions
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 84733cf..dbac197 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -60,49 +60,6 @@
using namespace paludis;
using namespace paludis::erepository;
-EMutableRepositoryMaskInfoKey::EMutableRepositoryMaskInfoKey(const std::string & r, const std::string & h,
- const std::shared_ptr<const RepositoryMaskInfo> & v, const MetadataKeyType t) :
- _value(v),
- _r(r),
- _h(h),
- _t(t)
-{
-}
-
-EMutableRepositoryMaskInfoKey::~EMutableRepositoryMaskInfoKey()
-{
-}
-
-const std::shared_ptr<const RepositoryMaskInfo>
-EMutableRepositoryMaskInfoKey::value() const
-{
- return _value;
-}
-
-void
-EMutableRepositoryMaskInfoKey::set_value(const std::shared_ptr<const RepositoryMaskInfo> & v)
-{
- _value = v;
-}
-
-const std::string
-EMutableRepositoryMaskInfoKey::raw_name() const
-{
- return _r;
-}
-
-const std::string
-EMutableRepositoryMaskInfoKey::human_name() const
-{
- return _h;
-}
-
-MetadataKeyType
-EMutableRepositoryMaskInfoKey::type() const
-{
- return _t;
-}
-
namespace paludis
{
template <>
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index b727504..5720d0b 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -33,30 +33,6 @@ namespace paludis
{
class ERepositoryID;
- class EMutableRepositoryMaskInfoKey :
- public MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> >
- {
- private:
- std::shared_ptr<const RepositoryMaskInfo> _value;
- const std::string _r;
- const std::string _h;
- const MetadataKeyType _t;
-
- public:
- EMutableRepositoryMaskInfoKey(const std::string &, const std::string &,
- const std::shared_ptr<const RepositoryMaskInfo> &, const MetadataKeyType);
- ~EMutableRepositoryMaskInfoKey();
-
- virtual const std::shared_ptr<const RepositoryMaskInfo> value() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- void set_value(const std::shared_ptr<const RepositoryMaskInfo> &);
-
- virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
class EDependenciesKey :
public MetadataSpecTreeKey<DependencySpecTree>
{
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3bc8619..152db35 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -169,8 +169,6 @@ namespace paludis
mutable std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use;
mutable std::shared_ptr<const LiteralMetadataStringSetKey> raw_use_expand;
mutable std::shared_ptr<const LiteralMetadataStringSetKey> raw_use_expand_hidden;
- mutable std::shared_ptr<EMutableRepositoryMaskInfoKey> repository_mask;
- mutable std::shared_ptr<EMutableRepositoryMaskInfoKey> profile_mask;
mutable std::shared_ptr<const EPlainTextSpecKey> remote_ids;
mutable std::shared_ptr<const EPlainTextSpecKey> bugs_to;
mutable std::shared_ptr<const ESimpleURIKey> upstream_changelog;
@@ -354,13 +352,6 @@ 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>("repository_mask", "Repository masked",
- e_repo->repository_masked(shared_from_this()), mkt_internal);
- add_metadata_key(_imp->repository_mask);
- _imp->profile_mask = std::make_shared<EMutableRepositoryMaskInfoKey>("profile_mask", "Profile masked",
- 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;
if (_imp->eapi->supported())
{
@@ -535,6 +526,9 @@ EbuildID::need_masks_added() const
return;
}
+ auto repo(_imp->environment->package_database()->fetch_repository(_imp->repository_name));
+ auto e_repo(std::static_pointer_cast<const ERepository>(repo));
+
if (keywords_key())
{
if (! _imp->environment->accept_keywords(keywords_key()->value(), shared_from_this()))
@@ -566,19 +560,21 @@ EbuildID::need_masks_added() const
_imp->environment->distribution())->concept_license(), license_key()->raw_name()));
}
+ auto repo_mask(e_repo->repository_masked(shared_from_this()));
+ auto profile_mask(e_repo->profile()->profile_masked(shared_from_this()));
if (! _imp->environment->unmasked_by_user(shared_from_this(), ""))
{
/* repo unless user */
- if (_imp->repository_mask->value())
+ if (repo_mask)
add_mask(std::make_shared<ERepositoryMask>('R', "repository",
- _imp->repository_mask->value()->comment() ? join(_imp->repository_mask->value()->comment()->begin(),
- _imp->repository_mask->value()->comment()->end(), " ") : "", "", _imp->repository_mask->value()->mask_file()));
+ repo_mask->comment() ? join(repo_mask->comment()->begin(), repo_mask->comment()->end(), " ") : "",
+ "", repo_mask->mask_file()));
/* profile unless user */
- if (_imp->profile_mask->value())
+ if (profile_mask)
add_mask(std::make_shared<ERepositoryMask>('P', "profile",
- _imp->profile_mask->value()->comment() ? join(_imp->profile_mask->value()->comment()->begin(),
- _imp->profile_mask->value()->comment()->end(), " ") : "", "", _imp->profile_mask->value()->mask_file()));
+ profile_mask->comment() ? join(profile_mask->comment()->begin(), profile_mask->comment()->end(), " ") : "",
+ "", profile_mask->mask_file()));
/* user */
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(shared_from_this(), false));
@@ -588,22 +584,22 @@ EbuildID::need_masks_added() const
else
{
/* repo overridden by user */
- if (_imp->repository_mask->value())
+ if (repo_mask)
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
n::mask() = std::make_shared<ERepositoryMask>('r', "repository (overridden)",
- _imp->repository_mask->value()->comment() ? join(_imp->repository_mask->value()->comment()->begin(),
- _imp->repository_mask->value()->comment()->end(), " ") : "", "", _imp->repository_mask->value()->mask_file()),
+ repo_mask->comment() ? join(repo_mask->comment()->begin(), repo_mask->comment()->end(), " ") : "",
+ "", repo_mask->mask_file()),
n::override_reason() = mro_overridden_by_user
)));
/* profile unless user */
- if (_imp->profile_mask->value())
+ if (profile_mask)
add_overridden_mask(std::make_shared<OverriddenMask>(
make_named_values<OverriddenMask>(
n::mask() = std::make_shared<ERepositoryMask>('p', "profile (overridden)",
- _imp->profile_mask->value()->comment() ? join(_imp->profile_mask->value()->comment()->begin(),
- _imp->profile_mask->value()->comment()->end(), " ") : "", "", _imp->profile_mask->value()->mask_file()),
+ profile_mask->comment() ? join(profile_mask->comment()->begin(), profile_mask->comment()->end(), " ") : "",
+ "", profile_mask->mask_file()),
n::override_reason() = mro_overridden_by_user
)));
@@ -634,11 +630,6 @@ EbuildID::invalidate_masks() const
_imp->has_masks = false;
PackageID::invalidate_masks();
-
- 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
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 46a0c46..45503e8 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -156,8 +156,8 @@ module Paludis
end
def test_each_metadata
- keys = { "DESCRIPTION" => 1, "INHERITED" => 1, "KEYWORDS" => 1, "EAPI" => 1, "repository_mask" => 1,
- "profile_mask" => 1, "DEPEND" => 1, "RDEPEND" => 1, "PDEPEND" => 1, "LICENSE" => 1, "PROVIDE" => 1,
+ keys = { "DESCRIPTION" => 1, "INHERITED" => 1, "KEYWORDS" => 1, "EAPI" => 1,
+ "DEPEND" => 1, "RDEPEND" => 1, "PDEPEND" => 1, "LICENSE" => 1, "PROVIDE" => 1,
"RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1, "EBUILD" => 1, "PROPERTIES" => 1, "IUSE" => 1,
"PALUDIS_CHOICES" => 1, "DEFINED_PHASES" => 1, "SLOT" => 1 }
pid_testrepo.each_metadata do | key |
@@ -242,13 +242,6 @@ module Paludis
assert_equal ['test'], pid_testrepo.keywords_key.value
end
- def test_repository_mask_info_keys
- assert_kind_of MetadataRepositoryMaskInfoKey, pid_testrepo["repository_mask"]
- assert_kind_of RepositoryMaskInfo, pid_testrepo["repository_mask"].value
- assert_equal ["this is", "a test"], pid_testrepo["repository_mask"].value.comment
- assert_nil pid_testrepo["profile_mask"].value
- end
-
def test_build_dependencies_key
assert_kind_of MetadataDependencySpecTreeKey, pid_testrepo.build_dependencies_key
assert_kind_of AllDepSpec, pid_testrepo.build_dependencies_key.value