From 69cea1ef2cfda3c4da79fd756a8edaf2be26998e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 25 Apr 2016 14:36:56 +0200 Subject: give rc-status packages a pin of -1 It would previously return a pin of 0, which is an invalid value, but the intend is that versions which are only in the dpkg/status file can't be selected for installation (= can't be a candidate) which is what a negative pin assures. This helps with the communication to EDSP solvers as they neither know about the rc-state (yet) nor that they shouldn't choose this version. Ideally they shouldn't be told about such versions at all as there is nothing to be solved here, but we will get there eventually. --- apt-pkg/policy.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'apt-pkg/policy.cc') diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index b36f4d4b7..7c57f9dea 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -374,7 +374,7 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b if (!ConsiderFiles) return 0; - int priority = std::numeric_limits::min(); + signed short priority = std::numeric_limits::min(); for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++) { /* If this is the status file, and the current version is not the @@ -382,14 +382,13 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b then it is not a candidate for installation, ever. This weeds out bogus entries that may be due to config-file states, or other. */ - if (file.File().Flagged(pkgCache::Flag::NotSource) && Ver.ParentPkg().CurrentVer() != Ver) { - // Ignore - } else if (GetPriority(file.File()) > priority) { - priority = GetPriority(file.File()); - } + if (file.File().Flagged(pkgCache::Flag::NotSource) && Ver.ParentPkg().CurrentVer() != Ver) + priority = std::max(priority, static_cast(-1)); + else + priority = std::max(priority, GetPriority(file.File())); } - return priority == std::numeric_limits::min() ? 0 : priority; + return priority == std::numeric_limits::min() ? 0 : priority; } APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { -- cgit v1.2.3