diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2025-02-11 15:54:46 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2025-02-14 19:08:45 +0100 |
| commit | 4a98dcf274123190a0ebff2bd223cbc9d11e35f9 (patch) | |
| tree | 7efbf42b6e3bea67b6b117acfdf1315642bb98e6 /apt-pkg | |
| parent | 4c48b5618ba15d4e33625cec81843891910e81a2 (diff) | |
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
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/solver3.cc | 14 |
1 files changed, 14 insertions, 0 deletions
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(); |
