summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-11 12:11:20 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:08:45 +0100
commit4c48b5618ba15d4e33625cec81843891910e81a2 (patch)
tree5842b632b56cae8debd582c9a9870feeee4d2f57 /apt-pkg
parent9b8aaaa7abbf36d937dbf7160caa2d9c7c92871f (diff)
solver3: Defer 3.0 'deep' autoremoval to 3.1, fix autoremove
Restore the depcache's MarkRequired logic for 3.0 solver; and change the MarkInstall() call to pass a more correct value for FromUser, to not override an existing automatic status.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc2
-rw-r--r--apt-pkg/edsp.cc2
-rw-r--r--apt-pkg/solver3.cc2
-rw-r--r--apt-pkg/solver3.h3
4 files changed, 5 insertions, 4 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index ef93a54bb..b66f2bc66 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -2496,7 +2496,7 @@ static bool MarkPackage(pkgCache::PkgIterator const &Pkg,
// pkgDepCache::MarkRequired - the main mark algorithm /*{{{*/
bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
{
- if (_config->Find("APT::Solver", "internal") != "internal")
+ if (_config->Find("APT::Solver", "internal") != "internal" && _config->Find("APT::Solver") != "3.0")
return true;
// init the states
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 88f572f18..dd9ae18fc 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -754,7 +754,7 @@ static bool CreateDumpFile(char const * const id, char const * const type, FileF
// EDSP::ResolveExternal - resolve problems by asking external for help {{{*/
bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
unsigned int const flags, OpProgress *Progress) {
- if (strcmp(solver, "3.0") == 0)
+ if (strstr(solver, "3.") == solver)
{
APT::Solver s(Cache.GetCache(), Cache.GetPolicy());
FileFd output;
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 8af3275eb..44a5075da 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -976,7 +976,7 @@ bool APT::Solver::ToDepCache(pkgDepCache &depcache) const
if (auto RP = reason.Pkg(); RP == P.MapPointer())
reason = (*this)[P].reason;
- depcache.MarkInstall(P, false, 0, reason.empty());
+ depcache.MarkInstall(P, false, 0, reason.empty() && not(depcache[P].Flags & pkgCache::Flag::Auto));
if (not P->CurrentVer)
depcache.MarkAuto(P, not reason.empty());
depcache[P].Marked = 1;
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h
index 91b852c98..93e4e5116 100644
--- a/apt-pkg/solver3.h
+++ b/apt-pkg/solver3.h
@@ -217,10 +217,11 @@ class Solver
time_t startTime;
/// Various configuration options
+ std::string version{_config->Find("APT::Solver", "3.0")};
// \brief Debug level
int debug{_config->FindI("Debug::APT::Solver")};
// \brief If set, we try to keep automatically installed packages installed.
- bool KeepAuto{not _config->FindB("APT::Get::AutomaticRemove")};
+ bool KeepAuto{version == "3.0" || not _config->FindB("APT::Get::AutomaticRemove")};
// \brief Determines if we are in upgrade mode.
bool IsUpgrade{_config->FindB("APT::Solver::Upgrade", false)};
// \brief If set, removals are allowed.