aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver
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 /paludis/resolver
parent092228a814cd6700b97112b5dcf931c80b6b9431 (diff)
downloadpaludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.gz
paludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.xz
Pass env, id to ConditionalDepSpec members
Diffstat (limited to 'paludis/resolver')
-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
3 files changed, 24 insertions, 14 deletions
diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc
index a0c938b1b..67e1cf517 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 cf0775b61..4fe17d535 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 e12fc94e7..0a8d520ab 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(