From 10b39ae62db1f0d15a208a286cc86aff06c2fb69 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 12 Aug 2015 13:07:56 +0200 Subject: Add a parameter ConsiderFiles to GetPriority(VerIterator) This allows us to exclude files from being considered for the priority, so it will return only specific-version matches. --- apt-pkg/policy.cc | 5 +++-- apt-pkg/policy.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index c12d8699b..bf6ec0ff7 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -368,11 +368,12 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) return Pins[Pkg->ID].Priority; return 0; } -APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, bool considerFiles) { if (VerPins[Ver->ID].Type != pkgVersionMatch::None) return VerPins[Ver->ID].Priority; - + if (!considerFiles) + return 0; int priority = std::numeric_limits::min(); for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++) diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h index b3e1ec6b1..5be6657e9 100644 --- a/apt-pkg/policy.h +++ b/apt-pkg/policy.h @@ -80,7 +80,7 @@ class pkgPolicy : public pkgDepCache::Policy // Things for the cache interface. virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; virtual signed short GetPriority(pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual signed short GetPriority(pkgCache::VerIterator const &Pkg); + virtual signed short GetPriority(pkgCache::VerIterator const &Pkg, bool ConsiderFiles = true); virtual signed short GetPriority(pkgCache::PkgFileIterator const &File) APT_OVERRIDE; bool InitDefaults(); -- cgit v1.2.3