summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.h
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-11 22:03:03 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:08:45 +0100
commit3ae41a76c19e5ad05600188de43b46c3e2800676 (patch)
tree338626cb24601c36be38990408b9c15679d04083 /apt-pkg/solver3.h
parentfdc8682db546077cb24b2cc8861b2d5e4eee9da5 (diff)
solver3: Pass EDSP flags directly rather than via config
This was a rather silly way to communicate state, and it was in the wrong place. Notably also, multiple calls to the solver had the options sticky, that is, if you run upgrade and then it calls ResolveByKeep(), for example.
Diffstat (limited to 'apt-pkg/solver3.h')
-rw-r--r--apt-pkg/solver3.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h
index 93e4e5116..796f198b1 100644
--- a/apt-pkg/solver3.h
+++ b/apt-pkg/solver3.h
@@ -14,6 +14,7 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
+#include <apt-pkg/edsp.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/policy.h>
@@ -216,6 +217,7 @@ class Solver
// \brief The time we called Solve()
time_t startTime;
+ EDSP::Request::Flags requestFlags;
/// Various configuration options
std::string version{_config->Find("APT::Solver", "3.0")};
// \brief Debug level
@@ -223,13 +225,13 @@ class Solver
// \brief If set, we try to keep automatically installed packages installed.
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)};
+ bool IsUpgrade{_config->FindB("APT::Solver::Upgrade", requestFlags &EDSP::Request::UPGRADE_ALL)};
// \brief If set, removals are allowed.
- bool AllowRemove{_config->FindB("APT::Solver::Remove", true)};
+ bool AllowRemove{_config->FindB("APT::Solver::Remove", not(requestFlags & EDSP::Request::FORBID_REMOVE))};
// \brief If set, removal of manual packages is allowed.
bool AllowRemoveManual{AllowRemove && _config->FindB("APT::Solver::RemoveManual", false)};
// \brief If set, installs are allowed.
- bool AllowInstall{_config->FindB("APT::Solver::Install", true)};
+ bool AllowInstall{_config->FindB("APT::Solver::Install", not(requestFlags & EDSP::Request::FORBID_NEW_INSTALL))};
// \brief If set, we use strict pinning.
bool StrictPinning{_config->FindB("APT::Solver::Strict-Pinning", true)};
// \brief If set, we install missing recommends and pick new best packages.
@@ -273,7 +275,7 @@ class Solver
void RescoreWorkIfNeeded();
// \brief Basic solver initializer. This cannot fail.
- Solver(pkgCache &Cache, pkgDepCache::Policy &Policy);
+ Solver(pkgCache &Cache, pkgDepCache::Policy &Policy, EDSP::Request::Flags requestFlags);
// Assume that the variable is decided as specified.
[[nodiscard]] bool Assume(Var var, bool decision, Var reason);