aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-16 19:19:52 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-16 19:19:52 +0000
commitae97e3f4b15b180fe0d1bcc4257103c3ad116f83 (patch)
tree6150b02237e5b668b36743d296df0cf799347b55 /paludis
parent4efa00282a8282be189bcda866a8fad9c448a407 (diff)
downloadpaludis-ae97e3f4b15b180fe0d1bcc4257103c3ad116f83.tar.gz
paludis-ae97e3f4b15b180fe0d1bcc4257103c3ad116f83.tar.xz
Smarter mask reasons code. Fixes: ticket:317
Diffstat (limited to 'paludis')
-rw-r--r--paludis/dep_list/Makefile.am6
-rw-r--r--paludis/dep_list/dep_list.cc70
-rw-r--r--paludis/dep_list/dep_list.hh4
-rw-r--r--paludis/dep_list/dep_list.sr2
-rw-r--r--paludis/dep_list/dep_list_TEST.cc25
-rw-r--r--paludis/dep_list/dep_list_TEST.hh3
-rw-r--r--paludis/dep_list/options.hh10
-rw-r--r--paludis/dep_list/options.se20
-rw-r--r--paludis/dep_list/override_functions.cc428
-rw-r--r--paludis/dep_list/override_functions.hh43
-rw-r--r--paludis/dep_list/show_suggest_visitor.cc2
-rw-r--r--paludis/environment.hh37
-rw-r--r--paludis/environment_implementation.cc264
-rw-r--r--paludis/environment_implementation.hh81
-rw-r--r--paludis/environment_implementation_TEST.cc154
-rw-r--r--paludis/environments/adapted/adapted_environment.cc24
-rw-r--r--paludis/environments/adapted/adapted_environment.hh14
-rw-r--r--paludis/environments/no_config/no_config_environment.cc75
-rw-r--r--paludis/environments/no_config/no_config_environment.hh37
-rw-r--r--paludis/environments/paludis/paludis_environment.cc68
-rw-r--r--paludis/environments/paludis/paludis_environment.hh29
-rw-r--r--paludis/environments/paludis/paludis_environment_TEST.cc2
-rw-r--r--paludis/environments/portage/portage_environment.cc100
-rw-r--r--paludis/environments/portage/portage_environment.hh31
-rw-r--r--paludis/environments/test/test_environment.cc74
-rw-r--r--paludis/environments/test/test_environment.hh36
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/mask-fwd.hh (renamed from paludis/mask_reasons.cc)22
-rw-r--r--paludis/mask_reasons.hh45
-rw-r--r--paludis/mask_reasons.se27
-rw-r--r--paludis/package_id.cc28
-rw-r--r--paludis/package_id.hh28
-rw-r--r--paludis/query.cc2
-rw-r--r--paludis/repositories/e/Makefile.am84
-rw-r--r--paludis/repositories/e/e_mask.cc154
-rw-r--r--paludis/repositories/e/e_mask.hh70
-rw-r--r--paludis/repositories/e/e_repository.cc11
-rw-r--r--paludis/repositories/e/e_repository.hh11
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc12
-rw-r--r--paludis/repositories/e/e_repository_news.cc1
-rw-r--r--paludis/repositories/e/e_repository_profile.cc1
-rw-r--r--paludis/repositories/e/ebuild.cc1
-rw-r--r--paludis/repositories/e/ebuild_id.cc117
-rw-r--r--paludis/repositories/e/ebuild_id.hh1
-rw-r--r--paludis/repositories/e/vdb_id.cc5
-rw-r--r--paludis/repositories/e/vdb_id.hh1
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_package_id.cc208
-rw-r--r--paludis/repositories/fake/fake_package_id.hh31
-rw-r--r--paludis/repositories/fake/fake_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc15
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh9
-rw-r--r--paludis/repositories/gems/gem_specification.cc43
-rw-r--r--paludis/repositories/gems/gem_specification.hh5
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc4
-rw-r--r--paludis/repositories/gems/gem_specifications.cc19
-rw-r--r--paludis/repositories/gems/gem_specifications.hh2
-rw-r--r--paludis/repositories/gems/gems_repository.cc3
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc4
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc1
-rw-r--r--paludis/repositories/virtuals/package_id.cc48
-rw-r--r--paludis/repositories/virtuals/package_id.hh1
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc1
-rw-r--r--paludis/repository-fwd.hh1
-rw-r--r--paludis/repository.cc16
-rw-r--r--paludis/repository.hh46
-rw-r--r--paludis/repository.sr1
-rw-r--r--paludis/set_file.cc1
-rw-r--r--paludis/tasks/report_task.cc30
-rw-r--r--paludis/tasks/report_task.hh4
71 files changed, 1818 insertions, 942 deletions
diff --git a/paludis/dep_list/Makefile.am b/paludis/dep_list/Makefile.am
index b49051152..f46c509a4 100644
--- a/paludis/dep_list/Makefile.am
+++ b/paludis/dep_list/Makefile.am
@@ -29,7 +29,8 @@ paludis_dep_list_include_HEADERS = \
uninstall_list-sr.hh \
range_rewriter.hh \
options-se.hh \
- uninstall_list-se.hh
+ uninstall_list-se.hh \
+ override_functions.hh
libpaludisdeplist_la_SOURCES = \
options.cc options.hh \
@@ -39,7 +40,8 @@ libpaludisdeplist_la_SOURCES = \
range_rewriter.cc range_rewriter.hh \
query_visitor.cc query_visitor.hh \
show_suggest_visitor.cc show_suggest_visitor.hh \
- condition_tracker.cc condition_tracker.hh
+ condition_tracker.cc condition_tracker.hh \
+ override_functions.cc override_functions.hh
libpaludisdeplist_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index c0d9c6f88..e6d950e80 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -59,6 +59,8 @@
using namespace paludis;
+template class Sequence<tr1::function<bool (const PackageID &, const Mask &)> >;
+
#include <paludis/dep_list/dep_list-sr.cc>
DepListOptions::DepListOptions() :
@@ -386,62 +388,46 @@ DepList::AddVisitor::visit_leaf(const PackageDepSpec & a)
for (PackageIDSequence::ReverseIterator p(installable_candidates->rbegin()),
p_end(installable_candidates->rend()) ; p != p_end ; ++p)
- if (! d->_imp->env->mask_reasons(**p).any())
+ if (! (*p)->masked())
{
best_visible_candidate = *p;
break;
}
/* are we allowed to override mask reasons? */
- if (! best_visible_candidate && d->_imp->opts->override_masks.any())
+ if (! best_visible_candidate && d->_imp->opts->override_masks)
{
- DepListOverrideMask next(static_cast<DepListOverrideMask>(0));
- DepListOverrideMasks masks_to_override;
-
- do
+ for (DepListOverrideMasksFunctions::Iterator of(d->_imp->opts->override_masks->begin()),
+ of_end(d->_imp->opts->override_masks->end()) ; of != of_end ; ++of)
{
- while (next != last_dl_override)
- {
- if (masks_to_override[next])
- next = static_cast<DepListOverrideMask>(static_cast<int>(next) + 1);
- else if (d->_imp->opts->override_masks[next])
- {
- masks_to_override += next;
- break;
- }
- else
- next = static_cast<DepListOverrideMask>(static_cast<int>(next) + 1);
- }
-
- if (next == last_dl_override)
+ if (best_visible_candidate)
break;
- MaskReasons mask_mask;
- if (masks_to_override[dl_override_repository_masks])
- mask_mask += mr_repository_mask;
- if (masks_to_override[dl_override_profile_masks])
- mask_mask += mr_profile_mask;
- if (masks_to_override[dl_override_licenses])
- mask_mask += mr_license;
- mask_mask += mr_by_association;
-
- MaskReasonsOptions override_options;
- if (masks_to_override[dl_override_tilde_keywords])
- override_options += mro_override_tilde_keywords;
- if (masks_to_override[dl_override_unkeyworded])
- override_options += mro_override_unkeyworded;
-
for (PackageIDSequence::ReverseIterator p(installable_candidates->rbegin()),
p_end(installable_candidates->rend()) ; p != p_end ; ++p)
{
- if (! (d->_imp->env->mask_reasons(**p, override_options).subtract(mask_mask).any()))
+ bool success(true);
+ for (PackageID::MasksIterator m((*p)->begin_masks()), m_end((*p)->end_masks()) ;
+ m != m_end ; ++m)
+ {
+ bool local_success(false);
+ for (DepListOverrideMasksFunctions::Iterator o(d->_imp->opts->override_masks->begin()),
+ o_end(next(of)) ; o != o_end ; ++o)
+ if ((*o)(**p, *m))
+ local_success = true;
+
+ success &= local_success;
+ if (! success)
+ break;
+ }
+
+ if (success)
{
d->add_error_package(*p, dlk_masked, a, conditions);
best_visible_candidate = *p;
- break;
}
}
- } while (! best_visible_candidate);
+ }
}
/* no installable candidates. if we're already installed, that's ok (except for top level
@@ -488,7 +474,7 @@ DepList::AddVisitor::visit_leaf(const PackageDepSpec & a)
for (PackageIDSequence::Iterator i(match_except_reqs->begin()),
i_end(match_except_reqs->end()) ; i != i_end ; ++i)
- if (! (d->_imp->env->mask_reasons(**i).any()))
+ if (! (*i)->masked())
throw UseRequirementsNotMetError(stringify(a));
throw AllMaskedError(a);
@@ -678,7 +664,8 @@ DepList::AddVisitor::visit_sequence(const AnyDepSpec & a,
Save<bool> save_t(&d->_imp->throw_on_blocker,
dl_blocks_discard_completely != d->_imp->opts->blocks);
- Save<DepListOverrideMasks> save_o(&d->_imp->opts->override_masks, DepListOverrideMasks());
+ Save<tr1::shared_ptr<DepListOverrideMasksFunctions> > save_o(&d->_imp->opts->override_masks,
+ tr1::shared_ptr<DepListOverrideMasksFunctions>());
d->add_not_top_level(*c, destinations, conditions);
return;
}
@@ -699,7 +686,8 @@ DepList::AddVisitor::visit_sequence(const AnyDepSpec & a,
Save<bool> save_t(&d->_imp->throw_on_blocker,
dl_blocks_discard_completely != d->_imp->opts->blocks);
- Save<DepListOverrideMasks> save_o(&d->_imp->opts->override_masks, DepListOverrideMasks());
+ Save<tr1::shared_ptr<DepListOverrideMasksFunctions> > save_o(&d->_imp->opts->override_masks,
+ tr1::shared_ptr<DepListOverrideMasksFunctions>());
d->add_not_top_level(*c, destinations, conditions);
return;
}
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index 9da074d51..aaab40b73 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_DEP_LIST_HH 1
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/mask-fwd.hh>
#include <paludis/dep_tag.hh>
#include <paludis/dep_list/options.hh>
#include <paludis/dep_list/dep_list-fwd.hh>
@@ -29,6 +30,7 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/tr1_functional.hh>
#include <paludis/version_spec.hh>
#include <iosfwd>
@@ -37,6 +39,8 @@
namespace paludis
{
+ typedef Sequence<tr1::function<bool (const PackageID &, const Mask &)> > DepListOverrideMasksFunctions;
+
#include <paludis/dep_list/dep_list-sr.hh>
/**
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index d292bff9b..810bec257 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -26,7 +26,7 @@ make_class_DepListOptions()
key circular DepListCircularOption
key use DepListUseOption
key blocks DepListBlocksOption
- key override_masks DepListOverrideMasks
+ key override_masks "tr1::shared_ptr<DepListOverrideMasksFunctions>"
key dependency_tags bool
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 8d8ca97b1..d3803bb81 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -21,7 +21,9 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/package_id.hh>
+#include <paludis/mask.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/dep_list/override_functions.hh>
#include <paludis/dep_spec_pretty_printer.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -835,6 +837,21 @@ namespace test_cases
}
} test_dep_list_37;
+ struct DepListTestCase38 : DepListTestCase<38>
+ {
+ void populate_repo()
+ {
+ repo->add_version("cat", "one", "1")->keywords_key()->set_from_string("test");
+ repo->add_version("cat", "one", "2")->keywords_key()->set_from_string("~test");
+ }
+
+ void populate_expected()
+ {
+ merge_target = "cat/one";
+ expected.push_back("cat/one-1:0::repo");
+ }
+ } test_dep_list_38;
+
/**
* \test Test DepList resolution behaviour.
*
@@ -1282,7 +1299,9 @@ namespace test_cases
{
void set_options(DepListOptions & opts)
{
- opts.override_masks += dl_override_tilde_keywords;
+ using namespace tr1::placeholders;
+ opts.override_masks.reset(new DepListOverrideMasksFunctions);
+ opts.override_masks->push_back(tr1::bind(&override_tilde_keywords, &env, _1, _2));
}
void populate_repo()
@@ -1352,7 +1371,9 @@ namespace test_cases
{
void set_options(DepListOptions & opts)
{
- opts.override_masks += dl_override_tilde_keywords;
+ using namespace tr1::placeholders;
+ opts.override_masks.reset(new DepListOverrideMasksFunctions);
+ opts.override_masks->push_back(tr1::bind(&override_tilde_keywords, &env, _1, _2));
}
void populate_repo()
diff --git a/paludis/dep_list/dep_list_TEST.hh b/paludis/dep_list/dep_list_TEST.hh
index 77d78c28e..e2a05c69d 100644
--- a/paludis/dep_list/dep_list_TEST.hh
+++ b/paludis/dep_list/dep_list_TEST.hh
@@ -136,7 +136,8 @@ namespace test_cases
d.add(PackageDepSpec(merge_target, pds_pm_unspecific), env.default_destinations());
TEST_CHECK(true);
- TestMessageSuffix s("d={ " + join(d.begin(), d.end(), ", ") + " }", false);
+ TestMessageSuffix s("got={ " + join(d.begin(), d.end(), ", ") + " }", false);
+ TestMessageSuffix s2("expected={ " + join(expected.begin(), expected.end(), ", ") + " }", false);
unsigned n(0);
std::list<std::string>::const_iterator exp(expected.begin());
diff --git a/paludis/dep_list/options.hh b/paludis/dep_list/options.hh
index 191401fb8..127bb93df 100644
--- a/paludis/dep_list/options.hh
+++ b/paludis/dep_list/options.hh
@@ -22,20 +22,10 @@
#include <iosfwd>
#include <paludis/util/attributes.hh>
-#include <paludis/util/options.hh>
namespace paludis
{
-
#include <paludis/dep_list/options-se.hh>
-
- /**
- * Set of masks that can be overridden.
- *
- * \ingroup grpdepresolver
- * \see DepListOverrideMask
- */
- typedef Options<DepListOverrideMask> DepListOverrideMasks;
}
#endif
diff --git a/paludis/dep_list/options.se b/paludis/dep_list/options.se
index b8c635d82..95cf5c352 100644
--- a/paludis/dep_list/options.se
+++ b/paludis/dep_list/options.se
@@ -253,23 +253,3 @@ make_enum_DepListEntryKind()
END
}
-make_enum_DepListOverrideMask()
-{
- prefix dl_override
-
- key dl_override_licenses "Override unaccepted licences"
- key dl_override_tilde_keywords "Override ~keywords"
- key dl_override_unkeyworded "Override unkeyworded"
- key dl_override_repository_masks "Override repository masks"
- key dl_override_profile_masks "Override profile masks"
-
- doxygen_comment <<"END"
- /**
- * Masks that can be overridden.
- *
- * \ingroup grpdepresolver
- * \see DepListOverrideMasks
- */
-END
-}
-
diff --git a/paludis/dep_list/override_functions.cc b/paludis/dep_list/override_functions.cc
new file mode 100644
index 000000000..739602e3d
--- /dev/null
+++ b/paludis/dep_list/override_functions.cc
@@ -0,0 +1,428 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/dep_list/override_functions.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/mask.hh>
+#include <paludis/name.hh>
+
+using namespace paludis;
+
+namespace
+{
+ struct OverrideTildeKeywordsKeyVisitor :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ const Environment * const env;
+ const PackageID & id;
+ bool result;
+
+ OverrideTildeKeywordsKeyVisitor(const Environment * const e, const PackageID & i) :
+ env(e),
+ id(i),
+ result(false)
+ {
+ }
+
+ void visit(const MetadataPackageIDKey &)
+ {
+ }
+
+ void visit(const MetadataTimeKey &)
+ {
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
+
+ void visit(const MetadataStringKey &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<InheritedSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & k)
+ {
+ tr1::shared_ptr<KeywordNameSet> kk(new KeywordNameSet);
+ for (KeywordNameSet::Iterator i(k.value()->begin()), i_end(k.value()->end()) ;
+ i != i_end ; ++i)
+ {
+ kk->insert(*i);
+ if ('~' == stringify(*i).at(0))
+ kk->insert(KeywordName(stringify(*i).substr(1)));
+ }
+
+ result |= env->accept_keywords(kk, id);
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> &)
+ {
+ }
+ };
+
+ struct OverrideTildeKeywordsMaskVisitor :
+ ConstVisitor<MaskVisitorTypes>
+ {
+ const Environment * const env;
+ const PackageID & id;
+ bool result;
+
+ OverrideTildeKeywordsMaskVisitor(const Environment * const e, const PackageID & i) :
+ env(e),
+ id(i),
+ result(false)
+ {
+ }
+
+ void visit(const UserMask &)
+ {
+ }
+
+ void visit(const UnacceptedMask & m)
+ {
+ OverrideTildeKeywordsKeyVisitor k(env, id);
+ m.unaccepted_key()->accept(k);
+ result |= k.result;
+ }
+
+ void visit(const RepositoryMask &)
+ {
+ }
+
+ void visit(const AssociationMask &)
+ {
+ }
+
+ void visit(const UnsupportedMask &)
+ {
+ }
+ };
+
+ struct OverrideUnkeywordedKeyVisitor :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ const Environment * const env;
+ const PackageID & id;
+ bool result;
+
+ OverrideUnkeywordedKeyVisitor(const Environment * const e, const PackageID & i) :
+ env(e),
+ id(i),
+ result(false)
+ {
+ }
+
+ void visit(const MetadataPackageIDKey &)
+ {
+ }
+
+ void visit(const MetadataTimeKey &)
+ {
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
+
+ void visit(const MetadataStringKey &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<InheritedSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & k)
+ {
+ tr1::shared_ptr<KeywordNameSet> kk(new KeywordNameSet);
+ for (KeywordNameSet::Iterator i(k.value()->begin()), i_end(k.value()->end()) ;
+ i != i_end ; ++i)
+ if ('-' == stringify(*i).at(0))
+ kk->insert(KeywordName(stringify(*i).substr(1)));
+
+ result |= ! env->accept_keywords(kk, id);
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> &)
+ {
+ }
+ };
+
+ struct OverrideUnkeywordedMaskVisitor :
+ ConstVisitor<MaskVisitorTypes>
+ {
+ const Environment * const env;
+ const PackageID & id;
+ bool result;
+
+ OverrideUnkeywordedMaskVisitor(const Environment * const e, const PackageID & i) :
+ env(e),
+ id(i),
+ result(false)
+ {
+ }
+
+ void visit(const UserMask &)
+ {
+ }
+
+ void visit(const UnacceptedMask & m)
+ {
+ OverrideUnkeywordedKeyVisitor k(env, id);
+ m.unaccepted_key()->accept(k);
+ result |= k.result;
+ }
+
+ void visit(const RepositoryMask &)
+ {
+ }
+
+ void visit(const AssociationMask &)
+ {
+ }
+
+ void visit(const UnsupportedMask &)
+ {
+ }
+ };
+
+ struct OverrideRepositoryMasksVisitor :
+ ConstVisitor<MaskVisitorTypes>
+ {
+ bool result;
+
+ OverrideRepositoryMasksVisitor() :
+ result(false)
+ {
+ }
+
+ void visit(const UserMask &)
+ {
+ }
+
+ void visit(const UnacceptedMask &)
+ {
+ }
+
+ void visit(const RepositoryMask &)
+ {
+ result = true;
+ }
+
+ void visit(const AssociationMask &)
+ {
+ }
+
+ void visit(const UnsupportedMask &)
+ {
+ }
+ };
+
+ struct OverrideLicenseKeyVisitor :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ bool result;
+
+ OverrideLicenseKeyVisitor() :
+ result(false)
+ {
+ }
+
+ void visit(const MetadataPackageIDKey &)
+ {
+ }
+
+ void visit(const MetadataTimeKey &)
+ {
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
+
+ void visit(const MetadataStringKey &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
+ {
+ result = true;
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<InheritedSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> &)
+ {
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> &)
+ {
+ }
+ };
+
+ struct OverrideLicenseVisitor :
+ ConstVisitor<MaskVisitorTypes>
+ {
+ bool result;
+
+ OverrideLicenseVisitor() :
+ result(false)
+ {
+ }
+
+ void visit(const UserMask &)
+ {
+ }
+
+ void visit(const UnacceptedMask & m)
+ {
+ OverrideLicenseKeyVisitor k;
+ m.unaccepted_key()->accept(k);
+ result |= k.result;
+ }
+
+ void visit(const RepositoryMask &)
+ {
+ }
+
+ void visit(const AssociationMask &)
+ {
+ }
+
+ void visit(const UnsupportedMask &)
+ {
+ }
+ };
+}
+
+bool
+paludis::override_tilde_keywords(const Environment * const e, const PackageID & i, const Mask & m)
+{
+ Context c("When working out whether mask is a tilde keyword mask for override:");
+ OverrideTildeKeywordsMaskVisitor k(e, i);
+ m.accept(k);
+ return k.result;
+}
+
+bool
+paludis::override_unkeyworded(const Environment * const e, const PackageID & i, const Mask & m)
+{
+ Context c("When working out whether mask is an unkeyworded mask for override:");
+ OverrideUnkeywordedMaskVisitor k(e, i);
+ m.accept(k);
+ return k.result;
+}
+
+bool
+paludis::override_repository_masks(const Mask & m)
+{
+ Context c("When working out whether mask is a repository mask for override:");
+ OverrideRepositoryMasksVisitor k;
+ m.accept(k);
+ return k.result;
+}
+
+bool
+paludis::override_license(const Mask & m)
+{
+ Context c("When working out whether mask is a license mask for override:");
+ OverrideLicenseVisitor k;
+ m.accept(k);
+ return k.result;
+}
+
+
diff --git a/paludis/dep_list/override_functions.hh b/paludis/dep_list/override_functions.hh
new file mode 100644
index 000000000..a42df3b25
--- /dev/null
+++ b/paludis/dep_list/override_functions.hh
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_LIST_OVERRIDE_FUNCTIONS_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_LIST_OVERRIDE_FUNCTIONS_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/mask-fwd.hh>
+
+namespace paludis
+{
+ bool override_tilde_keywords(const Environment * const e, const PackageID & i, const Mask & m)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ bool override_unkeyworded(const Environment * const e, const PackageID & i, const Mask & m)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ bool override_repository_masks(const Mask & m)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ bool override_license(const Mask & m)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/dep_list/show_suggest_visitor.cc b/paludis/dep_list/show_suggest_visitor.cc
index a13fd9ee8..0bb57e4a6 100644
--- a/paludis/dep_list/show_suggest_visitor.cc
+++ b/paludis/dep_list/show_suggest_visitor.cc
@@ -120,7 +120,7 @@ ShowSuggestVisitor::visit_leaf(const PackageDepSpec & a)
for (PackageIDSequence::Iterator m(matches->begin()), m_end(matches->end()) ;
m != m_end ; ++m)
{
- if (_imp->environment->mask_reasons(**m).any())
+ if ((*m)->masked())
continue;
_imp->dep_list->add_suggested_package(*m, a, _imp->conditions, _imp->destinations);
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 40fb6e552..913598ee8 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -24,12 +24,12 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/options-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
-#include <paludis/mask_reasons.hh>
#include <paludis/name-fwd.hh>
#include <paludis/hook-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/mask-fwd.hh>
/** \file
* Declarations for the Environment class.
@@ -39,7 +39,6 @@
namespace paludis
{
-
/**
* Represents a working environment, which contains an available packages
* database and provides various methods for querying package visibility
@@ -97,30 +96,42 @@ namespace paludis
///\{
/**
- * Return the reasons for a package being masked.
+ * Do we accept a particular license for a particular package?
+ */
+ virtual bool accept_license(const std::string &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Do we accept any of the specified keywords for a particular package?
*
- * \see paludis::query::NotMasked
+ * If the collection includes "*", should return true.
*/
- virtual MaskReasons mask_reasons(const PackageID &,
- const MaskReasonsOptions & = MaskReasonsOptions()) const
+ virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
- * Do we accept a particular license for a particular package?
+ * Do we have a 'breaks' mask for a particular package?
*
- * Default behaviour: true.
+ * Returns a zero pointer if no.
*/
- virtual bool accept_license(const std::string &, const PackageID &) const
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
- * Do we accept any of the specified keywords for a particular package?
+ * Do we have a 'user' mask for a particular package?
*
- * If the collection includes "*", should return true.
+ * Returns a zero pointer if no.
+ */
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Do we have a user unmask for a particular package?
*
- * Default behaviour: true if the collection includes "*".
+ * This is only applied to repository and profile style masks, not
+ * keywords, licences etc. If true, user_mask shouldn't be used.
*/
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ virtual bool unmasked_by_user(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 8d4eeba0c..9e0fbc93e 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -34,122 +34,11 @@
using namespace paludis;
-namespace
-{
- struct LicenceChecker :
- ConstVisitor<LicenseSpecTree>,
- ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>
- {
- using ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>::visit_sequence;
-
- bool ok;
- const EnvironmentImplementation * const env;
- bool (EnvironmentImplementation::* const func) (const std::string &, const PackageID &) const;
- const PackageID * const id;
-
- LicenceChecker(const EnvironmentImplementation * const e,
- bool (EnvironmentImplementation::* const f) (const std::string &, const PackageID &) const,
- const PackageID * const d) :
- ok(true),
- env(e),
- func(f),
- id(d)
- {
- }
-
- void visit_sequence(const AnyDepSpec &,
- LicenseSpecTree::ConstSequenceIterator begin,
- LicenseSpecTree::ConstSequenceIterator end)
- {
- bool local_ok(false);
-
- if (begin == end)
- local_ok = true;
- else
- {
- for ( ; begin != end ; ++begin)
- {
- Save<bool> save_ok(&ok, true);
- begin->accept(*this);
- local_ok |= ok;
- }
- }
-
- ok &= local_ok;
- }
-
- void visit_sequence(const UseDepSpec & spec,
- LicenseSpecTree::ConstSequenceIterator begin,
- LicenseSpecTree::ConstSequenceIterator end)
- {
- if (env->query_use(spec.flag(), *id))
- std::for_each(begin, end, accept_visitor(*this));
- }
-
- void visit_leaf(const PlainTextDepSpec & spec)
- {
- if (! (env->*func)(spec.text(), *id))
- ok = false;
- }
- };
-}
-
-bool
-EnvironmentImplementation::accept_eapi(const PackageID & e) const
-{
- return e.eapi()->supported;
-}
-
-bool
-EnvironmentImplementation::accept_keywords(tr1::shared_ptr<const KeywordNameSet> k,
- const PackageID &) const
-{
- return k->end() != k->find(KeywordName("*"));
-}
-
-bool
-EnvironmentImplementation::accept_license(const std::string &, const PackageID &) const
-{
- return true;
-}
-
-bool
-EnvironmentImplementation::accept_breaks_portage(const PackageID &) const
-{
- return true;
-}
-
-bool
-EnvironmentImplementation::masked_by_user(const PackageID &) const
-{
- return false;
-}
-
-bool
-EnvironmentImplementation::unmasked_by_user(const PackageID &) const
-{
- return false;
-}
-
-bool
-EnvironmentImplementation::breaks_portage(const PackageID & e) const
-{
- return (e.version().has_try_part() || e.version().has_scm_part()
- || (! e.eapi()->supported) || (e.eapi()->supported->breaks_portage));
-}
-
EnvironmentImplementation::~EnvironmentImplementation()
{
}
-tr1::shared_ptr<const UseFlagNameSet>
-EnvironmentImplementation::known_use_expand_names(const UseFlagName &, const PackageID &) const
-{
- static tr1::shared_ptr<const UseFlagNameSet> result(new UseFlagNameSet);
- return result;
-}
-
tr1::shared_ptr<const FSEntrySequence>
EnvironmentImplementation::bashrc_files() const
{
@@ -175,51 +64,6 @@ EnvironmentImplementation::fetchers_dirs() const
return result;
}
-tr1::shared_ptr<const FSEntrySequence>
-EnvironmentImplementation::hook_dirs() const
-{
- static tr1::shared_ptr<const FSEntrySequence> result(new FSEntrySequence);
- return result;
-}
-
-const FSEntry
-EnvironmentImplementation::root() const
-{
- return FSEntry("/");
-}
-
-uid_t
-EnvironmentImplementation::reduced_uid() const
-{
- return getuid();
-}
-
-gid_t
-EnvironmentImplementation::reduced_gid() const
-{
- return getgid();
-}
-
-tr1::shared_ptr<const MirrorsSequence>
-EnvironmentImplementation::mirrors(const std::string &) const
-{
- static tr1::shared_ptr<const MirrorsSequence> result(new MirrorsSequence);
- return result;
-}
-
-tr1::shared_ptr<const SetNameSet>
-EnvironmentImplementation::set_names() const
-{
- static tr1::shared_ptr<const SetNameSet> result(new SetNameSet);
- return result;
-}
-
-HookResult
-EnvironmentImplementation::perform_hook(const Hook &) const
-{
- return HookResult(0, "");
-}
-
tr1::shared_ptr<const DestinationsSet>
EnvironmentImplementation::default_destinations() const
{
@@ -235,94 +79,6 @@ EnvironmentImplementation::default_destinations() const
return result;
}
-MaskReasons
-EnvironmentImplementation::mask_reasons(const PackageID & e, const MaskReasonsOptions & options) const
-{
- Context context("When checking for mask reasons for '" + stringify(e) + "':");
-
- MaskReasons result;
-
- if (! accept_eapi(e))
- {
- result += mr_eapi;
- return result;
- }
-
- if (breaks_portage(e) && ! accept_breaks_portage(e))
- result += mr_breaks_portage;
-
- if (e.virtual_for_key())
- {
- result |= mask_reasons(*e.virtual_for_key()->value());
- if (result.any())
- result += mr_by_association;
- }
-
- if (e.keywords_key())
- {
- tr1::shared_ptr<const KeywordNameSet> keywords(e.keywords_key()->value());
- if (! accept_keywords(keywords, e))
- {
- do
- {
- if (options[mro_override_unkeyworded])
- {
- tr1::shared_ptr<KeywordNameSet> minus_keywords(new KeywordNameSet);
- for (KeywordNameSet::Iterator k(keywords->begin()), k_end(keywords->end()) ;
- k != k_end ; ++k)
- if ('-' == stringify(*k).at(0))
- minus_keywords->insert(KeywordName(stringify(*k).substr(1)));
-
- if (! accept_keywords(minus_keywords, e))
- continue;
- }
-
- if (options[mro_override_tilde_keywords])
- {
- tr1::shared_ptr<KeywordNameSet> detildeified_keywords(new KeywordNameSet);
- for (KeywordNameSet::Iterator k(keywords->begin()), k_end(keywords->end()) ;
- k != k_end ; ++k)
- {
- detildeified_keywords->insert(*k);
- if ('~' == stringify(*k).at(0))
- detildeified_keywords->insert(KeywordName(stringify(*k).substr(1)));
- }
-
- if (accept_keywords(detildeified_keywords, e))
- continue;
- }
-
- result += mr_keyword;
- } while (false);
- }
- }
-
- if (e.license_key())
- {
- LicenceChecker lc(this, &EnvironmentImplementation::accept_license, &e);
- e.license_key()->value()->accept(lc);
- if (! lc.ok)
- result += mr_license;
- }
-
- if (! unmasked_by_user(e))
- {
- if (masked_by_user(e))
- result += mr_user_mask;
-
- if (e.repository()->mask_interface)
- {
- if (e.repository()->mask_interface->query_profile_masks(e))
- result += mr_profile_mask;
-
- if (e.repository()->mask_interface->query_repository_masks(e))
- result += mr_repository_mask;
- }
- }
-
- return result;
-}
-
tr1::shared_ptr<SetSpecTree::ConstItem>
EnvironmentImplementation::set(const SetName & s) const
{
@@ -402,15 +158,23 @@ EnvironmentImplementation::query_use(const UseFlagName & f, const PackageID & e)
return false;
}
-tr1::shared_ptr<SetSpecTree::ConstItem>
-EnvironmentImplementation::local_set(const SetName &) const
-{
- return tr1::shared_ptr<SetSpecTree::ConstItem>();
-}
-
std::string
EnvironmentImplementation::default_distribution() const
{
return DEFAULT_DISTRIBUTION;
}
+tr1::shared_ptr<const SetNameSet>
+EnvironmentImplementation::set_names() const
+{
+ static tr1::shared_ptr<const SetNameSet> result(new SetNameSet);
+ return result;
+}
+
+bool
+EnvironmentImplementation::breaks_portage(const PackageID & e) const
+{
+ return (e.version().has_try_part() || e.version().has_scm_part()
+ || (! e.eapi()->supported) || (e.eapi()->supported->breaks_portage));
+}
+
diff --git a/paludis/environment_implementation.hh b/paludis/environment_implementation.hh
index f7159a7a4..8d9e249ed 100644
--- a/paludis/environment_implementation.hh
+++ b/paludis/environment_implementation.hh
@@ -36,57 +36,13 @@ namespace paludis
public Environment
{
protected:
- ///\name Mask reasons
-
- /**
- * Do we accept a particular EAPI?
- *
- * Default behaviour: recognised EAPIs accepted.
- */
- virtual bool accept_eapi(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Accept packages with versions, EAPIs etc that will break Portage?
- *
- * Default behaviour: true.
- */
- virtual bool accept_breaks_portage(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Is a package masked by user settings?
- *
- * Default behaviour: false.
- */
- virtual bool masked_by_user(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- /**
- * Is a package unmasked by user settings?
- *
- * Default behaviour: false.
- */
- virtual bool unmasked_by_user(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- /**
- * Does a package break Portage?
- */
virtual bool breaks_portage(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- ///\}
-
- ///\name Package sets
- ///\{
-
- /**
- * Return the environment-specific named set, or a zero pointer if no such set is available.
- */
- virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
public:
///\name Basic operations
///\{
@@ -98,20 +54,6 @@ namespace paludis
virtual bool query_use(const UseFlagName &, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual MaskReasons mask_reasons(const PackageID &,
- const MaskReasonsOptions & = MaskReasonsOptions()) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool accept_license(const std::string &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual tr1::shared_ptr<const FSEntrySequence> bashrc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -121,21 +63,6 @@ namespace paludis
virtual tr1::shared_ptr<const FSEntrySequence> fetchers_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual const FSEntry root() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual uid_t reduced_uid() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual gid_t reduced_gid() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual tr1::shared_ptr<const SetNameSet> set_names() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -145,11 +72,9 @@ namespace paludis
virtual tr1::shared_ptr<const DestinationsSet> default_destinations() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual HookResult perform_hook(const Hook &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::string default_distribution() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
};
}
diff --git a/paludis/environment_implementation_TEST.cc b/paludis/environment_implementation_TEST.cc
deleted file mode 100644
index ab2561959..000000000
--- a/paludis/environment_implementation_TEST.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/environment_implementation.hh>
-#include <paludis/package_database.hh>
-#include <paludis/repositories/fake/fake_repository.hh>
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/package_id.hh>
-#include <paludis/name.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/tr1_functional.hh>
-#include <paludis/util/tr1_memory.hh>
-#include <libwrapiter/libwrapiter_forward_iterator.hh>
-#include <libwrapiter/libwrapiter_output_iterator.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-
-using namespace paludis;
-using namespace test;
-
-namespace
-{
- class EITestEnvironment :
- public EnvironmentImplementation
- {
- private:
- tr1::shared_ptr<PackageDatabase> _package_database;
-
- public:
- EITestEnvironment() :
- _package_database(new PackageDatabase(this))
- {
- tr1::shared_ptr<FakeRepository> repo(new FakeRepository(this, RepositoryName("repo")));
- _package_database->add_repository(1, tr1::shared_ptr<Repository>(repo));
-
- repo->add_version("foo", "one", "0")->keywords_key()->set_from_string("test foo");
- repo->add_version("foo", "two", "0")->keywords_key()->set_from_string("~test foo");
- repo->add_version("foo", "three", "0")->keywords_key()->set_from_string("-test foo");
- repo->add_version("foo", "four", "0")->keywords_key()->set_from_string("-* foo");
- }
-
- ~EITestEnvironment()
- {
- }
-
- tr1::shared_ptr<PackageDatabase> package_database()
- {
- return _package_database;
- }
-
- tr1::shared_ptr<const PackageDatabase> package_database() const
- {
- return _package_database;
- }
-
- std::string paludis_command() const
- {
- return "";
- }
-
- void set_paludis_command(const std::string &)
- {
- }
-
- bool accept_keywords(tr1::shared_ptr<const KeywordNameSet> k, const PackageID &) const
- {
- return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
- }
-
- const tr1::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName & q,
- const VersionSpec & v, const RepositoryName & r) const
- {
- using namespace tr1::placeholders;
-
- tr1::shared_ptr<const PackageIDSequence> ids(package_database()->fetch_repository(r)->package_ids(q));
- PackageIDSequence::Iterator i(std::find_if(ids->begin(), ids->end(),
- tr1::bind(std::equal_to<VersionSpec>(), tr1::bind(tr1::mem_fn(&PackageID::version), _1), v)));
- if (i == ids->end())
- throw NoSuchPackageError(stringify(q) + "-" + stringify(v) + "::" + stringify(r));
- return *i;
- }
- };
-}
-
-namespace test_cases
-{
- struct MaskReasonsTest : TestCase
- {
- MaskReasonsTest() : TestCase("mask reasons") { }
-
- void run()
- {
- EITestEnvironment env;
-
- MaskReasons m1(env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/one"), VersionSpec("0"), RepositoryName("repo"))));
- TEST_CHECK(! m1[mr_keyword]);
-
- MaskReasons m2(env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/two"), VersionSpec("0"), RepositoryName("repo"))));
- TEST_CHECK(m2[mr_keyword]);
- m2 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/two"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_tilde_keywords);
- TEST_CHECK(! m2[mr_keyword]);
- m2 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/two"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_unkeyworded);
- TEST_CHECK(! m2[mr_keyword]);
-
- MaskReasons m3(env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/three"), VersionSpec("0"), RepositoryName("repo"))));
- TEST_CHECK(m3[mr_keyword]);
- m3 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/three"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_tilde_keywords);
- TEST_CHECK(m3[mr_keyword]);
- m3 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/three"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_unkeyworded);
- TEST_CHECK(m3[mr_keyword]);
-
- MaskReasons m4(env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/four"), VersionSpec("0"), RepositoryName("repo"))));
- TEST_CHECK(m4[mr_keyword]);
- m4 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/four"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_tilde_keywords);
- TEST_CHECK(m4[mr_keyword]);
- m4 = env.mask_reasons(*env.fetch_package_id(
- QualifiedPackageName("foo/four"), VersionSpec("0"), RepositoryName("repo")),
- MaskReasonsOptions() + mro_override_unkeyworded);
- TEST_CHECK(m4[mr_keyword]);
- }
- } test_mask_reasons;
-}
-
diff --git a/paludis/environments/adapted/adapted_environment.cc b/paludis/environments/adapted/adapted_environment.cc
index 5c02e51db..ec7b0ddf5 100644
--- a/paludis/environments/adapted/adapted_environment.cc
+++ b/paludis/environments/adapted/adapted_environment.cc
@@ -112,12 +112,6 @@ AdaptedEnvironment::known_use_expand_names(const UseFlagName & u, const PackageI
return _imp->env->known_use_expand_names(u, e);
}
-MaskReasons
-AdaptedEnvironment::mask_reasons(const PackageID & e, const MaskReasonsOptions & r) const
-{
- return _imp->env->mask_reasons(e, r);
-}
-
bool
AdaptedEnvironment::accept_license(const std::string & l, const PackageID & e) const
{
@@ -220,3 +214,21 @@ AdaptedEnvironment::default_distribution() const
return _imp->env->default_distribution();
}
+const tr1::shared_ptr<const Mask>
+AdaptedEnvironment::mask_for_breakage(const PackageID & id) const
+{
+ return _imp->env->mask_for_breakage(id);
+}
+
+const tr1::shared_ptr<const Mask>
+AdaptedEnvironment::mask_for_user(const PackageID & id) const
+{
+ return _imp->env->mask_for_user(id);
+}
+
+bool
+AdaptedEnvironment::unmasked_by_user(const PackageID & id) const
+{
+ return _imp->env->unmasked_by_user(id);
+}
+
diff --git a/paludis/environments/adapted/adapted_environment.hh b/paludis/environments/adapted/adapted_environment.hh
index 7c912e56b..833e39eae 100644
--- a/paludis/environments/adapted/adapted_environment.hh
+++ b/paludis/environments/adapted/adapted_environment.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_ENVIRONMENTS_ADAPTED_ADAPTED_ENVIRONMENT_HH 1
#include <paludis/environment.hh>
+#include <paludis/util/private_implementation_pattern.hh>
namespace paludis
{
@@ -64,10 +65,6 @@ namespace paludis
const UseFlagName &, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual MaskReasons mask_reasons(const PackageID &,
- const MaskReasonsOptions & = MaskReasonsOptions()) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual bool accept_license(const std::string &, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -119,6 +116,15 @@ namespace paludis
virtual std::string default_distribution() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool unmasked_by_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index b65f7a310..ba5aafdd1 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -23,12 +23,15 @@
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/map.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/repositories/repository_maker.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/config_file.hh>
#include <paludis/distribution.hh>
#include <paludis/package_database.hh>
#include <paludis/eapi.hh>
+#include <paludis/hook.hh>
#include <paludis/repositories/e/e_repository_params.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -330,3 +333,75 @@ NoConfigEnvironment::accept_keywords(tr1::shared_ptr<const KeywordNameSet> keywo
return false;
}
+tr1::shared_ptr<SetSpecTree::ConstItem>
+NoConfigEnvironment::local_set(const SetName &) const
+{
+ return tr1::shared_ptr<SetSpecTree::ConstItem>();
+}
+
+bool
+NoConfigEnvironment::unmasked_by_user(const PackageID &) const
+{
+ return false;
+}
+
+const tr1::shared_ptr<const Mask>
+NoConfigEnvironment::mask_for_breakage(const PackageID &) const
+{
+ return tr1::shared_ptr<const Mask>();
+}
+
+const tr1::shared_ptr<const Mask>
+NoConfigEnvironment::mask_for_user(const PackageID &) const
+{
+ return tr1::shared_ptr<const Mask>();
+}
+
+uid_t
+NoConfigEnvironment::reduced_uid() const
+{
+ return getuid();
+}
+
+gid_t
+NoConfigEnvironment::reduced_gid() const
+{
+ return getgid();
+}
+
+tr1::shared_ptr<const MirrorsSequence>
+NoConfigEnvironment::mirrors(const std::string &) const
+{
+ return make_shared_ptr(new MirrorsSequence);
+}
+
+bool
+NoConfigEnvironment::accept_license(const std::string &, const PackageID &) const
+{
+ return true;
+}
+
+const FSEntry
+NoConfigEnvironment::root() const
+{
+ return FSEntry("/");
+}
+
+HookResult
+NoConfigEnvironment::perform_hook(const Hook &) const
+{
+ return HookResult(0, "");
+}
+
+tr1::shared_ptr<const FSEntrySequence>
+NoConfigEnvironment::hook_dirs() const
+{
+ return make_shared_ptr(new FSEntrySequence);
+}
+
+tr1::shared_ptr<const UseFlagNameSet>
+NoConfigEnvironment::known_use_expand_names(const UseFlagName &, const PackageID &) const
+{
+ return make_shared_ptr(new UseFlagNameSet);
+}
+
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 868f0c86b..eee39ea89 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -58,7 +58,8 @@ namespace paludis
private InstantiationPolicy<NoConfigEnvironment, instantiation_method::NonCopyableTag>
{
protected:
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+
+ virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
public:
@@ -121,6 +122,40 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void set_paludis_command(const std::string &);
+
+ virtual tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
+ const UseFlagName &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_license(const std::string &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool unmasked_by_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const FSEntry root() const;
+
+ virtual uid_t reduced_uid() const;
+
+ virtual gid_t reduced_gid() const;
+
+ virtual tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual HookResult perform_hook(const Hook &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 67f9314b5..d560f5edb 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -34,12 +34,14 @@
#include <paludis/distribution.hh>
#include <paludis/dep_tag.hh>
#include <paludis/package_id.hh>
+#include <paludis/mask.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/tr1_functional.hh>
@@ -220,12 +222,6 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
}
bool
-PaludisEnvironment::accept_breaks_portage(const PackageID &) const
-{
- return _imp->config->accept_breaks_portage();
-}
-
-bool
PaludisEnvironment::accept_keywords(tr1::shared_ptr<const KeywordNameSet> k,
const PackageID & e) const
{
@@ -246,12 +242,6 @@ PaludisEnvironment::accept_license(const std::string & license, const PackageID
}
bool
-PaludisEnvironment::masked_by_user(const PackageID & d) const
-{
- return _imp->config->package_mask_conf()->query(d);
-}
-
-bool
PaludisEnvironment::unmasked_by_user(const PackageID & d) const
{
return _imp->config->package_unmask_conf()->query(d);
@@ -446,3 +436,57 @@ PaludisEnvironment::default_distribution() const
return _imp->config->distribution();
}
+namespace
+{
+ class BreaksPortageMask :
+ public UnsupportedMask
+ {
+ const char key() const
+ {
+ return 'B';
+ }
+
+ const std::string description() const
+ {
+ return "breaks Portage";
+ }
+
+ const std::string explanation() const
+ {
+ return "";
+ }
+ };
+
+ class UserConfigMask :
+ public UserMask
+ {
+ const char key() const
+ {
+ return 'U';
+ }
+
+ const std::string description() const
+ {
+ return "user";
+ }
+ };
+}
+
+const tr1::shared_ptr<const Mask>
+PaludisEnvironment::mask_for_breakage(const PackageID & id) const
+{
+ if ((! _imp->config->accept_breaks_portage()) && breaks_portage(id))
+ return make_shared_ptr(new BreaksPortageMask);
+
+ return tr1::shared_ptr<const Mask>();
+}
+
+const tr1::shared_ptr<const Mask>
+PaludisEnvironment::mask_for_user(const PackageID & d) const
+{
+ if (_imp->config->package_mask_conf()->query(d))
+ return make_shared_ptr(new UserConfigMask);
+
+ return tr1::shared_ptr<const Mask>();
+}
+
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 6850acbb4..2f1f880a2 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -50,20 +50,6 @@ namespace paludis
private PrivateImplementationPattern<PaludisEnvironment>
{
protected:
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool accept_license(const std::string &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool accept_breaks_portage(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool masked_by_user(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool unmasked_by_user(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName & id) const;
@@ -137,6 +123,21 @@ namespace paludis
virtual std::string default_distribution() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_license(const std::string &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool unmasked_by_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
#endif
diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc
index 615f61159..911cd0659 100644
--- a/paludis/environments/paludis/paludis_environment_TEST.cc
+++ b/paludis/environments/paludis/paludis_environment_TEST.cc
@@ -158,7 +158,6 @@ namespace test_cases
void run()
{
-#if 0
setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home4").c_str(), 1);
unsetenv("PALUDIS_SKIP_CONFIG");
@@ -175,7 +174,6 @@ namespace test_cases
TEST_CHECK(env->package_database()->more_important_than(RepositoryName("fourth"), RepositoryName("third")));
TEST_CHECK(env->package_database()->more_important_than(RepositoryName("fourth"), RepositoryName("fifth")));
TEST_CHECK(env->package_database()->more_important_than(RepositoryName("second"), RepositoryName("fifth")));
-#endif
}
} paludis_environment_repositories;
}
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 165e86c9b..9f8c2b600 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -29,10 +29,13 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/repositories/repository_maker.hh>
#include <paludis/config_file.hh>
#include <paludis/hooker.hh>
#include <paludis/hook.hh>
+#include <paludis/mask.hh>
#include <paludis/match_package.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
@@ -549,17 +552,6 @@ PortageEnvironment::root() const
}
bool
-PortageEnvironment::masked_by_user(const PackageID & e) const
-{
- for (PackageMask::const_iterator i(_imp->package_mask.begin()), i_end(_imp->package_mask.end()) ;
- i != i_end ; ++i)
- if (match_package(*this, **i, e))
- return true;
-
- return false;
-}
-
-bool
PortageEnvironment::unmasked_by_user(const PackageID & e) const
{
for (PackageUnmask::const_iterator i(_imp->package_unmask.begin()), i_end(_imp->package_unmask.end()) ;
@@ -637,12 +629,6 @@ PortageEnvironment::bashrc_files() const
return result;
}
-bool
-PortageEnvironment::accept_breaks_portage(const PackageID &) const
-{
- return false;
-}
-
tr1::shared_ptr<PackageDatabase>
PortageEnvironment::package_database()
{
@@ -666,3 +652,83 @@ PortageEnvironment::mirrors(const std::string & m) const
return result;
}
+tr1::shared_ptr<SetSpecTree::ConstItem>
+PortageEnvironment::local_set(const SetName &) const
+{
+ return tr1::shared_ptr<SetSpecTree::ConstItem>();
+}
+
+bool
+PortageEnvironment::accept_license(const std::string &, const PackageID &) const
+{
+ return true;
+}
+
+namespace
+{
+ class BreaksPortageMask :
+ public UnsupportedMask
+ {
+ const char key() const
+ {
+ return 'B';
+ }
+
+ const std::string description() const
+ {
+ return "breaks Portage";
+ }
+
+ const std::string explanation() const
+ {
+ return "";
+ }
+ };
+
+ class UserConfigMask :
+ public UserMask
+ {
+ const char key() const
+ {
+ return 'U';
+ }
+
+ const std::string description() const
+ {
+ return "user";
+ }
+ };
+}
+
+const tr1::shared_ptr<const Mask>
+PortageEnvironment::mask_for_breakage(const PackageID & id) const
+{
+ if (breaks_portage(id))
+ return make_shared_ptr(new BreaksPortageMask);
+
+ return tr1::shared_ptr<const Mask>();
+}
+
+const tr1::shared_ptr<const Mask>
+PortageEnvironment::mask_for_user(const PackageID & d) const
+{
+ for (PackageMask::const_iterator i(_imp->package_mask.begin()), i_end(_imp->package_mask.end()) ;
+ i != i_end ; ++i)
+ if (match_package(*this, **i, d))
+ return make_shared_ptr(new UserConfigMask);
+
+ return tr1::shared_ptr<const Mask>();
+}
+
+gid_t
+PortageEnvironment::reduced_gid() const
+{
+ return getgid();
+}
+
+uid_t
+PortageEnvironment::reduced_uid() const
+{
+ return getuid();
+}
+
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index a74781599..8d51599bd 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -22,6 +22,7 @@
#include <paludis/environment_implementation.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/private_implementation_pattern.hh>
namespace paludis
{
@@ -74,16 +75,7 @@ namespace paludis
void _load_atom_file(const FSEntry &, I_, const std::string &);
protected:
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool accept_breaks_portage(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool masked_by_user(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool unmasked_by_user(const PackageID &) const
+ virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
public:
@@ -127,6 +119,25 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void set_paludis_command(const std::string &);
+
+ virtual bool accept_license(const std::string &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool unmasked_by_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual uid_t reduced_uid() const;
+
+ virtual gid_t reduced_gid() const;
};
}
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 4adc7ab88..3e51e1546 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -22,8 +22,10 @@
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
+#include <paludis/hook.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <string>
@@ -67,6 +69,12 @@ TestEnvironment::accept_keywords(tr1::shared_ptr<const KeywordNameSet> k, const
return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
}
+bool
+TestEnvironment::accept_license(const std::string &, const PackageID &) const
+{
+ return true;
+}
+
tr1::shared_ptr<PackageDatabase>
TestEnvironment::package_database()
{
@@ -105,3 +113,69 @@ TestEnvironment::fetch_package_id(const QualifiedPackageName & q,
return *i;
}
+tr1::shared_ptr<SetSpecTree::ConstItem>
+TestEnvironment::local_set(const SetName &) const
+{
+ return tr1::shared_ptr<SetSpecTree::ConstItem>();
+}
+
+uid_t
+TestEnvironment::reduced_uid() const
+{
+ return getuid();
+}
+
+gid_t
+TestEnvironment::reduced_gid() const
+{
+ return getgid();
+}
+
+const FSEntry
+TestEnvironment::root() const
+{
+ return FSEntry("/");
+}
+
+tr1::shared_ptr<const MirrorsSequence>
+TestEnvironment::mirrors(const std::string &) const
+{
+ return make_shared_ptr(new MirrorsSequence);
+}
+
+HookResult
+TestEnvironment::perform_hook(const Hook &) const
+{
+ return HookResult(0, "");
+}
+
+tr1::shared_ptr<const FSEntrySequence>
+TestEnvironment::hook_dirs() const
+{
+ return make_shared_ptr(new FSEntrySequence);
+}
+
+const tr1::shared_ptr<const Mask>
+TestEnvironment::mask_for_breakage(const PackageID &) const
+{
+ return tr1::shared_ptr<const Mask>();
+}
+
+const tr1::shared_ptr<const Mask>
+TestEnvironment::mask_for_user(const PackageID &) const
+{
+ return tr1::shared_ptr<const Mask>();
+}
+
+bool
+TestEnvironment::unmasked_by_user(const PackageID &) const
+{
+ return false;
+}
+
+tr1::shared_ptr<const UseFlagNameSet>
+TestEnvironment::known_use_expand_names(const UseFlagName &, const PackageID &) const
+{
+ return make_shared_ptr(new UseFlagNameSet);
+}
+
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 989a986b0..af6e31dea 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -44,7 +44,7 @@ namespace paludis
public EnvironmentImplementation
{
protected:
- virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ virtual tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
public:
@@ -76,6 +76,40 @@ namespace paludis
*/
const tr1::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName &,
const VersionSpec &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
+ const UseFlagName &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_license(const std::string &, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accept_keywords(tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool unmasked_by_user(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const FSEntry root() const;
+
+ virtual uid_t reduced_uid() const;
+
+ virtual gid_t reduced_gid() const;
+
+ virtual tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual HookResult perform_hook(const Hook &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index eb54a0517..4ef1b88de 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -19,12 +19,12 @@ add(`dep_tag', `hh', `cc', `fwd', `sr')
add(`distribution', `hh', `cc', `fwd', `sr')
add(`eapi', `hh', `cc', `fwd', `sr')
add(`environment', `hh', `fwd', `cc', `se')
-add(`environment_implementation', `hh', `cc', `test')
+add(`environment_implementation', `hh', `cc')
add(`hashed_containers', `hh', `cc', `test')
add(`hook', `hh', `cc', `fwd',`se', `sr')
add(`hooker', `hh', `cc', `test', `testscript')
add(`host_tuple_name', `hh', `cc', `sr', `test')
-add(`mask_reasons', `hh', `cc', `se')
+add(`mask', `hh', `cc', `fwd')
add(`match_package', `hh', `cc')
add(`metadata_key', `hh', `cc', `se', `fwd')
add(`name', `hh', `cc', `fwd', `test', `sr', `se')
diff --git a/paludis/mask_reasons.cc b/paludis/mask-fwd.hh
index 8b36d9003..d3ba1e517 100644
--- a/paludis/mask_reasons.cc
+++ b/paludis/mask-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -17,13 +17,21 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef PALUDIS_GUARD_PALUDIS_MASK_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_MASK_FWD_HH 1
-#include <paludis/mask_reasons.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/exception.hh>
-#include <ostream>
+#include <paludis/util/visitor-fwd.hh>
-using namespace paludis;
+namespace paludis
+{
+ class Mask;
+ class UserMask;
+ class UnacceptedMask;
+ class RepositoryMask;
+ class UnsupportedMask;
+ class AssociationMask;
-#include <paludis/mask_reasons-se.cc>
+ class MaskVisitorTypes;
+}
+#endif
diff --git a/paludis/mask_reasons.hh b/paludis/mask_reasons.hh
deleted file mode 100644
index d5aa2f3eb..000000000
--- a/paludis/mask_reasons.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_MASK_REASONS_HH
-#define PALUDIS_GUARD_PALUDIS_MASK_REASONS_HH 1
-
-#include <paludis/util/options.hh>
-#include <iosfwd>
-
-/** \file
- * Declarations for MaskReasons and related classes.
- *
- * \ingroup grpmaskreasons
- */
-
-namespace paludis
-{
-
-#include <paludis/mask_reasons-se.hh>
-
- /**
- * A collection of reasons for why a package is masked.
- *
- * \ingroup grpmaskreasons
- */
- typedef Options<MaskReason> MaskReasons;
-}
-
-#endif
diff --git a/paludis/mask_reasons.se b/paludis/mask_reasons.se
deleted file mode 100644
index 4af407003..000000000
--- a/paludis/mask_reasons.se
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_MaskReason()
-{
- prefix mr
-
- key mr_keyword "no keyword match"
- key mr_user_mask "user package.mask"
- key mr_profile_mask "profile package.mask"
- key mr_repository_mask "repository package.mask"
- key mr_eapi "unknown eapi"
- key mr_by_association "masked by association with another package (for virtuals)"
- key mr_chost "masked by chost"
- key mr_breaks_portage "masked because it will break portage"
- key mr_license "unaccepted license"
-
- doxygen_comment << "END"
- /**
- * Each value represents one reason for a package being masked.
- *
- * \see MaskReasons
- * \ingroup grpmaskreasons
- */
-END
-}
-
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index 37ba5141b..183aedb03 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -51,6 +51,7 @@ namespace paludis
struct Implementation<PackageID>
{
mutable std::list<tr1::shared_ptr<const MetadataKey> > keys;
+ mutable std::list<tr1::shared_ptr<const Mask> > masks;
};
}
@@ -67,6 +68,7 @@ void
PackageID::add_metadata_key(const tr1::shared_ptr<const MetadataKey> & k) const
{
using namespace tr1::placeholders;
+
if (_imp->keys.end() != std::find_if(_imp->keys.begin(), _imp->keys.end(),
tr1::bind(std::equal_to<std::string>(), k->raw_name(), tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1))))
throw ConfigurationError("Tried to add duplicate key '" + k->raw_name() + "' to ID '" + stringify(*this) + "'");
@@ -88,6 +90,32 @@ PackageID::end_metadata() const
return MetadataIterator(indirect_iterator(_imp->keys.end()));
}
+void
+PackageID::add_mask(const tr1::shared_ptr<const Mask> & k) const
+{
+ _imp->masks.push_back(k);
+}
+
+PackageID::MasksIterator
+PackageID::begin_masks() const
+{
+ need_masks_added();
+ return MasksIterator(indirect_iterator(_imp->masks.begin()));
+}
+
+PackageID::MasksIterator
+PackageID::end_masks() const
+{
+ need_masks_added();
+ return MasksIterator(indirect_iterator(_imp->masks.end()));
+}
+
+bool
+PackageID::masked() const
+{
+ return begin_masks() != end_masks();
+}
+
PackageID::MetadataIterator
PackageID::find_metadata(const std::string & s) const
{
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 2f9a95b07..a40ff2b06 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -21,18 +21,21 @@
#define PALUDIS_GUARD_PALUDIS_PACKAGE_ID_HH 1
#include <paludis/package_id-fwd.hh>
-#include <paludis/metadata_key-fwd.hh>
-#include <paludis/action-fwd.hh>
+
#include <paludis/util/attributes.hh>
-#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/tr1_memory.hh>
#include <paludis/util/operators.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/version_spec-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/tr1_memory.hh>
+
+#include <paludis/action-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/eapi-fwd.hh>
+#include <paludis/mask-fwd.hh>
+#include <paludis/metadata_key-fwd.hh>
+#include <paludis/name-fwd.hh>
#include <paludis/repository-fwd.hh>
+#include <paludis/version_spec-fwd.hh>
namespace paludis
{
@@ -45,7 +48,10 @@ namespace paludis
{
protected:
virtual void add_metadata_key(const tr1::shared_ptr<const MetadataKey> &) const;
+ virtual void add_mask(const tr1::shared_ptr<const Mask> &) const;
+
virtual void need_keys_added() const = 0;
+ virtual void need_masks_added() const = 0;
public:
PackageID();
@@ -104,6 +110,16 @@ namespace paludis
///\}
+ ///\name Masks
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<PackageID, const Mask> MasksIterator;
+ MasksIterator begin_masks() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ MasksIterator end_masks() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool masked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
///\name Extra comparisons
///\{
diff --git a/paludis/query.cc b/paludis/query.cc
index 326b6e60a..999727d86 100644
--- a/paludis/query.cc
+++ b/paludis/query.cc
@@ -251,7 +251,7 @@ namespace
tr1::shared_ptr<const PackageIDSequence> i(repo->package_ids(*p));
for (PackageIDSequence::Iterator v(i->begin()), v_end(i->end()) ;
v != v_end ; ++v)
- if (! e.mask_reasons(**v).any())
+ if (! ((*v)->masked()))
result->push_back(*v);
}
}
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index fb4313a29..3063367f3 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -31,73 +31,75 @@ paludis_repositories_e_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/pal
libpaludiserepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
paludis_repositories_e_include_HEADERS = \
- ebuild.hh \
- ebuild-sr.hh \
- ebin.hh \
- ebin-se.hh \
- ebin-sr.hh \
- glsa.hh \
- glsa-sr.hh \
+ e_key.hh \
+ e_mask.hh \
e_repository.hh \
- e_repository_profile_file.hh \
- e_repository_profile.hh \
+ e_repository_entries.hh \
e_repository_exceptions.hh \
e_repository_news.hh \
- e_repository_params.hh \
e_repository_params-sr.hh \
+ e_repository_params.hh \
+ e_repository_profile.hh \
+ e_repository_profile_file.hh \
e_repository_sets.hh \
- e_repository_entries.hh \
- ebuild_entries.hh \
+ eapi_phase.hh \
+ ebin-se.hh \
+ ebin-sr.hh \
+ ebin.hh \
ebin_entries.hh \
+ ebuild-sr.hh \
+ ebuild.hh \
+ ebuild_entries.hh \
ebuild_flat_metadata_cache.hh \
+ ebuild_id.hh \
eclass_mtimes.hh \
- make_ebuild_repository.hh \
+ exheres_layout.hh \
+ glsa-sr.hh \
+ glsa.hh \
+ layout.hh \
make_ebin_repository.hh \
+ make_ebuild_repository.hh \
+ traditional_layout.hh \
use_desc.hh \
- vdb_repository.hh \
- vdb_repository-sr.hh \
+ vdb_id.hh \
vdb_merger-sr.hh \
vdb_merger.hh \
+ vdb_repository-sr.hh \
+ vdb_repository.hh \
vdb_unmerger-sr.hh \
- vdb_unmerger.hh \
- layout.hh \
- traditional_layout.hh \
- exheres_layout.hh \
- eapi_phase.hh \
- ebuild_id.hh \
- vdb_id.hh \
- e_key.hh
+ vdb_unmerger.hh
libpaludiserepository_la_SOURCES = \
- ebuild.cc \
- ebin.cc \
- glsa.cc \
+ e_key.cc \
+ e_mask.cc \
e_repository.cc \
- e_repository_profile_file.cc \
- e_repository_profile.cc \
+ e_repository_entries.cc \
e_repository_exceptions.cc \
e_repository_news.cc \
+ e_repository_params.cc \
+ e_repository_profile.cc \
+ e_repository_profile_file.cc \
e_repository_sets.cc \
- e_repository_entries.cc \
- ebuild_entries.cc \
+ eapi_phase.cc \
+ ebin.cc \
ebin_entries.cc \
+ ebuild.cc \
+ ebuild_entries.cc \
ebuild_flat_metadata_cache.cc \
+ ebuild_id.cc \
eclass_mtimes.cc \
- e_repository_params.cc \
- make_ebuild_repository.cc \
+ exheres_layout.cc \
+ glsa.cc \
+ layout.cc \
make_ebin_repository.cc \
- use_desc.cc \
+ make_ebuild_repository.cc \
registration.cc \
- vdb_repository.cc \
- vdb_merger.cc \
- vdb_unmerger.cc \
- layout.cc \
traditional_layout.cc \
- exheres_layout.cc \
- eapi_phase.cc \
- ebuild_id.cc \
+ use_desc.cc \
vdb_id.cc \
- e_key.cc \
+ vdb_merger.cc \
+ vdb_repository.cc \
+ vdb_unmerger.cc \
$(paludis_repositories_e_include_HEADERS)
if ENABLE_QA
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
new file mode 100644
index 000000000..16fcd148a
--- /dev/null
+++ b/paludis/repositories/e/e_mask.cc
@@ -0,0 +1,154 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_mask.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<EUnacceptedMask>
+ {
+ const char key;
+ const std::string description;
+ const tr1::shared_ptr<const MetadataKey> unaccepted_key;
+
+ Implementation(const char k, const std::string & d, const tr1::shared_ptr<const MetadataKey> & u) :
+ key(k),
+ description(d),
+ unaccepted_key(u)
+ {
+ }
+ };
+}
+
+EUnacceptedMask::EUnacceptedMask(const char k, const std::string & d, const tr1::shared_ptr<const MetadataKey> & u) :
+ PrivateImplementationPattern<EUnacceptedMask>(new Implementation<EUnacceptedMask>(k, d, u))
+{
+}
+
+EUnacceptedMask::~EUnacceptedMask()
+{
+}
+
+const char
+EUnacceptedMask::key() const
+{
+ return _imp->key;
+}
+
+const std::string
+EUnacceptedMask::description() const
+{
+ return _imp->description;
+}
+
+const tr1::shared_ptr<const MetadataKey>
+EUnacceptedMask::unaccepted_key() const
+{
+ return _imp->unaccepted_key;
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<EUnsupportedMask>
+ {
+ const char key;
+ const std::string description;
+ const std::string eapi_name;
+
+ Implementation(const char k, const std::string & d, const std::string & n) :
+ key(k),
+ description(d),
+ eapi_name(n)
+ {
+ }
+ };
+}
+
+EUnsupportedMask::EUnsupportedMask(const char k, const std::string & d, const std::string & n) :
+ PrivateImplementationPattern<EUnsupportedMask>(new Implementation<EUnsupportedMask>(k, d, n))
+{
+}
+
+EUnsupportedMask::~EUnsupportedMask()
+{
+}
+
+const char
+EUnsupportedMask::key() const
+{
+ return _imp->key;
+}
+
+const std::string
+EUnsupportedMask::description() const
+{
+ return _imp->description;
+}
+
+const std::string
+EUnsupportedMask::explanation() const
+{
+ if (_imp->eapi_name == "UNKNOWN")
+ return "Unsupported EAPI 'UNKNOWN' (likely a broken package or configuration error)";
+ return "Unsupported EAPI '" + _imp->eapi_name + "'";
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<ERepositoryMask>
+ {
+ const char key;
+ const std::string description;
+
+ Implementation(const char k, const std::string & d) :
+ key(k),
+ description(d)
+ {
+ }
+ };
+}
+
+ERepositoryMask::ERepositoryMask(const char k, const std::string & d) :
+ PrivateImplementationPattern<ERepositoryMask>(new Implementation<ERepositoryMask>(k, d))
+{
+}
+
+ERepositoryMask::~ERepositoryMask()
+{
+}
+
+const char
+ERepositoryMask::key() const
+{
+ return _imp->key;
+}
+
+const std::string
+ERepositoryMask::description() const
+{
+ return _imp->description;
+}
+
diff --git a/paludis/repositories/e/e_mask.hh b/paludis/repositories/e/e_mask.hh
new file mode 100644
index 000000000..23bad5eaa
--- /dev/null
+++ b/paludis/repositories/e/e_mask.hh
@@ -0,0 +1,70 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_MASK_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_MASK_HH 1
+
+#include <paludis/mask.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class EUnacceptedMask :
+ public UnacceptedMask,
+ private PrivateImplementationPattern<EUnacceptedMask>
+ {
+ public:
+ EUnacceptedMask(const char, const std::string &, const tr1::shared_ptr<const MetadataKey> &);
+ ~EUnacceptedMask();
+
+ const char key() const;
+ const std::string description() const;
+ const tr1::shared_ptr<const MetadataKey> unaccepted_key() const;
+ };
+
+ class EUnsupportedMask :
+ public UnsupportedMask,
+ private PrivateImplementationPattern<EUnsupportedMask>
+ {
+ public:
+ EUnsupportedMask(const char, const std::string &, const std::string &);
+ ~EUnsupportedMask();
+
+ virtual const char key() const;
+ virtual const std::string description() const;
+ virtual const std::string explanation() const;
+ };
+
+ class ERepositoryMask :
+ public RepositoryMask,
+ private PrivateImplementationPattern<ERepositoryMask>
+ {
+ public:
+ ERepositoryMask(const char, const std::string &);
+ ~ERepositoryMask();
+
+ const char key() const;
+ const std::string description() const;
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 0b5dc7f77..9aa3eb074 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -51,6 +51,7 @@
#include <paludis/util/iterator.hh>
#include <paludis/util/log.hh>
#include <paludis/util/random.hh>
+#include <paludis/util/options.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/tokeniser.hh>
@@ -250,7 +251,6 @@ namespace
ERepository::ERepository(const ERepositoryParams & p) :
Repository(fetch_repo_name(p.location),
RepositoryCapabilities::create()
- .mask_interface(this)
.installed_interface(0)
.sets_interface(this)
.syncable_interface(this)
@@ -341,7 +341,7 @@ ERepository::do_package_ids(const QualifiedPackageName & n) const
}
bool
-ERepository::do_query_repository_masks(const PackageID & id) const
+ERepository::repository_masked(const PackageID & id) const
{
if (! _imp->has_repo_mask)
{
@@ -394,13 +394,6 @@ ERepository::do_query_repository_masks(const PackageID & id) const
return false;
}
-bool
-ERepository::do_query_profile_masks(const PackageID & id) const
-{
- _imp->need_profiles();
- return _imp->profile_ptr->profile_masked(id);
-}
-
UseFlagState
ERepository::do_query_use(const UseFlagName & f, const PackageID & e) const
{
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index ed8b9aba1..393ad7893 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -50,7 +50,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE ERepository :
public Repository,
- public RepositoryMaskInterface,
public RepositoryUseInterface,
public RepositorySyncableInterface,
public RepositorySetsInterface,
@@ -84,14 +83,6 @@ namespace paludis
virtual bool do_sync() const;
- /* RepositoryMaskInterface */
-
- virtual bool do_query_repository_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool do_query_profile_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryUseInterface */
virtual UseFlagState do_query_use(const UseFlagName &, const PackageID &) const
@@ -232,6 +223,8 @@ namespace paludis
const tr1::shared_ptr<const ERepositoryEntries> entries() const;
const tr1::shared_ptr<const ERepositoryProfile> profile() const;
+ bool repository_masked(const PackageID &) const;
+
void regenerate_cache() const;
};
}
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 62bf3ae59..42f3e29e5 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -652,12 +652,12 @@ namespace test_cases
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- TEST_CHECK(repo->query_profile_masks(**env.package_database()->query(query::Matches(PackageDepSpec(
- "=cat/masked-0", pds_pm_unspecific)), qo_require_exactly_one)->begin()));
- TEST_CHECK(! repo->query_profile_masks(**env.package_database()->query(query::Matches(PackageDepSpec(
- "=cat/not_masked-0", pds_pm_unspecific)), qo_require_exactly_one)->begin()));
- TEST_CHECK(! repo->query_profile_masks(**env.package_database()->query(query::Matches(PackageDepSpec(
- "=cat/was_masked-0", pds_pm_unspecific)), qo_require_exactly_one)->begin()));
+ TEST_CHECK((*env.package_database()->query(query::Matches(PackageDepSpec("=cat/masked-0", pds_pm_unspecific)),
+ qo_require_exactly_one)->begin())->masked());
+ TEST_CHECK((*env.package_database()->query(query::Matches(PackageDepSpec("=cat/was_masked-0", pds_pm_unspecific)),
+ qo_require_exactly_one)->begin())->masked());
+ TEST_CHECK((*env.package_database()->query(query::Matches(PackageDepSpec("=cat/not_masked-0", pds_pm_unspecific)),
+ qo_require_exactly_one)->begin())->masked());
}
}
} test_e_repository_query_profile_masks;
diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
index 5009d3e00..ab09ecb94 100644
--- a/paludis/repositories/e/e_repository_news.cc
+++ b/paludis/repositories/e/e_repository_news.cc
@@ -28,6 +28,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/options.hh>
#include <paludis/query.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 17ed4b097..c9718096a 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -30,6 +30,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/options.hh>
#include <paludis/config_file.hh>
#include <paludis/dep_tag.hh>
#include <paludis/eapi.hh>
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 2dbb6bc94..bc72d57e2 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -26,6 +26,7 @@
#include <paludis/util/pstream.hh>
#include <paludis/util/log.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/options.hh>
#include <paludis/util/map.hh>
#include <paludis/about.hh>
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 74ee63222..be089f8f2 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/e_repository_entries.hh>
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/e_key.hh>
+#include <paludis/repositories/e/e_mask.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -39,6 +40,8 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/idle_action_pool.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/save.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -77,6 +80,7 @@ namespace paludis
const time_t master_mtime;
const tr1::shared_ptr<const EclassMtimes> eclass_mtimes;
mutable bool has_keys;
+ mutable bool has_masks;
mutable tr1::shared_ptr<const EStringKey> short_description;
mutable tr1::shared_ptr<const EDependenciesKey> build_dependencies;
@@ -103,7 +107,8 @@ namespace paludis
guessed_eapi(g),
master_mtime(t),
eclass_mtimes(m),
- has_keys(false)
+ has_keys(false),
+ has_masks(false)
{
}
};
@@ -249,6 +254,116 @@ EbuildID::need_keys_added() const
}
}
+namespace
+{
+ struct LicenceChecker :
+ ConstVisitor<LicenseSpecTree>,
+ ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>
+ {
+ using ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>::visit_sequence;
+
+ bool ok;
+ const Environment * const env;
+ bool (Environment::* const func) (const std::string &, const PackageID &) const;
+ const PackageID * const id;
+
+ LicenceChecker(const Environment * const e,
+ bool (Environment::* const f) (const std::string &, const PackageID &) const,
+ const PackageID * const d) :
+ ok(true),
+ env(e),
+ func(f),
+ id(d)
+ {
+ }
+
+ void visit_sequence(const AnyDepSpec &,
+ LicenseSpecTree::ConstSequenceIterator begin,
+ LicenseSpecTree::ConstSequenceIterator end)
+ {
+ bool local_ok(false);
+
+ if (begin == end)
+ local_ok = true;
+ else
+ {
+ for ( ; begin != end ; ++begin)
+ {
+ Save<bool> save_ok(&ok, true);
+ begin->accept(*this);
+ local_ok |= ok;
+ }
+ }
+
+ ok &= local_ok;
+ }
+
+ void visit_sequence(const UseDepSpec & spec,
+ LicenseSpecTree::ConstSequenceIterator begin,
+ LicenseSpecTree::ConstSequenceIterator end)
+ {
+ if (env->query_use(spec.flag(), *id))
+ std::for_each(begin, end, accept_visitor(*this));
+ }
+
+ void visit_leaf(const PlainTextDepSpec & spec)
+ {
+ if (! (env->*func)(spec.text(), *id))
+ ok = false;
+ }
+ };
+}
+
+void
+EbuildID::need_masks_added() const
+{
+ if (_imp->has_masks)
+ return;
+
+ _imp->has_masks = true;
+
+ Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':");
+
+ if (! eapi()->supported)
+ {
+ add_mask(make_shared_ptr(new EUnsupportedMask('E', "eapi", eapi()->name)));
+ return;
+ }
+
+ if (keywords_key())
+ if (! _imp->environment->accept_keywords(keywords_key()->value(), *this))
+ add_mask(make_shared_ptr(new EUnacceptedMask('K', "keywords", keywords_key())));
+
+ if (license_key())
+ {
+ LicenceChecker c(_imp->environment, &Environment::accept_license, this);
+ license_key()->value()->accept(c);
+ if (! c.ok)
+ add_mask(make_shared_ptr(new EUnacceptedMask('L', "license", license_key())));
+ }
+
+ if (! _imp->environment->unmasked_by_user(*this))
+ {
+ /* repo unless user */
+ if (tr1::static_pointer_cast<const ERepository>(repository())->repository_masked(*this))
+ add_mask(make_shared_ptr(new ERepositoryMask('R', "repository")));
+
+ /* profile unless user */
+ if (tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this))
+ add_mask(make_shared_ptr(new ERepositoryMask('P', "profile")));
+
+ /* user */
+ tr1::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(*this));
+ if (user_mask)
+ add_mask(user_mask);
+ }
+
+ /* break portage */
+ tr1::shared_ptr<const Mask> breaks_mask(_imp->environment->mask_for_breakage(*this));
+ if (breaks_mask)
+ add_mask(breaks_mask);
+}
+
const std::string
EbuildID::canonical_form(const PackageIDCanonicalForm f) const
{
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index cafe338e2..f54a8f2ab 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -42,6 +42,7 @@ namespace paludis
protected:
virtual void need_keys_added() const;
+ virtual void need_masks_added() const;
public:
EbuildID(const QualifiedPackageName &, const VersionSpec &,
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index e199d857d..097b4975a 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -321,6 +321,11 @@ VDBID::need_keys_added() const
}
}
+void
+VDBID::need_masks_added() const
+{
+}
+
const std::string
VDBID::canonical_form(const PackageIDCanonicalForm f) const
{
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index a0c46b6bf..52a6a639a 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -39,6 +39,7 @@ namespace paludis
protected:
virtual void need_keys_added() const;
+ virtual void need_masks_added() const;
public:
VDBID(const QualifiedPackageName &, const VersionSpec &,
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index b7837da09..3fdc07fc6 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -127,7 +127,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
Repository(RepositoryName("installed"),
RepositoryCapabilities::create()
.installed_interface(this)
- .mask_interface(0)
.sets_interface(this)
.syncable_interface(0)
.use_interface(this)
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 6b8ec694f..52df82e18 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -38,7 +38,6 @@ using namespace paludis;
FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, const RepositoryName & our_name) :
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
.installed_interface(this)
- .mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
.use_interface(this)
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 3547e7e90..303fd2bca 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -22,6 +22,7 @@
#include <paludis/eapi.hh>
#include <paludis/name.hh>
#include <paludis/action.hh>
+#include <paludis/environment.hh>
#include <paludis/version_spec.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/hashed_containers.hh>
@@ -30,7 +31,9 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/save.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -177,11 +180,104 @@ FakeMetadataPackageIDKey::value() const
namespace paludis
{
+ template <>
+ struct Implementation<FakeUnacceptedMask>
+ {
+ const char key;
+ const std::string description;
+ const tr1::shared_ptr<const MetadataKey> unaccepted_key;
+
+ Implementation(const char k, const std::string & d, const tr1::shared_ptr<const MetadataKey> & u) :
+ key(k),
+ description(d),
+ unaccepted_key(u)
+ {
+ }
+ };
+}
+
+FakeUnacceptedMask::FakeUnacceptedMask(const char c, const std::string & s, const tr1::shared_ptr<const MetadataKey> & k) :
+ PrivateImplementationPattern<FakeUnacceptedMask>(new Implementation<FakeUnacceptedMask>(c, s, k))
+{
+}
+
+FakeUnacceptedMask::~FakeUnacceptedMask()
+{
+}
+
+const char
+FakeUnacceptedMask::key() const
+{
+ return _imp->key;
+}
+
+const std::string
+FakeUnacceptedMask::description() const
+{
+ return _imp->description;
+}
+
+const tr1::shared_ptr<const MetadataKey>
+FakeUnacceptedMask::unaccepted_key() const
+{
+ return _imp->unaccepted_key;
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<FakeUnsupportedMask>
+ {
+ const char key;
+ const std::string description;
+ const std::string eapi_name;
+
+ Implementation(const char k, const std::string & d, const std::string & n) :
+ key(k),
+ description(d),
+ eapi_name(n)
+ {
+ }
+ };
+}
+
+FakeUnsupportedMask::FakeUnsupportedMask(const char c, const std::string & s, const std::string & n) :
+ PrivateImplementationPattern<FakeUnsupportedMask>(new Implementation<FakeUnsupportedMask>(c, s, n))
+{
+}
+
+FakeUnsupportedMask::~FakeUnsupportedMask()
+{
+}
+
+const char
+FakeUnsupportedMask::key() const
+{
+ return _imp->key;
+}
+
+const std::string
+FakeUnsupportedMask::description() const
+{
+ return _imp->description;
+}
+
+const std::string
+FakeUnsupportedMask::explanation() const
+{
+ if (_imp->eapi_name == "UNKNOWN")
+ return "Unsupported EAPI 'UNKNOWN' (likely a broken package or configuration error)";
+ return "Unsupported EAPI '" + _imp->eapi_name + "'";
+}
+
+namespace paludis
+{
using namespace tr1::placeholders;
template <>
struct Implementation<FakePackageID>
{
+ const Environment * const env;
const tr1::shared_ptr<const FakeRepositoryBase> repository;
const QualifiedPackageName name;
const VersionSpec version;
@@ -203,8 +299,11 @@ namespace paludis
tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > bin_uri;
tr1::shared_ptr<FakeMetadataSpecTreeKey<URISpecTree> > homepage;
- Implementation(const tr1::shared_ptr<const FakeRepositoryBase> & r,
+ mutable bool has_masks;
+
+ Implementation(const Environment * const e, const tr1::shared_ptr<const FakeRepositoryBase> & r,
const QualifiedPackageName & q, const VersionSpec & v) :
+ env(e),
repository(r),
name(q),
version(v),
@@ -223,15 +322,16 @@ namespace paludis
post_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("PDEPEND", "Post dependencies",
"", tr1::bind(&PortageDepParser::parse_depend, _1, tr1::cref(*eapi)), mkt_dependencies)),
suggested_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("SDEPEND", "Suggested dependencies",
- "", tr1::bind(&PortageDepParser::parse_depend, _1, tr1::cref(*eapi)), mkt_dependencies))
+ "", tr1::bind(&PortageDepParser::parse_depend, _1, tr1::cref(*eapi)), mkt_dependencies)),
+ has_masks(false)
{
}
};
}
-FakePackageID::FakePackageID(const tr1::shared_ptr<const FakeRepositoryBase> & r,
+FakePackageID::FakePackageID(const Environment * const e, const tr1::shared_ptr<const FakeRepositoryBase> & r,
const QualifiedPackageName & q, const VersionSpec & v) :
- PrivateImplementationPattern<FakePackageID>(new Implementation<FakePackageID>(r, q, v)),
+ PrivateImplementationPattern<FakePackageID>(new Implementation<FakePackageID>(e, r, q, v)),
_imp(PrivateImplementationPattern<FakePackageID>::_imp.get())
{
add_metadata_key(_imp->keywords);
@@ -498,6 +598,106 @@ FakePackageID::supports_action(const SupportsActionTestBase & b) const
namespace
{
+ struct LicenceChecker :
+ ConstVisitor<LicenseSpecTree>,
+ ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>
+ {
+ using ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>::visit_sequence;
+
+ bool ok;
+ const Environment * const env;
+ bool (Environment::* const func) (const std::string &, const PackageID &) const;
+ const PackageID * const id;
+
+ LicenceChecker(const Environment * const e,
+ bool (Environment::* const f) (const std::string &, const PackageID &) const,
+ const PackageID * const d) :
+ ok(true),
+ env(e),
+ func(f),
+ id(d)
+ {
+ }
+
+ void visit_sequence(const AnyDepSpec &,
+ LicenseSpecTree::ConstSequenceIterator begin,
+ LicenseSpecTree::ConstSequenceIterator end)
+ {
+ bool local_ok(false);
+
+ if (begin == end)
+ local_ok = true;
+ else
+ {
+ for ( ; begin != end ; ++begin)
+ {
+ Save<bool> save_ok(&ok, true);
+ begin->accept(*this);
+ local_ok |= ok;
+ }
+ }
+
+ ok &= local_ok;
+ }
+
+ void visit_sequence(const UseDepSpec & spec,
+ LicenseSpecTree::ConstSequenceIterator begin,
+ LicenseSpecTree::ConstSequenceIterator end)
+ {
+ if (env->query_use(spec.flag(), *id))
+ std::for_each(begin, end, accept_visitor(*this));
+ }
+
+ void visit_leaf(const PlainTextDepSpec & spec)
+ {
+ if (! (env->*func)(spec.text(), *id))
+ ok = false;
+ }
+ };
+}
+
+void
+FakePackageID::need_masks_added() const
+{
+ if (_imp->has_masks)
+ return;
+
+ _imp->has_masks = true;
+
+ Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':");
+
+ if (! eapi()->supported)
+ {
+ add_mask(make_shared_ptr(new FakeUnsupportedMask('E', "eapi", eapi()->name)));
+ return;
+ }
+
+ if (keywords_key())
+ if (! _imp->env->accept_keywords(keywords_key()->value(), *this))
+ add_mask(make_shared_ptr(new FakeUnacceptedMask('K', "keywords", keywords_key())));
+
+ if (license_key())
+ {
+ LicenceChecker c(_imp->env, &Environment::accept_license, this);
+ license_key()->value()->accept(c);
+ if (! c.ok)
+ add_mask(make_shared_ptr(new FakeUnacceptedMask('L', "license", license_key())));
+ }
+
+ if (! _imp->env->unmasked_by_user(*this))
+ {
+ tr1::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(*this));
+ if (user_mask)
+ add_mask(user_mask);
+ }
+
+ tr1::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(*this));
+ if (breaks_mask)
+ add_mask(breaks_mask);
+}
+
+namespace
+{
struct PerformAction :
ConstVisitor<ActionVisitorTypes>
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 8c9f54e8b..60ae6e47f 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -22,6 +22,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/mask.hh>
#include <paludis/util/tr1_functional.hh>
namespace paludis
@@ -98,6 +99,32 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE FakeUnacceptedMask :
+ public UnacceptedMask,
+ private PrivateImplementationPattern<FakeUnacceptedMask>
+ {
+ public:
+ FakeUnacceptedMask(const char, const std::string &, const tr1::shared_ptr<const MetadataKey> &);
+ ~FakeUnacceptedMask();
+
+ const char key() const;
+ const std::string description() const;
+ const tr1::shared_ptr<const MetadataKey> unaccepted_key() const;
+ };
+
+ class PALUDIS_VISIBLE FakeUnsupportedMask :
+ public UnsupportedMask,
+ private PrivateImplementationPattern<FakeUnsupportedMask>
+ {
+ public:
+ FakeUnsupportedMask(const char, const std::string &, const std::string &);
+ ~FakeUnsupportedMask();
+
+ const char key() const;
+ const std::string description() const;
+ const std::string explanation() const;
+ };
+
class PALUDIS_VISIBLE FakePackageID :
public PackageID,
private PrivateImplementationPattern<FakePackageID>
@@ -107,9 +134,11 @@ namespace paludis
protected:
virtual void need_keys_added() const;
+ virtual void need_masks_added() const;
public:
- FakePackageID(const tr1::shared_ptr<const FakeRepositoryBase> &,
+ FakePackageID(const Environment * const e,
+ const tr1::shared_ptr<const FakeRepositoryBase> &,
const QualifiedPackageName &, const VersionSpec &);
~FakePackageID();
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index d6658dcc6..89f60ebc2 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -53,7 +53,6 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>),
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
.installed_interface(0)
- .mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
.use_interface(this)
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 71168c03d..a611b84d3 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -81,7 +81,6 @@ FakeRepositoryBase::FakeRepositoryBase(const Environment * const e,
const RepositoryName & our_name, const RepositoryCapabilities & caps,
const std::string & f) :
Repository(our_name, caps, f),
- RepositoryMaskInterface(),
RepositoryUseInterface(),
PrivateImplementationPattern<FakeRepositoryBase>(new Implementation<FakeRepositoryBase>(e))
{
@@ -158,23 +157,11 @@ tr1::shared_ptr<FakePackageID>
FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpec & v)
{
add_package(q);
- tr1::shared_ptr<FakePackageID> id(new FakePackageID(shared_from_this(), q, v));
+ tr1::shared_ptr<FakePackageID> id(new FakePackageID(_imp->env, shared_from_this(), q, v));
_imp->ids.find(q)->second->push_back(id);
return id;
}
-bool
-FakeRepositoryBase::do_query_repository_masks(const PackageID &) const
-{
- return false;
-}
-
-bool
-FakeRepositoryBase::do_query_profile_masks(const PackageID &) const
-{
- return false;
-}
-
UseFlagState
FakeRepositoryBase::do_query_use(const UseFlagName &, const PackageID &) const
{
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index 4011dec7a..c07c9a69b 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -44,7 +44,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE FakeRepositoryBase :
public Repository,
- public RepositoryMaskInterface,
public RepositoryUseInterface,
public RepositorySetsInterface,
private PrivateImplementationPattern<FakeRepositoryBase>,
@@ -57,14 +56,6 @@ namespace paludis
FakeRepositoryBase(const Environment * const env, const RepositoryName & name,
const RepositoryCapabilities & caps, const std::string &);
- /* RepositoryMaskInterface */
-
- virtual bool do_query_repository_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool do_query_profile_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryUseInterface */
virtual UseFlagState do_query_use(const UseFlagName &, const PackageID &) const
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 4a54e554e..bd9c74e81 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -29,6 +29,7 @@
#include <paludis/repository.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
+#include <paludis/environment.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -85,12 +86,17 @@ namespace paludis
tr1::shared_ptr<const FSEntry> load_from_file;
+ const Environment * const environment;
const tr1::shared_ptr<const Repository> repository;
const tr1::shared_ptr<const EAPI> eapi;
- Implementation(const tr1::shared_ptr<const Repository> & r) :
+ mutable bool has_masks;
+
+ Implementation(const Environment * const e, const tr1::shared_ptr<const Repository> & r) :
+ environment(e),
repository(r),
- eapi(EAPIData::get_instance()->eapi_from_string("gems-1"))
+ eapi(EAPIData::get_instance()->eapi_from_string("gems-1")),
+ has_masks(false)
{
}
};
@@ -268,8 +274,9 @@ namespace
}
}
-GemSpecification::GemSpecification(const tr1::shared_ptr<const Repository> & r, const yaml::Node & node) :
- PrivateImplementationPattern<GemSpecification>(new Implementation<GemSpecification>(r)),
+GemSpecification::GemSpecification(const Environment * const e,
+ const tr1::shared_ptr<const Repository> & r, const yaml::Node & node) :
+ PrivateImplementationPattern<GemSpecification>(new Implementation<GemSpecification>(e, r)),
_imp(PrivateImplementationPattern<GemSpecification>::_imp.get())
{
TopVisitor v(_imp);
@@ -289,9 +296,9 @@ GemSpecification::GemSpecification(const tr1::shared_ptr<const Repository> & r,
}
-GemSpecification::GemSpecification(const tr1::shared_ptr<const Repository> & r,
+GemSpecification::GemSpecification(const Environment * const e, const tr1::shared_ptr<const Repository> & r,
const PackageNamePart & q, const VersionSpec & v, const FSEntry & f) :
- PrivateImplementationPattern<GemSpecification>(new Implementation<GemSpecification>(r)),
+ PrivateImplementationPattern<GemSpecification>(new Implementation<GemSpecification>(e, r)),
_imp(PrivateImplementationPattern<GemSpecification>::_imp.get())
{
_imp->name_part = stringify(q);
@@ -600,3 +607,27 @@ GemSpecification::perform_action(Action & a) const
a.accept(b);
}
+void
+GemSpecification::need_masks_added() const
+{
+ if (_imp->has_masks)
+ return;
+
+ _imp->has_masks = true;
+
+ Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':");
+
+ if (! _imp->environment->unmasked_by_user(*this))
+ {
+ /* user */
+ tr1::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(*this));
+ if (user_mask)
+ add_mask(user_mask);
+ }
+
+ /* break portage */
+ tr1::shared_ptr<const Mask> breaks_mask(_imp->environment->mask_for_breakage(*this));
+ if (breaks_mask)
+ add_mask(breaks_mask);
+}
+
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index e9ae86f7f..1983e8a46 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -68,13 +68,14 @@ namespace paludis
protected:
void need_keys_added() const;
+ virtual void need_masks_added() const;
public:
///\name Basic operations
///\{
- GemSpecification(const tr1::shared_ptr<const Repository> &, const yaml::Node &);
- GemSpecification(const tr1::shared_ptr<const Repository> &, const PackageNamePart &,
+ GemSpecification(const Environment * const e, const tr1::shared_ptr<const Repository> &, const yaml::Node &);
+ GemSpecification(const Environment * const e, const tr1::shared_ptr<const Repository> &, const PackageNamePart &,
const VersionSpec &, const FSEntry &);
~GemSpecification();
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 06bc8123e..2752e6e59 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -21,6 +21,7 @@
#include <test/test_framework.hh>
#include <paludis/repositories/gems/gem_specification.hh>
#include <paludis/repositories/gems/yaml.hh>
+#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/name.hh>
#include <paludis/metadata_key.hh>
@@ -118,7 +119,8 @@ namespace test_cases
yaml::Document spec_doc(spec_text);
TEST_CHECK(spec_doc.top());
- GemSpecification spec(tr1::shared_ptr<Repository>(), *spec_doc.top());
+ TestEnvironment env;
+ GemSpecification spec(&env, tr1::shared_ptr<Repository>(), *spec_doc.top());
TEST_CHECK(spec.short_description_key());
TEST_CHECK_EQUAL(spec.short_description_key()->value(), "This is the summary");
diff --git a/paludis/repositories/gems/gem_specifications.cc b/paludis/repositories/gems/gem_specifications.cc
index de5291f86..26cf24f1e 100644
--- a/paludis/repositories/gems/gem_specifications.cc
+++ b/paludis/repositories/gems/gem_specifications.cc
@@ -101,10 +101,13 @@ namespace
ConstVisitor<yaml::NodeVisitorTypes>
{
Implementation<GemSpecifications> * const _imp;
+ const Environment * const environment;
const tr1::shared_ptr<const Repository> repository;
- GemsVisitor(const tr1::shared_ptr<const Repository> & r, Implementation<GemSpecifications> * const i) :
+ GemsVisitor(const Environment * const e,
+ const tr1::shared_ptr<const Repository> & r, Implementation<GemSpecifications> * const i) :
_imp(i),
+ environment(e),
repository(r)
{
}
@@ -118,7 +121,7 @@ namespace
try
{
- tr1::shared_ptr<GemSpecification> spec(new GemSpecification(repository, *i->second));
+ tr1::shared_ptr<GemSpecification> spec(new GemSpecification(environment, repository, *i->second));
_imp->specs.insert(std::make_pair(std::make_pair(spec->name(), spec->version()), spec));
}
catch (const Exception & e)
@@ -148,10 +151,13 @@ namespace
ConstVisitor<yaml::NodeVisitorTypes>
{
Implementation<GemSpecifications> * const _imp;
+ const Environment * const environment;
const tr1::shared_ptr<const Repository> repository;
- TopVisitor(const tr1::shared_ptr<const Repository> & r, Implementation<GemSpecifications> * const i) :
+ TopVisitor(const Environment * const e,
+ const tr1::shared_ptr<const Repository> & r, Implementation<GemSpecifications> * const i) :
_imp(i),
+ environment(e),
repository(r)
{
}
@@ -162,7 +168,7 @@ namespace
if (n.end() == i)
throw BadSpecificationError("Top level map does not contain 'gems' node");
- GemsVisitor g(repository, _imp);
+ GemsVisitor g(environment, repository, _imp);
i->second->accept(g);
}
@@ -182,10 +188,11 @@ namespace
}
}
-GemSpecifications::GemSpecifications(const tr1::shared_ptr<const Repository> & r, const yaml::Node & n) :
+GemSpecifications::GemSpecifications(const Environment * const e,
+ const tr1::shared_ptr<const Repository> & r, const yaml::Node & n) :
PrivateImplementationPattern<GemSpecifications>(new Implementation<GemSpecifications>)
{
- TopVisitor v(r, _imp.get());
+ TopVisitor v(e, r, _imp.get());
n.accept(v);
}
diff --git a/paludis/repositories/gems/gem_specifications.hh b/paludis/repositories/gems/gem_specifications.hh
index 629abe766..42a08a36b 100644
--- a/paludis/repositories/gems/gem_specifications.hh
+++ b/paludis/repositories/gems/gem_specifications.hh
@@ -50,7 +50,7 @@ namespace paludis
///\name Basic operations
///\{
- GemSpecifications(const tr1::shared_ptr<const Repository> &, const yaml::Node &);
+ GemSpecifications(const Environment * const, const tr1::shared_ptr<const Repository> &, const yaml::Node &);
~GemSpecifications();
///\}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 94dab62f3..20abc7177 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -65,7 +65,6 @@ namespace paludis
GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
Repository(RepositoryName("gems"),
RepositoryCapabilities::create()
- .mask_interface(0)
.installed_interface(0)
.sets_interface(0)
.syncable_interface(0)
@@ -192,7 +191,7 @@ GemsRepository::need_ids() const
std::string output((std::istreambuf_iterator<char>(yaml_file)), std::istreambuf_iterator<char>());
yaml::Document master_doc(output);
- gems::GemSpecifications specs(shared_from_this(), *master_doc.top());
+ gems::GemSpecifications specs(_imp->params.environment, shared_from_this(), *master_doc.top());
for (gems::GemSpecifications::Iterator i(specs.begin()), i_end(specs.end()) ;
i != i_end ; ++i)
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 517cb6803..fee24f583 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -73,7 +73,6 @@ namespace paludis
InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepositoryParams & params) :
Repository(RepositoryName("installed-gems"),
RepositoryCapabilities::create()
- .mask_interface(0)
.installed_interface(this)
.sets_interface(0)
.syncable_interface(0)
@@ -212,7 +211,8 @@ InstalledGemsRepository::need_ids() const
if (_imp->ids.end() == _imp->ids.find(gems + p))
_imp->ids.insert(std::make_pair(gems + p, make_shared_ptr(new PackageIDSequence)));
- _imp->ids.find(gems + p)->second->push_back(make_shared_ptr(new gems::GemSpecification(shared_from_this(), p, v, *d)));
+ _imp->ids.find(gems + p)->second->push_back(make_shared_ptr(new gems::GemSpecification(
+ _imp->params.environment, shared_from_this(), p, v, *d)));
}
}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index bcbda23c9..625afefed 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -100,7 +100,6 @@ namespace
InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * const env,
const FSEntry & r) :
Repository(RepositoryName(make_name(r)), RepositoryCapabilities::create()
- .mask_interface(0)
.installed_interface(this)
.use_interface(0)
.sets_interface(0)
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index e4b8bf940..2198e3c3f 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -31,6 +31,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/action.hh>
+#include <paludis/mask.hh>
using namespace paludis;
using namespace paludis::virtuals;
@@ -120,6 +121,7 @@ namespace paludis
const tr1::shared_ptr<const MetadataPackageIDKey> virtual_for;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > bdep;
const tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > rdep;
+ mutable bool has_masks;
Implementation(
const tr1::shared_ptr<const Repository> & o,
@@ -131,7 +133,8 @@ namespace paludis
version(p->version()),
virtual_for(new virtuals::VirtualsPackageIDKey(p)),
bdep(new virtuals::VirtualsDepKey("DEPEND", "Build dependencies", p, b)),
- rdep(new virtuals::VirtualsDepKey("RDEPEND", "Run dependencies", p, b))
+ rdep(new virtuals::VirtualsDepKey("RDEPEND", "Run dependencies", p, b)),
+ has_masks(false)
{
}
};
@@ -415,3 +418,46 @@ VirtualsPackageID::supports_action(const SupportsActionTestBase & b) const
return repository()->some_ids_might_support_action(b);
}
+namespace
+{
+ class VirtualsAssociationMask :
+ public AssociationMask
+ {
+ private:
+ const tr1::shared_ptr<const PackageID> _id;
+
+ public:
+ VirtualsAssociationMask(const tr1::shared_ptr<const PackageID> & i) :
+ _id(i)
+ {
+ }
+
+ const char key() const
+ {
+ return 'A';
+ }
+
+ const std::string description() const
+ {
+ return "by association";
+ }
+
+ const tr1::shared_ptr<const PackageID> associated_package() const
+ {
+ return _id;
+ }
+ };
+}
+
+void
+VirtualsPackageID::need_masks_added() const
+{
+ if (_imp->has_masks)
+ return;
+
+ if (_imp->virtual_for->value()->masked())
+ add_mask(make_shared_ptr(new VirtualsAssociationMask(_imp->virtual_for->value())));
+
+ _imp->has_masks = true;
+}
+
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 71344518a..80e7f175f 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -68,6 +68,7 @@ namespace paludis
protected:
virtual void need_keys_added() const;
+ virtual void need_masks_added() const;
public:
VirtualsPackageID(
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 3b2617ab7..217c7ee1a 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -95,7 +95,6 @@ namespace
VirtualsRepository::VirtualsRepository(const Environment * const env) :
Repository(RepositoryName("virtuals"), RepositoryCapabilities::create()
- .mask_interface(0)
.installed_interface(0)
.use_interface(0)
.sets_interface(0)
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index d19d772e1..c3a712902 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -33,7 +33,6 @@ namespace paludis
class Repository;
class RepositoryInstalledInterface;
- class RepositoryMaskInterface;
class RepositorySetsInterface;
class RepositorySyncableInterface;
class RepositoryUseInterface;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 6f4680eb3..c5951dabe 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -168,10 +168,6 @@ RepositoryInstalledInterface::~RepositoryInstalledInterface()
{
}
-RepositoryMaskInterface::~RepositoryMaskInterface()
-{
-}
-
RepositorySetsInterface::~RepositorySetsInterface()
{
}
@@ -293,18 +289,6 @@ RepositoryMirrorsInterface::is_mirror(const std::string & s) const
return begin_mirrors(s) != end_mirrors(s);
}
-bool
-RepositoryMaskInterface::query_repository_masks(const PackageID & e) const
-{
- return do_query_repository_masks(e);
-}
-
-bool
-RepositoryMaskInterface::query_profile_masks(const PackageID & e) const
-{
- return do_query_profile_masks(e);
-}
-
tr1::shared_ptr<const PackageIDSequence>
Repository::package_ids(const QualifiedPackageName & p) const
{
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 37010a8f9..6d37273de 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -237,52 +237,6 @@ namespace paludis
};
/**
- * Interface for handling masks for the Repository class.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryMaskInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: check for a mask.
- */
- virtual bool do_query_repository_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Override in descendents: check for a mask.
- */
- virtual bool do_query_profile_masks(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- ///\}
-
- public:
- ///\name Mask queries
- ///\{
-
- /**
- * Query repository masks.
- */
- bool query_repository_masks(const PackageID &) const;
-
- /**
- * Query profile masks.
- */
- bool query_profile_masks(const PackageID &) const;
-
- ///\}
-
- virtual ~RepositoryMaskInterface();
- };
-
- /**
* Interface for handling USE flags for the Repository class.
*
* \see Repository
diff --git a/paludis/repository.sr b/paludis/repository.sr
index 37b659148..45258b9f1 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -6,7 +6,6 @@ make_class_RepositoryCapabilities()
visible
key installed_interface "RepositoryInstalledInterface *"
- key mask_interface "RepositoryMaskInterface *"
key sets_interface "RepositorySetsInterface *"
key syncable_interface "RepositorySyncableInterface *"
key use_interface "RepositoryUseInterface *"
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index 35b6e3179..81e40fc40 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -24,6 +24,7 @@
#include <paludis/util/pstream.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/options.hh>
#include <paludis/config_file.hh>
#include <paludis/environment.hh>
#include <paludis/query.hh>
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index 494211195..d2f7a970d 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -177,32 +177,10 @@ ReportTask::execute()
for (PackageIDSequence::Iterator v(ids->begin()), v_end(ids->end()) ;
v != v_end ; ++v)
{
- bool is_masked(false);
+ bool is_masked((*v)->masked());
bool is_vulnerable(false);
- bool is_missing(false);
bool is_unused(false);
- MaskReasons mr;
- try
- {
-#if 0
- if ((*v)->source_origin_key())
- {
- mr = e->mask_reasons(*((*v)->source_origin_key()->value()));
- if (mr.any())
- is_masked = true;
- }
-#endif
- }
- catch (const NoSuchPackageError &)
- {
- is_missing = true;
- }
- catch (const NoSuchRepositoryError &)
- {
- is_missing = true;
- }
-
std::pair<VulnerableChecker::ConstIterator, VulnerableChecker::ConstIterator> pi(vuln.insecure_tags(*v));
if (pi.first != pi.second)
is_vulnerable = true;
@@ -210,11 +188,11 @@ ReportTask::execute()
if (unused.end() != unused.find(*v))
is_unused = true;
- if (is_masked || is_vulnerable || is_missing || is_unused)
+ if (is_masked || is_vulnerable || is_unused)
{
on_report_package_failure_pre(**v);
if (is_masked)
- on_report_package_is_masked(**v, mr);
+ on_report_package_is_masked(**v);
if (is_vulnerable)
{
on_report_package_is_vulnerable_pre(**v);
@@ -222,8 +200,6 @@ ReportTask::execute()
on_report_package_is_vulnerable(**v, itag->second->short_text());
on_report_package_is_vulnerable_post(**v);
}
- if (is_missing)
- on_report_package_is_missing(**v);
if (is_unused)
on_report_package_is_unused(**v);
on_report_package_failure_post(**v);
diff --git a/paludis/tasks/report_task.hh b/paludis/tasks/report_task.hh
index 77bd10b9c..5d7efdb76 100644
--- a/paludis/tasks/report_task.hh
+++ b/paludis/tasks/report_task.hh
@@ -23,7 +23,6 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/repository.hh>
-#include <paludis/mask_reasons.hh>
namespace paludis
{
@@ -62,11 +61,10 @@ namespace paludis
virtual void on_report_check_package_pre(const QualifiedPackageName & p) = 0;
virtual void on_report_package_success(const PackageID & id) = 0;
virtual void on_report_package_failure_pre(const PackageID & id) = 0;
- virtual void on_report_package_is_masked(const PackageID & id, const MaskReasons & mr) = 0;
+ virtual void on_report_package_is_masked(const PackageID & id) = 0;
virtual void on_report_package_is_vulnerable_pre(const PackageID & id) = 0;
virtual void on_report_package_is_vulnerable(const PackageID & id, const std::string & tag) = 0;
virtual void on_report_package_is_vulnerable_post(const PackageID & id) = 0;
- virtual void on_report_package_is_missing(const PackageID & id) = 0;
virtual void on_report_package_is_unused(const PackageID & id) = 0;
virtual void on_report_package_failure_post(const PackageID & id) = 0;
virtual void on_report_check_package_post(const QualifiedPackageName & p) = 0;