aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-06 16:42:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-06 16:42:04 +0000
commitb35180cf066887cf11e3b45e740b8af37bbdcb13 (patch)
treeb78942bd0c0f26bbd0da74ca9b643fd149348a39
parent0684b88b371a7e9059ce207ba9f9fd702378ba7d (diff)
downloadpaludis-b35180cf066887cf11e3b45e740b8af37bbdcb13.tar.gz
paludis-b35180cf066887cf11e3b45e740b8af37bbdcb13.tar.xz
Accurate unmet constraints for existing IDs
-rw-r--r--paludis/resolver/decider.cc39
-rw-r--r--paludis/resolver/decider.hh7
2 files changed, 33 insertions, 13 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index d081455..fd31250 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -1246,12 +1246,12 @@ Decider::_cannot_decide_for(
const std::tr1::shared_ptr<const PackageID> existing_id(_find_existing_id_for(resolvent, resolution));
if (existing_id)
- unsuitable_candidates->push_back(_make_unsuitable_candidate(resolvent, resolution, existing_id));
+ unsuitable_candidates->push_back(_make_unsuitable_candidate(resolvent, resolution, existing_id, true));
const std::tr1::shared_ptr<const PackageIDSequence> installable_ids(_find_installable_id_candidates_for(resolvent, resolution, true));
for (PackageIDSequence::ConstIterator i(installable_ids->begin()), i_end(installable_ids->end()) ;
i != i_end ; ++i)
- unsuitable_candidates->push_back(_make_unsuitable_candidate(resolvent, resolution, *i));
+ unsuitable_candidates->push_back(_make_unsuitable_candidate(resolvent, resolution, *i, false));
return make_shared_ptr(new UnableToMakeDecision(
unsuitable_candidates,
@@ -1263,11 +1263,12 @@ UnsuitableCandidate
Decider::_make_unsuitable_candidate(
const Resolvent & resolvent,
const std::tr1::shared_ptr<const Resolution> &,
- const std::tr1::shared_ptr<const PackageID> & id) const
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const bool existing) const
{
return make_named_values<UnsuitableCandidate>(
value_for<n::package_id>(id),
- value_for<n::unmet_constraints>(_get_unmatching_constraints(resolvent, id))
+ value_for<n::unmet_constraints>(_get_unmatching_constraints(resolvent, id, existing))
);
}
@@ -1358,7 +1359,8 @@ Decider::_find_id_for_from(
const std::tr1::shared_ptr<const Constraints>
Decider::_get_unmatching_constraints(
const Resolvent & resolvent,
- const std::tr1::shared_ptr<const PackageID> & id) const
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const bool existing) const
{
const std::tr1::shared_ptr<const Resolution> resolution(resolution_for_resolvent(resolvent));
const std::tr1::shared_ptr<Constraints> result(new Constraints);
@@ -1367,12 +1369,27 @@ Decider::_get_unmatching_constraints(
c_end(resolution->constraints()->end()) ;
c != c_end ; ++c)
{
- if (! _check_constraint(resolvent, *c, make_shared_ptr(new ChangesToMakeDecision(
- id,
- false,
- ! (*c)->untaken(),
- make_null_shared_ptr()
- ))))
+ std::tr1::shared_ptr<Decision> decision;
+
+ if (existing)
+ {
+ bool is_transient(id->transient_key() && id->transient_key()->value());
+ decision.reset(new ExistingNoChangeDecision(
+ id,
+ true,
+ true,
+ is_transient,
+ ! (*c)->untaken()
+ ));
+ }
+ else
+ decision.reset(new ChangesToMakeDecision(
+ id,
+ false,
+ ! (*c)->untaken(),
+ make_null_shared_ptr()
+ ));
+ if (! _check_constraint(resolvent, *c, decision))
result->add(*c);
}
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index 98c2b4d..1466b84 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -165,12 +165,15 @@ namespace paludis
const std::tr1::shared_ptr<const PackageIDSequence> &) const;
const std::tr1::shared_ptr<const Constraints> _get_unmatching_constraints(
- const Resolvent &, const std::tr1::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const Resolvent &,
+ const std::tr1::shared_ptr<const PackageID> &,
+ const bool existing) const PALUDIS_ATTRIBUTE((warn_unused_result));
UnsuitableCandidate _make_unsuitable_candidate(
const Resolvent &,
const std::tr1::shared_ptr<const Resolution> &,
- const std::tr1::shared_ptr<const PackageID> &) const;
+ const std::tr1::shared_ptr<const PackageID> &,
+ const bool existing) const;
bool _already_met(const SanitisedDependency &) const PALUDIS_ATTRIBUTE((warn_unused_result));