diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2025-02-11 18:05:38 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2025-02-14 19:08:45 +0100 |
| commit | 7d6e0e3d72c491fff0f0326c45a8b89404563314 (patch) | |
| tree | 263bf04624be85d2b211e5ad14c5681bb510e966 /apt-pkg/solver3.cc | |
| parent | e86f3d875a48987a026f79aa4e19eeda4ad01b3b (diff) | |
solver3: Correctly call MarkKeep() for kept back packages
This fixes the difference in test-unpack-different-version-unpacked,
but more importantly this is needed for phasing to be displayed
correctly once that is implemented.
Diffstat (limited to 'apt-pkg/solver3.cc')
| -rw-r--r-- | apt-pkg/solver3.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index f6ee1d243..0ece03b63 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -978,21 +978,25 @@ bool APT::Solver::ToDepCache(pkgDepCache &depcache) const depcache[P].Garbage = 0; if ((*this)[P].decision == Decision::MUST) { - for (auto V = P.VersionList(); not V.end(); V++) - { + pkgCache::VerIterator cand; + for (auto V = P.VersionList(); cand.end() && not V.end(); V++) if ((*this)[V].decision == Decision::MUST) - { - depcache.SetCandidateVersion(V); - break; - } - } - auto reason = (*this)[depcache.GetCandidateVersion(P)].reason; + cand = V; + + auto reason = (*this)[cand].reason; if (auto RP = reason.Pkg(); RP == P.MapPointer()) reason = (*this)[P].reason; - depcache.MarkInstall(P, false, 0, reason.empty() && not(depcache[P].Flags & pkgCache::Flag::Auto)); - if (not P->CurrentVer) - depcache.MarkAuto(P, not reason.empty()); + if (cand != P.CurrentVer()) + { + depcache.SetCandidateVersion(cand); + depcache.MarkInstall(P, false, 0, reason.empty() && not(depcache[P].Flags & pkgCache::Flag::Auto)); + if (not P->CurrentVer) + depcache.MarkAuto(P, not reason.empty()); + } + else + depcache.MarkKeep(P, false, reason.empty() && not(depcache[P].Flags & pkgCache::Flag::Auto)); + depcache[P].Marked = 1; depcache[P].Garbage = 0; } |
