aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-18 19:07:59 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-18 19:07:59 +0100
commit3ab6d5f5e2129f7f0c14318a878ee6189bcc754a (patch)
treeed8646d17d73ad6bff915bbcecc8175fe30715eb
parent6068dc1ba3ae8e914cdd4cf97b044e7e6925598b (diff)
downloadpaludis-3ab6d5f5e2129f7f0c14318a878ee6189bcc754a.tar.gz
paludis-3ab6d5f5e2129f7f0c14318a878ee6189bcc754a.tar.xz
Don't try to override empty or -* keywords
-rw-r--r--paludis/mask_utils.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/paludis/mask_utils.cc b/paludis/mask_utils.cc
index 6ffcc0d..8a2ea12 100644
--- a/paludis/mask_utils.cc
+++ b/paludis/mask_utils.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -20,15 +20,44 @@
#include <paludis/mask_utils.hh>
#include <paludis/package_id.hh>
#include <paludis/mask.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/name.hh>
using namespace paludis;
namespace
{
+ struct WeaklyUnaccepted
+ {
+ bool visit(const MetadataCollectionKey<KeywordNameSet> & k) const
+ {
+ auto v(k.parse_value());
+
+ if (! v->empty())
+ return false;
+
+ if (v->end() != v->find(KeywordName("-*")))
+ return false;
+
+ return true;
+ }
+
+ bool visit(const MetadataKey &) const
+ {
+ return true;
+ }
+ };
+
struct WeakMask
{
- bool visit(const UnacceptedMask &) const
+ const std::shared_ptr<const PackageID> id;
+
+ bool visit(const UnacceptedMask & m) const
{
+ auto k(id->find_metadata(m.unaccepted_key_name()));
+ if (k != id->end_metadata())
+ return (*k)->accept_returning<bool>(WeaklyUnaccepted{});
+
return true;
}
@@ -59,7 +88,7 @@ paludis::not_strongly_masked(const std::shared_ptr<const PackageID> & id)
{
for (auto m(id->begin_masks()), m_end(id->end_masks()) ;
m != m_end ; ++m)
- if (! (*m)->accept_returning<bool>(WeakMask()))
+ if (! (*m)->accept_returning<bool>(WeakMask{id}))
return false;
return true;