squash merge of the feature/apt-binary branch without the changes from experimental
[ntk/apt.git] / apt-private / private-upgrade.cc
CommitLineData
b9179170
MV
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 */
14bool DoUpgradeNoNewPackages(CommandLine &CmdL)
15{
16 CacheFile Cache;
17 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
18 return false;
19
20 // Do the upgrade
21 if (pkgAllUpgrade(Cache) == false)
22 {
23 ShowBroken(c1out,Cache,false);
24 return _error->Error(_("Internal error, AllUpgrade broke stuff"));
25 }
26
27 return InstallPackages(Cache,true);
28}
29 /*}}}*/
30
31// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
32bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
33{
34 CacheFile Cache;
35 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
36 return false;
37
38 // Do the upgrade
39 if (pkgAllUpgradeNoDelete(Cache) == false)
40 {
41 ShowBroken(c1out,Cache,false);
42 return _error->Error(_("Internal error, AllUpgrade broke stuff"));
43 }
44
45 return InstallPackages(Cache,true);
46}
47 /*}}}*/