summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-04-11 13:33:31 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-04-11 13:45:52 +0200
commit4cd4a2e7033a2af214be1d830b56fab719088b7a (patch)
treec6359851a4367052316bf82f08dd4d5d1abd9b30 /apt-pkg
parentf7feb041e8d8dac5fac3c6cd44c8108e12ea4cd6 (diff)
consider priorities only for downloadable pkgs in resolver
A package which can't be downloaded anymore is very likely dropped from a release and can therefore no longer be 'standard' (or similar). We therefore do not grant points for them anymore and demote them to prio:extra instead which helps other packages breaking them away even if they have a lower priority. The testcase was initially created by Michael Vogt and just amended.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index a7b676660..608ec7fce 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -445,19 +445,22 @@ void pkgProblemResolver::MakeScores()
|| (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
Score += PrioEssentials;
- // We transform the priority
- if (Cache[I].InstVerIter(Cache)->Priority <= 5)
- Score += PrioMap[Cache[I].InstVerIter(Cache)->Priority];
-
+ pkgCache::VerIterator const InstVer = Cache[I].InstVerIter(Cache);
+ // We apply priorities only to downloadable packages, all others are prio:extra
+ // as an obsolete prio:standard package can't be that standard anymore…
+ if (InstVer->Priority <= pkgCache::State::Extra && InstVer.Downloadable() == true)
+ Score += PrioMap[InstVer->Priority];
+ else
+ Score += PrioMap[pkgCache::State::Extra];
+
/* This helps to fix oddball problems with conflicting packages
- on the same level. We enhance the score of installed packages
- if those are not obsolete
- */
+ on the same level. We enhance the score of installed packages
+ if those are not obsolete */
if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable())
Score += PrioInstalledAndNotObsolete;
// propagate score points along dependencies
- for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D)
+ for (pkgCache::DepIterator D = InstVer.DependsList(); D.end() == false; ++D)
{
if (DepMap[D->Type] == 0)
continue;