summaryrefslogtreecommitdiff
path: root/apt-private/private-upgrade.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-08-17 09:18:36 +0200
committerMichael Vogt <mvo@debian.org>2013-08-17 09:18:36 +0200
commitf49d103adc47c5c34f4ca852605ee55710e486b9 (patch)
treeeb63a4d80a82b2d9f9aa5bc25165a21cb38b215f /apt-private/private-upgrade.cc
parentb55e706a8794d810fb7c5a7c175c04ea207b1ce7 (diff)
parentdd4d9729975fc2de37cd69220bc05efb16badc77 (diff)
Merge remote-tracking branch 'mvo/feature/apt-binary2' into debian/sid
Conflicts: cmdline/apt-get.cc
Diffstat (limited to 'apt-private/private-upgrade.cc')
-rw-r--r--apt-private/private-upgrade.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc
new file mode 100644
index 000000000..eb546e3e3
--- /dev/null
+++ b/apt-private/private-upgrade.cc
@@ -0,0 +1,53 @@
+
+#include <apt-pkg/algorithms.h>
+
+#include "private-install.h"
+#include "private-cachefile.h"
+#include "private-upgrade.h"
+#include "private-output.h"
+
+
+// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
+// ---------------------------------------------------------------------
+/* Upgrade all packages without installing new packages or erasing old
+ packages */
+bool DoUpgradeNoNewPackages(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() != 1)
+ return _error->Error(_("The upgrade command takes no arguments"));
+
+ CacheFile Cache;
+ if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
+ return false;
+
+ // Do the upgrade
+ if (pkgAllUpgrade(Cache) == false)
+ {
+ ShowBroken(c1out,Cache,false);
+ return _error->Error(_("Internal error, AllUpgrade broke stuff"));
+ }
+
+ return InstallPackages(Cache,true);
+}
+ /*}}}*/
+
+// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
+bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() != 1)
+ return _error->Error(_("The upgrade command takes no arguments"));
+
+ CacheFile Cache;
+ if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
+ return false;
+
+ // Do the upgrade
+ if (pkgAllUpgradeNoDelete(Cache) == false)
+ {
+ ShowBroken(c1out,Cache,false);
+ return _error->Error(_("Internal error, AllUpgrade broke stuff"));
+ }
+
+ return InstallPackages(Cache,true);
+}
+ /*}}}*/