From 4a98dcf274123190a0ebff2bd223cbc9d11e35f9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 15:54:46 +0100 Subject: solver3: Install Essential on dist-upgrade This is a bit gnarly, but dist-upgrade is mapped to is an upgrade + removals allowed + installs allowed :D --- apt-pkg/solver3.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 44a5075da..f6ee1d243 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -950,6 +950,20 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) Discover(Var(P)); } } + else if (IsUpgrade && AllowRemove && AllowInstall && (P->Flags & pkgCache::Flag::Essential)) + { + Clause w{Var(), Group::InstallManual, false}; + auto G = P.Group(); + for (auto P = G.PackageList(); not P.end(); P = G.NextPkg(P)) + if (P->Flags & pkgCache::Flag::Essential) + w.solutions.push_back(Var(P)); + std::stable_sort(w.solutions.begin(), w.solutions.end(), CompareProviders3{cache, policy, P, *this}); + if (unlikely(debug >= 1)) + std::cerr << "Install essential package " << P << std::endl; + RegisterClause(std::move(w)); + if (not AddWork(Work{rootState->clauses.back().get(), depth()})) + return false; + } } return Propagate(); -- cgit v1.2.3-70-g09d2