From 9ec748ff103840c4c65471ca00d3b72984131ce4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 23 Feb 2014 22:24:27 +0100 Subject: check version before adding scores in resolver Prevents that "old" dependencies have an influence in the scoring. With positive dependencies this is usually not a problem, but negative dependencies can linger around for a long time. --- apt-pkg/algorithms.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 4d86e5ff8..8320e7ef0 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -459,7 +459,18 @@ void pkgProblemResolver::MakeScores() // propagate score points along dependencies for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D) - Scores[D.TargetPkg()->ID] += DepMap[D->Type]; + { + if (DepMap[D->Type] == 0) + continue; + pkgCache::PkgIterator const T = D.TargetPkg(); + if (D->Version != 0) + { + pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache); + if (IV.end() == true || D.IsSatisfied(IV) != D.IsNegative()) + continue; + } + Scores[T->ID] += DepMap[D->Type]; + } } // Copy the scores to advoid additive looping -- cgit v1.2.3