Merge remote-tracking branch 'mvo/bugfix/coverity' into debian/sid
[ntk/apt.git] / apt-private / private-upgrade.cc
1
2 #include <apt-pkg/algorithms.h>
3
4 #include "private-install.h"
5 #include "private-cachefile.h"
6 #include "private-upgrade.h"
7 #include "private-output.h"
8
9
10 // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
11 // ---------------------------------------------------------------------
12 /* Upgrade all packages without installing new packages or erasing old
13 packages */
14 bool DoUpgradeNoNewPackages(CommandLine &CmdL)
15 {
16 if (CmdL.FileSize() != 1)
17 return _error->Error(_("The upgrade command takes no arguments"));
18
19 CacheFile Cache;
20 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
21 return false;
22
23 // Do the upgrade
24 if (pkgAllUpgrade(Cache) == false)
25 {
26 ShowBroken(c1out,Cache,false);
27 return _error->Error(_("Internal error, AllUpgrade broke stuff"));
28 }
29
30 return InstallPackages(Cache,true);
31 }
32 /*}}}*/
33
34 // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
35 bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
36 {
37 if (CmdL.FileSize() != 1)
38 return _error->Error(_("The upgrade command takes no arguments"));
39
40 CacheFile Cache;
41 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
42 return false;
43
44 // Do the upgrade
45 if (pkgAllUpgradeNoDelete(Cache) == false)
46 {
47 ShowBroken(c1out,Cache,false);
48 return _error->Error(_("Internal error, AllUpgrade broke stuff"));
49 }
50
51 return InstallPackages(Cache,true);
52 }
53 /*}}}*/