summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-05-06 14:21:02 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-20 14:18:36 +0200
commit43c71fad3a51d841132ba15a7a5930e1ee4126ed (patch)
tree669fa559ee36e4dd26804a518d4a590eca9f7bb4 /cmdline
parenta6f8c07f83e4e5a8155c04feab543dc0c82ed495 (diff)
edsp: add Forbid-{New-Install,Remove} and Upgrade-All
This allows to differentiate properly between 'apt-get upgrade', 'apt upgrade' and 'apt full-upgrade'.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-internal-solver.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 2df1d3bef..fa54657c0 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -121,8 +121,8 @@ int main(int argc,const char *argv[]) /*{{{*/
DIE("WAIT timed out in the resolver");
std::list<std::string> install, remove;
- bool upgrade, distUpgrade, autoRemove;
- if (EDSP::ReadRequest(input, install, remove, upgrade, distUpgrade, autoRemove) == false)
+ unsigned int flags;
+ if (EDSP::ReadRequest(input, install, remove, flags) == false)
DIE("Parsing the request failed!");
EDSP::WriteProgress(5, "Read scenario…", output);
@@ -159,12 +159,19 @@ int main(int argc,const char *argv[]) /*{{{*/
EDSP::WriteProgress(60, "Call problemresolver on current scenario…", output);
std::string failure;
- if (upgrade == true) {
- if (APT::Upgrade::Upgrade(CacheFile, APT::Upgrade::FORBID_REMOVE_PACKAGES | APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES) == false)
+ if (flags & EDSP::Request::UPGRADE_ALL) {
+ int upgrade_flags = APT::Upgrade::ALLOW_EVERYTHING;
+ if (flags & EDSP::Request::FORBID_NEW_INSTALL)
+ upgrade_flags |= APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES;
+ if (flags & EDSP::Request::FORBID_REMOVE)
+ upgrade_flags |= APT::Upgrade::FORBID_REMOVE_PACKAGES;
+
+ if (APT::Upgrade::Upgrade(CacheFile, upgrade_flags))
+ ;
+ else if (upgrade_flags == APT::Upgrade::ALLOW_EVERYTHING)
+ failure = "ERR_UNSOLVABLE_FULL_UPGRADE";
+ else
failure = "ERR_UNSOLVABLE_UPGRADE";
- } else if (distUpgrade == true) {
- if (APT::Upgrade::Upgrade(CacheFile, APT::Upgrade::ALLOW_EVERYTHING) == false)
- failure = "ERR_UNSOLVABLE_DIST_UPGRADE";
} else if (Fix.Resolve() == false)
failure = "ERR_UNSOLVABLE";