aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/decider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/resolver/decider.cc')
-rw-r--r--paludis/resolver/decider.cc48
1 files changed, 35 insertions, 13 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 6c37c1ac2..483869038 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -593,6 +593,26 @@ Decider::_make_constraints_from_target(
throw InternalError(PALUDIS_HERE, "resolver bug: huh? it's not a block and it's not a package");
}
+const std::shared_ptr<Constraint>
+Decider::_make_constraint_from_package_dependency(
+ const std::shared_ptr<const Resolution> & resolution,
+ const SanitisedDependency & dep,
+ const std::shared_ptr<const Reason> & reason,
+ const SpecInterest interest) const
+{
+ auto existing(_imp->fns.get_use_existing_nothing_fn()(resolution, *dep.spec().if_package(), reason));
+ return std::make_shared<Constraint>(make_named_values<Constraint>(
+ n::destination_type() = resolution->resolvent().destination_type(),
+ n::force_unable() = false,
+ n::from_id() = dep.from_id(),
+ n::nothing_is_fine_too() = existing.second,
+ n::reason() = reason,
+ n::spec() = *dep.spec().if_package(),
+ n::untaken() = si_untaken == interest,
+ n::use_existing() = existing.first
+ ));
+}
+
const std::shared_ptr<ConstraintSequence>
Decider::_make_constraints_from_dependency(
const std::shared_ptr<const Resolution> & resolution,
@@ -602,19 +622,8 @@ Decider::_make_constraints_from_dependency(
{
if (dep.spec().if_package())
{
- auto existing(_imp->fns.get_use_existing_nothing_fn()(resolution, *dep.spec().if_package(), reason));
-
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
- result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
- n::destination_type() = resolution->resolvent().destination_type(),
- n::force_unable() = false,
- n::from_id() = dep.from_id(),
- n::nothing_is_fine_too() = existing.second,
- n::reason() = reason,
- n::spec() = *dep.spec().if_package(),
- n::untaken() = si_untaken == interest,
- n::use_existing() = existing.first
- )));
+ result->push_back(_make_constraint_from_package_dependency(resolution, dep, reason, interest));
return result;
}
else if (dep.spec().if_block())
@@ -1350,8 +1359,21 @@ Decider::find_any_score(
for (Resolvents::ConstIterator r(resolvents->begin()), r_end(resolvents->end()) ;
r != r_end ; ++r)
{
+ bool any(false), any_bad(false);
ResolutionsByResolvent::ConstIterator i(_imp->resolutions_by_resolvent->find(*r));
- if (i != _imp->resolutions_by_resolvent->end())
+ if (i != _imp->resolutions_by_resolvent->end() && (*i)->decision())
+ {
+ auto constraint(_make_constraint_from_package_dependency(our_resolution, dep, reason, si_take));
+ if (_check_constraint(constraint, (*i)->decision()))
+ any = true;
+ else
+ {
+ any_bad = false;
+ break;
+ }
+ }
+
+ if (any && ! any_bad)
return std::make_pair(acs_will_be_installing, operator_bias);
}
}