summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/solver3.cc6
-rw-r--r--apt-pkg/solver3.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 4d988b523..620156ac3 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -861,6 +861,12 @@ APT::Solver::Clause APT::Solver::TranslateOrGroup(pkgCache::DepIterator start, p
{
if (unlikely(debug >= 3))
std::cerr << "Try to keep satisfied: " << clause.toString(cache, true) << std::endl;
+ clause.group = Group::SatisfySuggests;
+ // Erase the non-installed solutions. We will process this last and try to keep the previously installed
+ // "best" solution installed.
+ clause.solutions.erase(std::remove_if(clause.solutions.begin(), clause.solutions.end(), [this](auto var)
+ { return var.CastPkg(cache)->CurrentVer == nullptr; }),
+ clause.solutions.end());
}
else if (not important)
{
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h
index c2d6e035e..6810df426 100644
--- a/apt-pkg/solver3.h
+++ b/apt-pkg/solver3.h
@@ -122,7 +122,10 @@ class Solver
// allowing a simple implementation of an autoremoval code.
UpgradeAuto,
KeepAuto,
- ObsoleteAuto
+ ObsoleteAuto,
+
+ // Satisfy optional dependencies that were previously satisfied but won't otherwise be installed
+ SatisfySuggests,
};
// \brief Type to record depth at. This may very well be a 16-bit