summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-02-23 22:24:27 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:57:34 +0100
commit9ec748ff103840c4c65471ca00d3b72984131ce4 (patch)
tree23a3907d22fdc007b52a37b7c364fa8e93847960 /apt-pkg/algorithms.cc
parent2252183c69fb5e3e020b45c37d9728b3437d797d (diff)
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.
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc13
1 files changed, 12 insertions, 1 deletions
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