aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-28 22:19:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:52 +0000
commit92f0a95d1854442e744f707eaae9add7fd92ff67 (patch)
tree9d403328a07f89c1598b4d3cb0079b292d82729e
parent092228a814cd6700b97112b5dcf931c80b6b9431 (diff)
downloadpaludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.gz
paludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.xz
Pass env, id to ConditionalDepSpec members
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec_flattener.cc6
-rw-r--r--paludis/dep_spec.cc15
-rw-r--r--paludis/dep_spec.hh19
-rw-r--r--paludis/dep_spec_data.hh25
-rw-r--r--paludis/dep_spec_flattener.cc22
-rw-r--r--paludis/dep_spec_flattener.hh7
-rw-r--r--paludis/elike_conditional_dep_spec-fwd.hh3
-rw-r--r--paludis/elike_conditional_dep_spec.cc44
-rw-r--r--paludis/legacy/dep_list-fwd.hh7
-rw-r--r--paludis/legacy/dep_list.cc22
-rw-r--r--paludis/legacy/install_task.cc10
-rw-r--r--paludis/legacy/query_visitor.cc4
-rw-r--r--paludis/legacy/range_rewriter.cc5
-rw-r--r--paludis/legacy/show_suggest_visitor.cc2
-rw-r--r--paludis/legacy/uninstall_list.cc4
-rw-r--r--paludis/legacy/uninstall_task.cc2
-rw-r--r--paludis/match_package.cc2
-rw-r--r--paludis/repositories/cran/package_dep_spec.cc5
-rw-r--r--paludis/repositories/e/a_finder.cc2
-rw-r--r--paludis/repositories/e/can_skip_phase.cc2
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc2
-rw-r--r--paludis/repositories/e/dep_parser.cc3
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc2
-rw-r--r--paludis/repositories/e/do_fetch_action.cc2
-rw-r--r--paludis/repositories/e/do_info_action.cc2
-rw-r--r--paludis/repositories/e/do_install_action.cc4
-rw-r--r--paludis/repositories/e/do_pretend_action.cc2
-rw-r--r--paludis/repositories/e/e_key.cc2
-rw-r--r--paludis/repositories/e/e_repository.cc2
-rw-r--r--paludis/repositories/e/ebuild_id.cc2
-rw-r--r--paludis/repositories/e/fetch_visitor.cc2
-rw-r--r--paludis/repositories/e/myoptions_requirements_verifier.cc2
-rw-r--r--paludis/repositories/e/pretend_fetch_visitor.cc2
-rw-r--r--paludis/repositories/e/required_use_verifier.cc2
-rw-r--r--paludis/repositories/e/vdb_repository.cc2
-rw-r--r--paludis/repositories/fake/dep_parser.cc25
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc2
-rw-r--r--paludis/resolver/collect_depped_upon.cc9
-rw-r--r--paludis/resolver/collect_provided.cc2
-rw-r--r--paludis/resolver/sanitised_dependencies.cc27
-rw-r--r--paludis/user_dep_spec.cc33
-rw-r--r--python/dep_spec.cc8
-rw-r--r--python/dep_spec.hh4
-rw-r--r--ruby/dep_spec.cc16
-rw-r--r--src/clients/cave/cmd_match.cc23
-rw-r--r--src/clients/cave/cmd_print_unused_distfiles.cc12
-rw-r--r--src/clients/inquisitio/do_search.cc22
-rw-r--r--src/clients/inquisitio/extractor.hh3
-rw-r--r--src/clients/inquisitio/key_extractor.cc16
-rw-r--r--src/clients/inquisitio/key_extractor.hh4
-rw-r--r--src/clients/inquisitio/name_description_extractor.cc14
-rw-r--r--src/clients/inquisitio/name_description_extractor.hh4
53 files changed, 256 insertions, 211 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
index 5040216..f916eb6 100644
--- a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
@@ -57,7 +57,7 @@ int main(int argc, char * argv[])
if ((*i)->provide_key())
{
/* Create our flattener... */
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> provides(env.get());
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> provides(env.get(), *i);
/* Populate it by making it visit the key's value */
(*i)->provide_key()->value()->top()->accept(provides);
@@ -73,7 +73,7 @@ int main(int argc, char * argv[])
/* Again for homepage */
if ((*i)->homepage_key())
{
- DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec> homepages(env.get());
+ DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec> homepages(env.get(), *i);
(*i)->homepage_key()->value()->top()->accept(homepages);
cout << " " << left << setw(24) << "Homepages:" << " "
@@ -90,7 +90,7 @@ int main(int argc, char * argv[])
if ((*i)->end_metadata() != (*i)->find_metadata("RESTRICT") &&
simple_visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(**(*i)->find_metadata("RESTRICT")))
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env.get());
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env.get(), *i);
simple_visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(
**(*i)->find_metadata("RESTRICT"))->value()->top()->accept(restricts);
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 6085ad1..5d88080 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -157,21 +157,24 @@ ConditionalDepSpec::~ConditionalDepSpec()
}
bool
-ConditionalDepSpec::condition_met() const
+ConditionalDepSpec::condition_met(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
{
- return _imp->data->condition_met();
+ return _imp->data->condition_met(env, id);
}
bool
-ConditionalDepSpec::condition_would_be_met_when(const ChangedChoices & c) const
+ConditionalDepSpec::condition_would_be_met_when(
+ const Environment * const env,
+ const std::shared_ptr<const PackageID> & id,
+ const ChangedChoices & c) const
{
- return _imp->data->condition_would_be_met_when(c);
+ return _imp->data->condition_would_be_met_when(env, id, c);
}
bool
-ConditionalDepSpec::condition_meetable() const
+ConditionalDepSpec::condition_meetable(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
{
- return _imp->data->condition_meetable();
+ return _imp->data->condition_meetable(env, id);
}
const std::shared_ptr<const ConditionalDepSpecData>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index a9aedb8..53fb0b9 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -194,20 +194,33 @@ namespace paludis
* Is our condition met?
*
* This takes into account inverses etc.
+ *
+ * \since 0.58 takes env, package_id
*/
- bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool condition_met(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Would our condition met, if certain choices were changed?
+ *
+ * \since 0.58 takes env, package_id
*/
- bool condition_would_be_met_when(const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool condition_would_be_met_when(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Is our condition meetable?
*
* This takes into account inverses, masks, forces etc.
+ *
+ * \since 0.58 takes env, package_id
*/
- bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool condition_meetable(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch our data.
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 6fe3084..cae1276 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -31,7 +31,8 @@
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/partially_made_package_dep_spec-fwd.hh>
-#include <paludis/metadata_key_holder.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
#include <string>
#include <memory>
@@ -43,8 +44,7 @@ namespace paludis
* \since 0.26
* \ingroup g_dep_spec
*/
- class PALUDIS_VISIBLE ConditionalDepSpecData :
- public MetadataKeyHolder
+ class PALUDIS_VISIBLE ConditionalDepSpecData
{
public:
///\name Basic operations
@@ -61,18 +61,31 @@ namespace paludis
/**
* Fetch the result for condition_met.
+ *
+ * \since 0.58 takes env, package_id
*/
- virtual bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual bool condition_met(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch the result for condition_would_be_met_when.
+ *
+ * \since 0.58 takes env, package_id
*/
- virtual bool condition_would_be_met_when(const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual bool condition_would_be_met_when(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch the result for condition_meetable.
+ *
+ * \since 0.58 takes env, package_id
*/
- virtual bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual bool condition_meetable(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
diff --git a/paludis/dep_spec_flattener.cc b/paludis/dep_spec_flattener.cc
index 6cfb6b4..550fbac 100644
--- a/paludis/dep_spec_flattener.cc
+++ b/paludis/dep_spec_flattener.cc
@@ -39,12 +39,14 @@ namespace paludis
struct Imp<DepSpecFlattener<Heirarchy_, Item_> >
{
const Environment * const env;
+ const std::shared_ptr<const PackageID> package_id;
std::list<std::shared_ptr<const Item_> > specs;
std::set<SetName> recursing_sets;
- Imp(const Environment * const e) :
- env(e)
+ Imp(const Environment * const e, const std::shared_ptr<const PackageID> & i) :
+ env(e),
+ package_id(i)
{
}
};
@@ -76,8 +78,9 @@ namespace paludis
template <typename Heirarchy_, typename Item_>
DepSpecFlattener<Heirarchy_, Item_>::DepSpecFlattener(
- const Environment * const env) :
- Pimp<DepSpecFlattener<Heirarchy_, Item_> >(env),
+ const Environment * const env,
+ const std::shared_ptr<const PackageID> & id) :
+ Pimp<DepSpecFlattener<Heirarchy_, Item_> >(env, id),
_imp(Pimp<DepSpecFlattener<Heirarchy_, Item_> >::_imp)
{
}
@@ -219,7 +222,8 @@ namespace
template <typename Heirarchy_, typename Item_, bool>
struct HandleConditional
{
- inline static void handle(const typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type &, DepSpecFlattener<Heirarchy_, Item_> &)
+ inline static void handle(const typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type &, DepSpecFlattener<Heirarchy_, Item_> &,
+ const Environment * const, const std::shared_ptr<const PackageID> &)
{
}
};
@@ -227,9 +231,10 @@ namespace
template <typename Heirarchy_, typename Item_>
struct HandleConditional<Heirarchy_, Item_, true>
{
- inline static void handle(const typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type & node, DepSpecFlattener<Heirarchy_, Item_> & f)
+ inline static void handle(const typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type & node, DepSpecFlattener<Heirarchy_, Item_> & f,
+ const Environment * const env, const std::shared_ptr<const PackageID> & id)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(f));
}
};
@@ -240,7 +245,8 @@ void
DepSpecFlattener<Heirarchy_, Item_>::visit(const typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type & node)
{
HandleConditional<Heirarchy_, Item_, TypeListContains<
- typename Heirarchy_::VisitableTypeList, typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type>::value>::handle(node, *this);
+ typename Heirarchy_::VisitableTypeList, typename Heirarchy_::template NodeType<ConditionalDepSpec>::Type>::value>::handle(
+ node, *this, _imp->env, _imp->package_id);
}
template <typename Heirarchy_, typename Item_>
diff --git a/paludis/dep_spec_flattener.hh b/paludis/dep_spec_flattener.hh
index a394373..c526ecd 100644
--- a/paludis/dep_spec_flattener.hh
+++ b/paludis/dep_spec_flattener.hh
@@ -29,6 +29,7 @@
#include <paludis/util/no_type.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <memory>
+#include <type_traits>
/** \file
* Declarations for DepSpecFlattener.
@@ -93,7 +94,11 @@ namespace paludis
///\name Basic operations
///\{
- DepSpecFlattener(const Environment * const);
+ DepSpecFlattener(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> & = typename std::enable_if<
+ std::is_same<Heirarchy_, SetSpecTree>::value,
+ std::shared_ptr<const PackageID> >::type());
~DepSpecFlattener();
diff --git a/paludis/elike_conditional_dep_spec-fwd.hh b/paludis/elike_conditional_dep_spec-fwd.hh
index 4b28364..be3f507 100644
--- a/paludis/elike_conditional_dep_spec-fwd.hh
+++ b/paludis/elike_conditional_dep_spec-fwd.hh
@@ -21,8 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_ELIKE_CONDITIONAL_DEP_SPEC_FWD_HH 1
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/environment-fwd.hh>
-#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/choice-fwd.hh>
#include <string>
@@ -32,7 +30,6 @@ namespace paludis
class ELikeConditionalDepSpecParseError;
ConditionalDepSpec parse_elike_conditional_dep_spec(const std::string &,
- const Environment * const, const std::shared_ptr<const PackageID> &,
const bool no_warning_for_unlisted) PALUDIS_VISIBLE;
}
diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc
index 0879c81..29ac101 100644
--- a/paludis/elike_conditional_dep_spec.cc
+++ b/paludis/elike_conditional_dep_spec.cc
@@ -28,12 +28,12 @@
#include <paludis/dep_spec.hh>
#include <paludis/changed_choices.hh>
#include <paludis/name.hh>
-#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/choice.hh>
#include <paludis/dep_spec_data.hh>
+#include <paludis/metadata_key.hh>
#include <ostream>
#include <string>
@@ -91,17 +91,11 @@ namespace
{
bool inverse;
ChoiceNameWithPrefix flag;
-
- const Environment * const env;
- const std::shared_ptr<const PackageID> id;
bool no_warning_for_unlisted;
- EConditionalDepSpecData(const std::string & s, const Environment * const e, const std::shared_ptr<const PackageID> & i,
- const bool n) :
+ EConditionalDepSpecData(const std::string & s, const bool n) :
inverse(false),
flag("x"),
- env(e),
- id(i),
no_warning_for_unlisted(n)
{
if (s.empty())
@@ -115,9 +109,6 @@ namespace
throw ELikeConditionalDepSpecParseError(s, "missing flag name on use conditional");
flag = ChoiceNameWithPrefix(s.substr(inverse ? 1 : 0, s.length() - (inverse ? 2 : 1)));
-
- add_metadata_key(std::make_shared<LiteralMetadataValueKey<std::string> >("Flag", "Flag", mkt_normal, stringify(flag)));
- add_metadata_key(std::make_shared<LiteralMetadataValueKey<std::string> >("Inverse", "Inverse", mkt_normal, stringify(inverse)));
}
virtual std::string as_string() const
@@ -125,45 +116,36 @@ namespace
return (inverse ? "!" : "") + stringify(flag) + "?";
}
- virtual bool condition_met() const
+ virtual bool condition_met(const Environment * const, const std::shared_ptr<const PackageID> & id) const
{
- if (! id)
- throw InternalError(PALUDIS_HERE, "! id");
-
return icky_use_query(flag, *id, no_warning_for_unlisted) ^ inverse;
}
- virtual bool condition_meetable() const
+ virtual bool condition_meetable(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
{
- if (! id)
- throw InternalError(PALUDIS_HERE, "! id");
-
- return condition_met() || ! icky_use_query_locked(flag, *id, no_warning_for_unlisted);
+ return condition_met(env, id) || ! icky_use_query_locked(flag, *id, no_warning_for_unlisted);
}
- virtual bool condition_would_be_met_when(const ChangedChoices & changes) const
+ virtual bool condition_would_be_met_when(const Environment * const env, const std::shared_ptr<const PackageID> & id,
+ const ChangedChoices & changes) const
{
Tribool overridden(changes.overridden_value(flag));
if (overridden.is_indeterminate())
- return condition_met();
- else if (! condition_meetable())
- return condition_met();
+ return condition_met(env, id);
+ else if (! condition_meetable(env, id))
+ return condition_met(env, id);
else
return overridden.is_true() ^ inverse;
}
-
- virtual void need_keys_added() const
- {
- }
};
}
ConditionalDepSpec
-paludis::parse_elike_conditional_dep_spec(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id,
+paludis::parse_elike_conditional_dep_spec(
+ const std::string & s,
const bool no_warning_for_unlisted)
{
- return ConditionalDepSpec(std::make_shared<EConditionalDepSpecData>(s, env, id, no_warning_for_unlisted));
+ return ConditionalDepSpec(std::make_shared<EConditionalDepSpecData>(s, no_warning_for_unlisted));
}
diff --git a/paludis/legacy/dep_list-fwd.hh b/paludis/legacy/dep_list-fwd.hh
index 4ed0746..727a0e6 100644
--- a/paludis/legacy/dep_list-fwd.hh
+++ b/paludis/legacy/dep_list-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -43,7 +43,10 @@ namespace paludis
*
* \ingroup g_dep_list
*/
- bool is_viable_any_child(const DependencySpecTree::BasicNode & i);
+ bool is_viable_any_child(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const DependencySpecTree::BasicNode & i);
}
#endif
diff --git a/paludis/legacy/dep_list.cc b/paludis/legacy/dep_list.cc
index b7c58c1..d7cc9f7 100644
--- a/paludis/legacy/dep_list.cc
+++ b/paludis/legacy/dep_list.cc
@@ -725,13 +725,13 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec
d->_imp->labels.push_front(*d->_imp->labels.begin());
RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &d->_imp->labels));
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(d->_imp->env, d->_imp->current_package_id()))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
accept_visitor(*this));
}
else
{
- if (node.spec()->condition_meetable())
+ if (node.spec()->condition_meetable(d->_imp->env, d->_imp->current_package_id()))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
accept_visitor(*this));
}
@@ -746,7 +746,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type
RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &d->_imp->labels));
/* annoying requirement: || ( foo? ( ... ) ) resolves to empty if !foo. */
- if (indirect_iterator(node.end()) == std::find_if(indirect_iterator(node.begin()), indirect_iterator(node.end()), &is_viable_any_child))
+ if (indirect_iterator(node.end()) == std::find_if(indirect_iterator(node.begin()), indirect_iterator(node.end()),
+ std::bind(&is_viable_any_child, d->_imp->env, d->_imp->current_package_id(), std::placeholders::_1)))
return;
{
@@ -766,7 +767,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
c != c_end ; ++c)
{
- if (! is_viable_any_child(**c))
+ if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
continue;
if (d->already_installed(**c, destinations))
@@ -788,7 +789,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
c != c_end ; ++c)
{
- if (! is_viable_any_child(**c))
+ if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
continue;
if (! is_interesting_any_child(*d->_imp->env, **c))
continue;
@@ -813,7 +814,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
c != c_end ; ++c)
{
- if (! is_viable_any_child(**c))
+ if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
continue;
try
@@ -839,7 +840,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
c != c_end ; ++c)
{
- if (! is_viable_any_child(**c))
+ if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
continue;
d->add_not_top_level(only_if_not_suggested_label, **c, destinations);
@@ -1170,7 +1171,7 @@ DepList::add_package(const std::shared_ptr<const PackageID> & p, const std::shar
/* add provides */
if (p->provide_key())
{
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env);
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, _imp->current_package_id());
p->provide_key()->value()->top()->accept(f);
if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string(
@@ -1740,12 +1741,13 @@ DepList::push_back(const DepListEntry & e)
}
bool
-paludis::is_viable_any_child(const DependencySpecTree::BasicNode & i)
+paludis::is_viable_any_child(const Environment * const env,
+ const std::shared_ptr<const PackageID> & id, const DependencySpecTree::BasicNode & i)
{
const DependencySpecTree::NodeType<ConditionalDepSpec>::Type * const u(simple_visitor_cast<
const DependencySpecTree::NodeType<ConditionalDepSpec>::Type>(i));
if (0 != u)
- return u->spec()->condition_met();
+ return u->spec()->condition_met(env, id);
else
return true;
}
diff --git a/paludis/legacy/install_task.cc b/paludis/legacy/install_task.cc
index 2b3b2f5..9476bc3 100644
--- a/paludis/legacy/install_task.cc
+++ b/paludis/legacy/install_task.cc
@@ -1510,12 +1510,12 @@ namespace
struct CheckSatisfiedVisitor
{
const Environment * const env;
- const PackageID & id;
+ const std::shared_ptr<const PackageID> & id;
std::shared_ptr<const PackageDepSpec> failure;
std::set<SetName> recursing_sets;
CheckSatisfiedVisitor(const Environment * const e,
- const PackageID & i) :
+ const std::shared_ptr<const PackageID> & i) :
env(e),
id(i)
{
@@ -1545,7 +1545,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
accept_visitor(*this));
}
@@ -1596,7 +1596,7 @@ InstallTask::_unsatisfied(const DepListEntry & e) const
{
Context context("When checking whether dependencies for '" + stringify(*e.package_id()) + "' are satisfied:");
- CheckSatisfiedVisitor v(environment(), *e.package_id());
+ CheckSatisfiedVisitor v(environment(), e.package_id());
if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_pre() ||
dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_pre())
@@ -1786,7 +1786,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
accept_visitor(*this));
}
diff --git a/paludis/legacy/query_visitor.cc b/paludis/legacy/query_visitor.cc
index 655a86c..0ddec62 100644
--- a/paludis/legacy/query_visitor.cc
+++ b/paludis/legacy/query_visitor.cc
@@ -140,7 +140,7 @@ QueryVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type
{
/* for use? ( ) dep specs, return true if we're not enabled, so that
* weird || ( ) cases work. */
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(_imp->environment, _imp->id))
{
_imp->result = true;
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
@@ -174,7 +174,7 @@ QueryVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
c != c_end ; ++c)
{
- if (! is_viable_any_child(**c))
+ if (! is_viable_any_child(_imp->environment, _imp->id, **c))
continue;
(*c)->accept(*this);
diff --git a/paludis/legacy/range_rewriter.cc b/paludis/legacy/range_rewriter.cc
index 65b69d9..311917b 100644
--- a/paludis/legacy/range_rewriter.cc
+++ b/paludis/legacy/range_rewriter.cc
@@ -128,11 +128,6 @@ namespace
return std::shared_ptr<const SlotRequirement>();
}
- virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const
- {
- return std::shared_ptr<const MetadataSectionKey>();
- }
-
virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
{
return std::shared_ptr<const AdditionalPackageDepSpecRequirements>();
diff --git a/paludis/legacy/show_suggest_visitor.cc b/paludis/legacy/show_suggest_visitor.cc
index 14ad042..fa53ecc 100644
--- a/paludis/legacy/show_suggest_visitor.cc
+++ b/paludis/legacy/show_suggest_visitor.cc
@@ -85,7 +85,7 @@ ShowSuggestVisitor::~ShowSuggestVisitor()
void
ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(_imp->environment, _imp->id))
{
_imp->labels.push_front(*_imp->labels.begin());
RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
diff --git a/paludis/legacy/uninstall_list.cc b/paludis/legacy/uninstall_list.cc
index 58989df..4ec04cf 100644
--- a/paludis/legacy/uninstall_list.cc
+++ b/paludis/legacy/uninstall_list.cc
@@ -177,7 +177,7 @@ UninstallList::add_errors_for_system()
if ((! needed) && l->package_id()->provide_key())
{
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env);
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, l->package_id());
l->package_id()->provide_key()->value()->top()->accept(f);
for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator v(f.begin()), v_end(f.end()) ;
v != v_end && ! needed ; ++v)
@@ -348,7 +348,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, pkg))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
accept_visitor(*this));
}
diff --git a/paludis/legacy/uninstall_task.cc b/paludis/legacy/uninstall_task.cc
index e02f4b8..98bf9ef 100644
--- a/paludis/legacy/uninstall_task.cc
+++ b/paludis/legacy/uninstall_task.cc
@@ -209,7 +209,7 @@ UninstallTask::add_target(const std::string & target)
_imp->had_set_targets = true;
std::shared_ptr<const SetSpecTree> spec(_imp->env->set(SetName(target)));
- DepSpecFlattener<SetSpecTree, PackageDepSpec> f(_imp->env);
+ DepSpecFlattener<SetSpecTree, PackageDepSpec> f(_imp->env, make_null_shared_ptr());
spec->top()->accept(f);
std::copy(f.begin(), f.end(), std::back_inserter(_imp->targets));
}
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 9509d93..0bc470b 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -233,7 +233,7 @@ paludis::match_package_in_set(
{
using namespace std::placeholders;
- DepSpecFlattener<SetSpecTree, PackageDepSpec> f(&env);
+ DepSpecFlattener<SetSpecTree, PackageDepSpec> f(&env, id);
target.top()->accept(f);
return indirect_iterator(f.end()) != std::find_if(
indirect_iterator(f.begin()), indirect_iterator(f.end()),
diff --git a/paludis/repositories/cran/package_dep_spec.cc b/paludis/repositories/cran/package_dep_spec.cc
index 6c8e555..2afa19d 100644
--- a/paludis/repositories/cran/package_dep_spec.cc
+++ b/paludis/repositories/cran/package_dep_spec.cc
@@ -114,11 +114,6 @@ namespace
return std::shared_ptr<const AdditionalPackageDepSpecRequirements>();
}
- virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const
- {
- return std::shared_ptr<const MetadataSectionKey>();
- }
-
CRANPackageDepSpecData & version_requirement(const VersionRequirement & v)
{
if (! version_requirements_v)
diff --git a/paludis/repositories/e/a_finder.cc b/paludis/repositories/e/a_finder.cc
index 956d3e1..b4c9a55 100644
--- a/paludis/repositories/e/a_finder.cc
+++ b/paludis/repositories/e/a_finder.cc
@@ -55,7 +55,7 @@ AFinder::visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
void
AFinder::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
{
_labels.push_front(*_labels.begin());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
diff --git a/paludis/repositories/e/can_skip_phase.cc b/paludis/repositories/e/can_skip_phase.cc
index 0aa79ef..9fc3e5f 100644
--- a/paludis/repositories/e/can_skip_phase.cc
+++ b/paludis/repositories/e/can_skip_phase.cc
@@ -54,7 +54,7 @@ namespace
void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, package_id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 94c5a92..a95db2d 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -130,7 +130,7 @@ void
CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
- if ((_imp->check_unneeded) || (node.spec()->condition_met()))
+ if ((_imp->check_unneeded) || (node.spec()->condition_met(_imp->env, _imp->id)))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 14b06d9..c518c13 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -304,8 +304,7 @@ namespace
{
auto repo(env->package_database()->fetch_repository(id->repository_name()));
std::shared_ptr<ConditionalDepSpec> spec(std::make_shared<ConditionalDepSpec>(parse_elike_conditional_dep_spec(
- u, env, id,
- bool(repo->installed_root_key()) || ! eapi.supported()->package_dep_spec_parse_options()[epdso_missing_use_deps_is_qa])));
+ u, bool(repo->installed_root_key()) || ! eapi.supported()->package_dep_spec_parse_options()[epdso_missing_use_deps_is_qa])));
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
n::item() = stack.begin()->item()->append(spec),
n::spec() = spec
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index 351be32..6d64f0c 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -319,7 +319,7 @@ DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<ConditionalDepSpec>:
if (! _imp->check_conditions)
_imp->s << _imp->formatter.format(*node.spec(), format::Plain()) << " (";
- else if (node.spec()->condition_met())
+ else if (node.spec()->condition_met(_imp->env, _imp->id))
_imp->s << _imp->formatter.format(*node.spec(), format::Enabled()) << " (";
else
_imp->s << _imp->formatter.format(*node.spec(), format::Disabled()) << " (";
diff --git a/paludis/repositories/e/do_fetch_action.cc b/paludis/repositories/e/do_fetch_action.cc
index 984b668..46ac118 100644
--- a/paludis/repositories/e/do_fetch_action.cc
+++ b/paludis/repositories/e/do_fetch_action.cc
@@ -57,7 +57,7 @@ paludis::erepository::do_fetch_action(
bool fetch_restrict(false), userpriv_restrict(false);
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env);
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id);
if (id->restrict_key())
id->restrict_key()->value()->top()->accept(restricts);
diff --git a/paludis/repositories/e/do_info_action.cc b/paludis/repositories/e/do_info_action.cc
index a2bacb0..54d4f70 100644
--- a/paludis/repositories/e/do_info_action.cc
+++ b/paludis/repositories/e/do_info_action.cc
@@ -51,7 +51,7 @@ paludis::erepository::do_info_action(
bool userpriv_restrict;
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env);
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id);
if (id->restrict_key())
id->restrict_key()->value()->top()->accept(restricts);
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index 9ef7037..03aca30 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -74,7 +74,7 @@ namespace
void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
@@ -127,7 +127,7 @@ paludis::erepository::do_install_action(
bool userpriv_restrict, test_restrict, strip_restrict;
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env);
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id);
if (id->restrict_key())
id->restrict_key()->value()->top()->accept(restricts);
diff --git a/paludis/repositories/e/do_pretend_action.cc b/paludis/repositories/e/do_pretend_action.cc
index 2bc4d04..d55fc8f 100644
--- a/paludis/repositories/e/do_pretend_action.cc
+++ b/paludis/repositories/e/do_pretend_action.cc
@@ -60,7 +60,7 @@ paludis::erepository::do_pretend_action(
bool userpriv_restrict;
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env);
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id);
if (id->restrict_key())
id->restrict_key()->value()->top()->accept(restricts);
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 8912e52..61bef82 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -367,7 +367,7 @@ EFetchableURIKey::initial_label() const
if (! _imp->initial_label)
{
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> f(_imp->env);
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> f(_imp->env, _imp->id);
if (_imp->id->restrict_key())
_imp->id->restrict_key()->value()->top()->accept(f);
for (DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>::ConstIterator i(f.begin()), i_end(f.end()) ;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 32e1c3e..d880933 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1799,7 +1799,7 @@ ERepository::get_environment_variable(
{
using namespace std::placeholders;
- DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
+ DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment(), id_uncasted);
if (id->restrict_key())
id->restrict_key()->value()->top()->accept(restricts);
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 50c077f..54a9756 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -488,7 +488,7 @@ namespace
void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index e63a510..bdf7dc9 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -117,7 +117,7 @@ FetchVisitor::~FetchVisitor()
void
FetchVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if ((_imp->fetch_unneeded) || (node.spec()->condition_met()))
+ if ((_imp->fetch_unneeded) || (node.spec()->condition_met(_imp->env, _imp->id)))
{
_imp->labels.push_front(* _imp->labels.begin());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
diff --git a/paludis/repositories/e/myoptions_requirements_verifier.cc b/paludis/repositories/e/myoptions_requirements_verifier.cc
index 6ba7099..be53f26 100644
--- a/paludis/repositories/e/myoptions_requirements_verifier.cc
+++ b/paludis/repositories/e/myoptions_requirements_verifier.cc
@@ -254,7 +254,7 @@ MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<PlainText
void
MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(_imp->env, _imp->id))
{
_imp->current_prefix_stack.push_front(*_imp->current_prefix_stack.begin());
_imp->current_children_stack.push_front(ChildrenList());
diff --git a/paludis/repositories/e/pretend_fetch_visitor.cc b/paludis/repositories/e/pretend_fetch_visitor.cc
index 955340a..90855f1 100644
--- a/paludis/repositories/e/pretend_fetch_visitor.cc
+++ b/paludis/repositories/e/pretend_fetch_visitor.cc
@@ -99,7 +99,7 @@ PretendFetchVisitor::~PretendFetchVisitor()
void
PretendFetchVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if ((_imp->fetch_unneeded) || (node.spec()->condition_met()))
+ if ((_imp->fetch_unneeded) || (node.spec()->condition_met(_imp->env, _imp->id)))
{
_imp->labels.push_front(* _imp->labels.begin());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
diff --git a/paludis/repositories/e/required_use_verifier.cc b/paludis/repositories/e/required_use_verifier.cc
index f396330..3dc58ed 100644
--- a/paludis/repositories/e/required_use_verifier.cc
+++ b/paludis/repositories/e/required_use_verifier.cc
@@ -178,7 +178,7 @@ RequiredUseVerifier::visit(const RequiredUseSpecTree::NodeType<ExactlyOneDepSpec
void
RequiredUseVerifier::visit(const RequiredUseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (! node.spec()->condition_met())
+ if (! node.spec()->condition_met(_imp->env, _imp->id))
return;
_imp->stack.push_front(Met{0, false});
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index e9e7511..c6c7b28 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -714,7 +714,7 @@ VDBRepository::provides_from_package_id(const std::shared_ptr<const PackageID> &
return;
std::shared_ptr<const ProvideSpecTree> provide(id->provide_key()->value());
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->params.environment());
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->params.environment(), id);
provide->top()->accept(f);
std::shared_ptr<std::list<QualifiedPackageName> > qpns(std::make_shared<std::list<QualifiedPackageName>>());
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index 806115e..0033088 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -139,11 +139,10 @@ namespace
}
template <typename T_>
- void use_handler(typename ParseStackTypes<T_>::Stack & stack, const std::string & u,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ void use_handler(typename ParseStackTypes<T_>::Stack & stack, const std::string & u)
{
stack.push_front((*stack.begin())->append(
- std::make_shared<ConditionalDepSpec>(parse_elike_conditional_dep_spec(u, env, id, false))));
+ std::make_shared<ConditionalDepSpec>(parse_elike_conditional_dep_spec(u, false))));
}
template <typename T_>
@@ -172,7 +171,7 @@ namespace
std::shared_ptr<DependencySpecTree>
paludis::fakerepository::parse_depend(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ const Environment * const, const std::shared_ptr<const PackageID> & id)
{
using namespace std::placeholders;
@@ -192,7 +191,7 @@ paludis::fakerepository::parse_depend(const std::string & s,
n::on_pop() = std::bind(&pop_handler<DependencySpecTree>, std::ref(stack), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<DependencySpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::ref(stack), _1, id),
- n::on_use() = std::bind(&use_handler<DependencySpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<DependencySpecTree>, std::ref(stack), _1),
n::on_use_under_any() = &do_nothing
));
@@ -203,7 +202,7 @@ paludis::fakerepository::parse_depend(const std::string & s,
std::shared_ptr<ProvideSpecTree>
paludis::fakerepository::parse_provide(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ const Environment * const, const std::shared_ptr<const PackageID> & id)
{
using namespace std::placeholders;
@@ -223,7 +222,7 @@ paludis::fakerepository::parse_provide(const std::string & s,
n::on_pop() = std::bind(&pop_handler<ProvideSpecTree>, std::ref(stack), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<ProvideSpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::ref(stack), _1, id),
- n::on_use() = std::bind(&use_handler<ProvideSpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<ProvideSpecTree>, std::ref(stack), _1),
n::on_use_under_any() = &do_nothing
));
@@ -234,7 +233,7 @@ paludis::fakerepository::parse_provide(const std::string & s,
std::shared_ptr<FetchableURISpecTree>
paludis::fakerepository::parse_fetchable_uri(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ const Environment * const, const std::shared_ptr<const PackageID> &)
{
using namespace std::placeholders;
@@ -254,7 +253,7 @@ paludis::fakerepository::parse_fetchable_uri(const std::string & s,
n::on_pop() = std::bind(&pop_handler<FetchableURISpecTree>, std::ref(stack), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<FetchableURISpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&arrow_handler<FetchableURISpecTree>, std::ref(stack), _1, ""),
- n::on_use() = std::bind(&use_handler<FetchableURISpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<FetchableURISpecTree>, std::ref(stack), _1),
n::on_use_under_any() = &do_nothing
));
@@ -265,7 +264,7 @@ paludis::fakerepository::parse_fetchable_uri(const std::string & s,
std::shared_ptr<SimpleURISpecTree>
paludis::fakerepository::parse_simple_uri(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ const Environment * const, const std::shared_ptr<const PackageID> &)
{
using namespace std::placeholders;
@@ -285,7 +284,7 @@ paludis::fakerepository::parse_simple_uri(const std::string & s,
n::on_pop() = std::bind(&pop_handler<SimpleURISpecTree>, std::ref(stack), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<SimpleURISpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&simple_uri_handler<SimpleURISpecTree>, std::ref(stack), _1),
- n::on_use() = std::bind(&use_handler<SimpleURISpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<SimpleURISpecTree>, std::ref(stack), _1),
n::on_use_under_any() = &do_nothing
));
@@ -296,7 +295,7 @@ paludis::fakerepository::parse_simple_uri(const std::string & s,
std::shared_ptr<LicenseSpecTree>
paludis::fakerepository::parse_license(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id)
+ const Environment * const, const std::shared_ptr<const PackageID> &)
{
using namespace std::placeholders;
@@ -316,7 +315,7 @@ paludis::fakerepository::parse_license(const std::string & s,
n::on_pop() = std::bind(&pop_handler<LicenseSpecTree>, std::ref(stack), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<LicenseSpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&license_handler<LicenseSpecTree>, std::ref(stack), _1),
- n::on_use() = std::bind(&use_handler<LicenseSpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<LicenseSpecTree>, std::ref(stack), _1),
n::on_use_under_any() = &do_nothing
));
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index aea4dc9..9beb240 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -103,7 +103,7 @@ FakeInstalledRepository::provided_packages() const
if (! (*v)->provide_key())
continue;
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(environment());
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(environment(), *v);
(*v)->provide_key()->value()->top()->accept(f);
for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator q(f.begin()), q_end(f.end()) ; q != q_end ; ++q)
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index d1f6f62..3dea041 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -1115,7 +1115,7 @@ namespace
void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc
index a0c938b..67e1cf5 100644
--- a/paludis/resolver/collect_depped_upon.cc
+++ b/paludis/resolver/collect_depped_upon.cc
@@ -71,6 +71,7 @@ namespace
struct DependentChecker
{
const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
const std::shared_ptr<const C_> going_away;
const std::shared_ptr<const C_> newly_available;
const std::shared_ptr<const PackageIDSequence> not_changing_slots;
@@ -78,10 +79,12 @@ namespace
DependentChecker(
const Environment * const e,
+ const std::shared_ptr<const PackageID> & i,
const std::shared_ptr<const C_> & g,
const std::shared_ptr<const C_> & n,
const std::shared_ptr<const PackageIDSequence> & s) :
env(e),
+ id(i),
going_away(g),
newly_available(n),
not_changing_slots(s),
@@ -141,7 +144,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & s)
{
- if (s.spec()->condition_met())
+ if (s.spec()->condition_met(env, id))
std::for_each(indirect_iterator(s.begin()), indirect_iterator(s.end()),
accept_visitor(*this));
}
@@ -172,7 +175,7 @@ paludis::resolver::dependent_upon(
const std::shared_ptr<const ChangeByResolventSequence> & staying,
const std::shared_ptr<const PackageIDSequence> & not_changing_slots)
{
- DependentChecker<ChangeByResolventSequence> c(env, going_away, staying, not_changing_slots);
+ DependentChecker<ChangeByResolventSequence> c(env, id, going_away, staying, not_changing_slots);
if (id->dependencies_key())
id->dependencies_key()->value()->top()->accept(c);
else
@@ -197,7 +200,7 @@ paludis::resolver::collect_depped_upon(
const std::shared_ptr<const PackageIDSequence> & candidates,
const std::shared_ptr<const PackageIDSequence> & not_changing_slots)
{
- DependentChecker<PackageIDSequence> c(env, candidates, std::make_shared<PackageIDSequence>(), not_changing_slots);
+ DependentChecker<PackageIDSequence> c(env, id, candidates, std::make_shared<PackageIDSequence>(), not_changing_slots);
if (id->dependencies_key())
id->dependencies_key()->value()->top()->accept(c);
else
diff --git a/paludis/resolver/collect_provided.cc b/paludis/resolver/collect_provided.cc
index cf0775b..4fe17d5 100644
--- a/paludis/resolver/collect_provided.cc
+++ b/paludis/resolver/collect_provided.cc
@@ -43,7 +43,7 @@ paludis::resolver::collect_provided(
if (id->provide_key())
{
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(env);
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(env, id);
id->provide_key()->value()->top()->accept(f);
for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator v(f.begin()), v_end(f.end()) ;
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index e12fc94..0a8d520 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -60,6 +60,9 @@ namespace
struct MakeAnyOfStringVisitor
{
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> our_id;
+
std::string result;
const std::shared_ptr<const ChangedChoices> changed_choices;
@@ -85,9 +88,9 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(env, our_id, *changed_choices) : node.spec()->condition_met(env, our_id))
{
- MakeAnyOfStringVisitor v{"", changed_choices};
+ MakeAnyOfStringVisitor v{env, our_id, "", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" " + stringify(*node.spec()) + " (" + v.result + " )");
}
@@ -95,14 +98,14 @@ namespace
void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- MakeAnyOfStringVisitor v{"", changed_choices};
+ MakeAnyOfStringVisitor v{env, our_id, "", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" || (" + v.result + " )");
}
void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
- MakeAnyOfStringVisitor v{"", changed_choices};
+ MakeAnyOfStringVisitor v{env, our_id, "", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" (" + v.result + " )");
}
@@ -110,6 +113,7 @@ namespace
struct AnyDepSpecChildHandler
{
+ const Environment * const env;
const Decider & decider;
const std::shared_ptr<const Resolution> our_resolution;
const std::shared_ptr<const PackageID> our_id;
@@ -123,10 +127,13 @@ namespace
bool seen_any;
- AnyDepSpecChildHandler(const Decider & r, const std::shared_ptr<const Resolution> & q,
+ AnyDepSpecChildHandler(
+ const Environment * const e,
+ const Decider & r, const std::shared_ptr<const Resolution> & q,
const std::shared_ptr<const PackageID> & o,
const std::shared_ptr<const ChangedChoices> & c,
const std::function<SanitisedDependency (const PackageOrBlockDepSpec &)> & f) :
+ env(e),
decider(r),
our_resolution(q),
our_id(o),
@@ -188,7 +195,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(env, our_id, *changed_choices) : node.spec()->condition_met(env, our_id))
{
nested = true;
@@ -219,7 +226,7 @@ namespace
void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- AnyDepSpecChildHandler h(decider, our_resolution, our_id, changed_choices, parent_make_sanitised);
+ AnyDepSpecChildHandler h(env, decider, our_resolution, our_id, changed_choices, parent_make_sanitised);
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(h));
std::list<SanitisedDependency> l;
h.commit(
@@ -390,7 +397,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(env, our_id, *changed_choices) : node.spec()->condition_met(env, our_id))
{
conditions_stack.push_front(*node.spec());
labels_stack.push_front(*labels_stack.begin());
@@ -412,12 +419,12 @@ namespace
Save<std::string> save_original_specs_as_string(&original_specs_as_string);
{
- MakeAnyOfStringVisitor v{"", changed_choices};
+ MakeAnyOfStringVisitor v{env, our_id, "", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
original_specs_as_string = "|| (" + v.result + " )";
}
- AnyDepSpecChildHandler h(decider, our_resolution, our_id, changed_choices,
+ AnyDepSpecChildHandler h(env, decider, our_resolution, our_id, changed_choices,
std::bind(&Finder::make_sanitised, this, std::placeholders::_1));
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(h));
h.commit(
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 9466bf3..c07b5f8 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -410,9 +410,13 @@ namespace
struct SpecTreeSearcher
{
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
const std::string pattern;
- SpecTreeSearcher(const std::string & p) :
+ SpecTreeSearcher(const Environment * const e, const std::shared_ptr<const PackageID> & i, const std::string & p) :
+ env(e),
+ id(i),
pattern(p)
{
}
@@ -437,7 +441,7 @@ namespace
bool visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & n) const
{
- if (n.spec()->condition_met())
+ if (n.spec()->condition_met(env, id))
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
accept_visitor_returning<bool>(*this));
else
@@ -499,10 +503,15 @@ namespace
struct KeyComparator
{
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
const std::string pattern;
const char op;
- KeyComparator(const std::string & p, const char o) :
+ KeyComparator(const Environment * const e, const std::shared_ptr<const PackageID> & i,
+ const std::string & p, const char o) :
+ env(e),
+ id(i),
pattern(p),
op(o)
{
@@ -602,7 +611,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -615,7 +624,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -628,7 +637,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -641,7 +650,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -654,7 +663,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -667,7 +676,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -680,7 +689,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -693,7 +702,7 @@ namespace
case '=':
return false;
case '<':
- return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
}
return false;
@@ -868,7 +877,7 @@ UserKeyRequirement::requirement_met(
return std::make_pair(true, as_human_string());
else
{
- KeyComparator c(_imp->value, _imp->op);
+ KeyComparator c(env, id, _imp->value, _imp->op);
return std::make_pair(key->accept_returning<bool>(c), as_human_string());
}
}
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index a427307..c2c0972 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -170,15 +170,15 @@ PythonConditionalDepSpec::PythonConditionalDepSpec(const ConditionalDepSpec & d)
}
bool
-PythonConditionalDepSpec::condition_met() const
+PythonConditionalDepSpec::condition_met(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
{
- return _data->condition_met();
+ return _data->condition_met(env, id);
}
bool
-PythonConditionalDepSpec::condition_meetable() const
+PythonConditionalDepSpec::condition_meetable(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
{
- return _data->condition_meetable();
+ return _data->condition_meetable(env, id);
}
const std::shared_ptr<const ConditionalDepSpecData>
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 08ab372..4f9daab 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -132,8 +132,8 @@ namespace paludis
public:
PythonConditionalDepSpec(const ConditionalDepSpec &);
- bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result));
- bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool condition_met(const Environment * const, const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool condition_meetable(const Environment * const, const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::shared_ptr<const ConditionalDepSpecData> data() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 5300030..e3ec551 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -555,25 +555,27 @@ namespace
/*
* Document-method: condition_met?
* call-seq:
- * condition_met? -> true or false
+ * condition_met?(Environment, PackageID) -> true or false
*
* Whether our condition is met.
*/
/*
* Document-method: condition_meetable?
* call-seq:
- * condition_meetable? -> true or false
+ * condition_meetable?(Environment, PackageID) -> true or false
*
* Whether our condition is meetable.
*/
- template <bool (ConditionalDepSpec::* f_) () const>
+ template <bool (ConditionalDepSpec::* f_) (const Environment * const, const std::shared_ptr<const PackageID> &) const>
struct ConditionalDepSpecBoolFunc
{
- static VALUE func(VALUE self)
+ static VALUE func(VALUE self, VALUE env, VALUE id)
{
std::shared_ptr<WrappedSpecBase> * p;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, p);
- return ((*std::static_pointer_cast<const WrappedSpec<ConditionalDepSpec> >(*p)->spec().get()).*f_)() ? Qtrue : Qfalse;
+ std::shared_ptr<Environment> e(value_to_environment(env));
+ std::shared_ptr<const PackageID> i(value_to_package_id(id));
+ return ((*std::static_pointer_cast<const WrappedSpec<ConditionalDepSpec> >(*p)->spec().get()).*f_)(e.get(), i) ? Qtrue : Qfalse;
}
};
@@ -1071,9 +1073,9 @@ namespace
rb_define_method(c_conditional_dep_spec, "condition", RUBY_FUNC_CAST(conditional_dep_spec_to_s), 0);
rb_define_alias(c_conditional_dep_spec, "to_s", "condition");
rb_define_method(c_conditional_dep_spec, "condition_met?", RUBY_FUNC_CAST(
- &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_met>::func), 0);
+ &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_met>::func), 2);
rb_define_method(c_conditional_dep_spec, "condition_meetable?", RUBY_FUNC_CAST(
- &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_meetable>::func), 0);
+ &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_meetable>::func), 2);
rb_define_method(c_conditional_dep_spec, "each", RUBY_FUNC_CAST((&Composite<AllDepSpec>::each)), 0);
/*
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 907d362..058c251 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -156,6 +156,8 @@ namespace
struct SpecTreeAsString
{
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
std::list<std::string> & texts;
const SearchCommandLineMatchOptions & match_options;
@@ -166,7 +168,7 @@ namespace
void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if ((! match_options.a_enabled_only.specified()) || node.spec()->condition_met())
+ if ((! match_options.a_enabled_only.specified()) || node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
@@ -233,6 +235,9 @@ namespace
struct MetadataKeyAsString
{
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
+
std::list<std::string> & texts;
const SearchCommandLineMatchOptions & match_options;
@@ -296,43 +301,43 @@ namespace
void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
- SpecTreeAsString m = { texts, match_options };
+ SpecTreeAsString m = { env, id, texts, match_options };
k.value()->top()->accept(m);
}
@@ -431,7 +436,7 @@ MatchCommand::run_hosted(
if (i == id->end_metadata())
continue;
- MetadataKeyAsString m = { texts, match_options };
+ MetadataKeyAsString m = { env.get(), id, texts, match_options };
(*i)->accept(m);
}
diff --git a/src/clients/cave/cmd_print_unused_distfiles.cc b/src/clients/cave/cmd_print_unused_distfiles.cc
index 4d9f607..6a77ea9 100644
--- a/src/clients/cave/cmd_print_unused_distfiles.cc
+++ b/src/clients/cave/cmd_print_unused_distfiles.cc
@@ -92,10 +92,16 @@ namespace
class DistfilesFilter
{
private:
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> id;
std::set<std::string> & files;
public:
- DistfilesFilter(std::set<std::string> & f) :
+ DistfilesFilter(const Environment * const e,
+ const std::shared_ptr<const PackageID> & i,
+ std::set<std::string> & f) :
+ env(e),
+ id(i),
files(f)
{
}
@@ -108,7 +114,7 @@ namespace
void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
// recurse iff the conditions (e.g. useflags) are met
- if (node.spec()->condition_met())
+ if (node.spec()->condition_met(env, id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
@@ -173,7 +179,7 @@ PrintUnusedDistfilesCommand::run(
if ((*iter)->fetches_key())
{
- DistfilesFilter filter(used_distfiles);
+ DistfilesFilter filter(env.get(), *iter, used_distfiles);
(*iter)->fetches_key()->value()->top()->accept(filter);
}
}
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 996e7e5..f140ddb 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -187,17 +187,17 @@ namespace
throw InternalError(PALUDIS_HERE, "Bad --kind '" + k + "'");
}
- bool operator() (const PackageID & id) const
+ bool operator() (const std::shared_ptr<const PackageID> & id) const
{
- auto repo(env->package_database()->fetch_repository(id.repository_name()));
+ auto repo(env->package_database()->fetch_repository(id->repository_name()));
if ((! installed) && repo->installed_root_key())
return false;
- if ((! installable) && id.supports_action(SupportsActionTest<InstallAction>()))
+ if ((! installable) && id->supports_action(SupportsActionTest<InstallAction>()))
return false;
if (visible_only)
- return ! id.masked();
+ return ! id->masked();
else
return true;
}
@@ -218,7 +218,7 @@ namespace
{
}
- bool operator() (const PackageID & id) const
+ bool operator() (const std::shared_ptr<const PackageID> & id) const
{
for (std::list<std::shared_ptr<Extractor> >::const_iterator e(extractors.begin()), e_end(extractors.end()) ;
e != e_end ; ++e)
@@ -235,8 +235,8 @@ namespace
const Environment & env,
const std::shared_ptr<const Repository> & r,
const QualifiedPackageName & q,
- const std::function<bool (const PackageID &)> & e,
- const std::function<bool (const PackageID &)> & m,
+ const std::function<bool (const std::shared_ptr<const PackageID> &)> & e,
+ const std::function<bool (const std::shared_ptr<const PackageID> &)> & m,
const bool all_versions,
const bool invert_match,
const DisplayCallback & display_callback)
@@ -256,9 +256,9 @@ namespace
try
{
display_callback.visit(Searched());
- if (e(**i))
+ if (e(*i))
{
- if (invert_match ^ m(**i))
+ if (invert_match ^ m(*i))
return *i;
else
{
@@ -289,8 +289,8 @@ namespace
const Environment & env,
const std::list<std::shared_ptr<const Repository> > & repos,
std::pair<const QualifiedPackageName, std::shared_ptr<const PackageID> > & q,
- const std::function<bool (const PackageID &)> & e,
- const std::function<bool (const PackageID &)> & m,
+ const std::function<bool (const std::shared_ptr<const PackageID> &)> & e,
+ const std::function<bool (const std::shared_ptr<const PackageID> &)> & m,
const bool all_versions,
const bool invert_match,
const DisplayCallback & display_callback)
diff --git a/src/clients/inquisitio/extractor.hh b/src/clients/inquisitio/extractor.hh
index 7264784..6b139c5 100644
--- a/src/clients/inquisitio/extractor.hh
+++ b/src/clients/inquisitio/extractor.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXTRACTOR_HH 1
#include <string>
+#include <memory>
#include <paludis/package_id-fwd.hh>
namespace inquisitio
@@ -35,7 +36,7 @@ namespace inquisitio
public:
virtual ~Extractor();
- virtual bool operator() (const Matcher &, const paludis::PackageID &) const = 0;
+ virtual bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const = 0;
};
}
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 7ed90b4..ff5c597 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -77,14 +77,14 @@ namespace
const std::string _key;
const bool _visible_only;
const Environment & _env;
- const PackageID & _id;
+ const std::shared_ptr<const PackageID> _id;
const Matcher & _m;
public:
bool result;
TreeVisitor(const std::string & k, const bool v, const Environment & e,
- const PackageID & i, const Matcher & m) :
+ const std::shared_ptr<const PackageID> & i, const Matcher & m) :
_key(k),
_visible_only(v),
_env(e),
@@ -119,7 +119,7 @@ namespace
{
if (! _visible_only)
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- else if (node.spec()->condition_met())
+ else if (node.spec()->condition_met(&_env, _id))
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
}
@@ -201,14 +201,14 @@ namespace
const bool _flatten;
const bool _visible_only;
const Environment & _env;
- const PackageID & _id;
+ const std::shared_ptr<const PackageID> _id;
const Matcher & _m;
public:
bool result;
KeyVisitor(const std::string & k, const bool f, const bool v, const Environment & e,
- const PackageID & i, const Matcher & m) :
+ const std::shared_ptr<const PackageID> & i, const Matcher & m) :
_key(k),
_flatten(f),
_visible_only(v),
@@ -485,10 +485,10 @@ namespace
}
bool
-KeyExtractor::operator() (const Matcher & m, const PackageID & id) const
+KeyExtractor::operator() (const Matcher & m, const std::shared_ptr<const PackageID> & id) const
{
- PackageID::MetadataConstIterator mi(id.find_metadata(_imp->key));
- if (id.end_metadata() == mi)
+ PackageID::MetadataConstIterator mi(id->find_metadata(_imp->key));
+ if (id->end_metadata() == mi)
return false;
KeyVisitor v(_imp->key, _imp->flatten, _imp->visible_only, _imp->env, id, m);
diff --git a/src/clients/inquisitio/key_extractor.hh b/src/clients/inquisitio/key_extractor.hh
index 0c75220..d9aa937 100644
--- a/src/clients/inquisitio/key_extractor.hh
+++ b/src/clients/inquisitio/key_extractor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,7 +35,7 @@ namespace inquisitio
const paludis::Environment &);
~KeyExtractor();
- bool operator() (const Matcher &, const paludis::PackageID &) const;
+ bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const;
};
}
diff --git a/src/clients/inquisitio/name_description_extractor.cc b/src/clients/inquisitio/name_description_extractor.cc
index 88defad..3772ccb 100644
--- a/src/clients/inquisitio/name_description_extractor.cc
+++ b/src/clients/inquisitio/name_description_extractor.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -36,17 +36,17 @@ NameDescriptionExtractor::~NameDescriptionExtractor()
}
bool
-NameDescriptionExtractor::operator() (const Matcher & m, const PackageID & id) const
+NameDescriptionExtractor::operator() (const Matcher & m, const std::shared_ptr<const PackageID> & id) const
{
- if (m(stringify(id.name())))
+ if (m(stringify(id->name())))
return true;
- if (id.short_description_key())
- if (m(id.short_description_key()->value()))
+ if (id->short_description_key())
+ if (m(id->short_description_key()->value()))
return true;
- if (id.long_description_key())
- if (m(id.long_description_key()->value()))
+ if (id->long_description_key())
+ if (m(id->long_description_key()->value()))
return true;
return false;
diff --git a/src/clients/inquisitio/name_description_extractor.hh b/src/clients/inquisitio/name_description_extractor.hh
index ee005be..b6f8c8a 100644
--- a/src/clients/inquisitio/name_description_extractor.hh
+++ b/src/clients/inquisitio/name_description_extractor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -31,7 +31,7 @@ namespace inquisitio
NameDescriptionExtractor();
~NameDescriptionExtractor();
- bool operator() (const Matcher &, const paludis::PackageID &) const;
+ bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const;
};
}