summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/edsp.cc4
-rw-r--r--apt-pkg/solver3.cc5
-rw-r--r--apt-pkg/solver3.h10
-rw-r--r--apt-pkg/upgrade.cc5
4 files changed, 11 insertions, 13 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index dd9ae18fc..bf96dd35c 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -756,11 +756,11 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
unsigned int const flags, OpProgress *Progress) {
if (strstr(solver, "3.") == solver)
{
- APT::Solver s(Cache.GetCache(), Cache.GetPolicy());
+ APT::Solver s(Cache.GetCache(), Cache.GetPolicy(), (EDSP::Request::Flags) flags);
FileFd output;
bool res = true;
if (Progress != NULL)
- Progress->OverallProgress(0, 100, 1, _config->FindB("APT::Solver::Upgrade") ? _("Calculating upgrade") : _("Solving dependencies"));
+ Progress->OverallProgress(0, 100, 1, (flags & EDSP::Request::UPGRADE_ALL) ? _("Calculating upgrade") : _("Solving dependencies"));
if (res && not s.FromDepCache(Cache))
res = false;
if (Progress != NULL)
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index d7a468227..8d80dfb3c 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -195,7 +195,7 @@ class DefaultRootSetFunc2 : public pkgDepCache::DefaultRootSetFunc
}; // FIXME: DEDUP with pkgDepCache.
/*}}}*/
-APT::Solver::Solver(pkgCache &cache, pkgDepCache::Policy &policy)
+APT::Solver::Solver(pkgCache &cache, pkgDepCache::Policy &policy, EDSP::Request::Flags requestFlags)
: cache(cache),
policy(policy),
rootState(new State),
@@ -203,7 +203,8 @@ APT::Solver::Solver(pkgCache &cache, pkgDepCache::Policy &policy)
verStates(cache),
pkgObsolete(cache),
priorities(cache),
- candidates(cache)
+ candidates(cache),
+ requestFlags(requestFlags)
{
// Ensure trivially
static_assert(std::is_trivially_destructible_v<Work>);
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);
diff --git a/apt-pkg/upgrade.cc b/apt-pkg/upgrade.cc
index ac0b71cdf..fad47838c 100644
--- a/apt-pkg/upgrade.cc
+++ b/apt-pkg/upgrade.cc
@@ -312,11 +312,6 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
// APT::Upgrade::Upgrade - Upgrade using a specific strategy /*{{{*/
bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode, OpProgress * const Progress)
{
- _config->Set("APT::Solver::Upgrade", "true");
- if (mode & FORBID_REMOVE_PACKAGES)
- _config->Set("APT::Solver::Remove", "false");
- if (mode & FORBID_INSTALL_NEW_PACKAGES)
- _config->Set("APT::Solver::Install", "false");
if (mode == ALLOW_EVERYTHING)
return pkgDistUpgrade(Cache, Progress);
else if ((mode & ~FORBID_REMOVE_PACKAGES) == 0)