- if (upgrade == true) {
- if (pkgAllUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occurred", output);
- return 0;
- }
- } else if (distUpgrade == true) {
- if (pkgDistUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occurred", output);
- return 0;
- }
- } else if (Fix.Resolve() == false) {
- EDSP::WriteError("ERR_UNSOLVABLE", "An error occurred", output);
+ std::string failure;
+ 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 (Fix.Resolve() == false)
+ failure = "ERR_UNSOLVABLE";
+
+ if (failure.empty() == false) {
+ std::ostringstream broken;
+ ShowBroken(broken, CacheFile, false);
+ EDSP::WriteError(failure.c_str(), broken.str(), output);