]> git.saurik.com Git - apt.git/blame - apt-private/private-upgrade.cc
improve the API for Upgrade()
[apt.git] / apt-private / private-upgrade.cc
CommitLineData
ee0167c4 1// Includes /*{{{*/
b9179170
MV
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"
ee0167c4 8 /*}}}*/
b9179170 9
ee0167c4 10// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
b9179170
MV
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 }
d8a8f9d7
MV
26
27 // parse additional cmdline pkg manipulation switches
28 if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
29 return false;
b9179170
MV
30
31 return InstallPackages(Cache,true);
32}
33 /*}}}*/
b9179170
MV
34// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
35bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
36{
37 CacheFile Cache;
38 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
39 return false;
40
41 // Do the upgrade
facea693 42 if (APT::Upgrade::Upgrade(Cache, APT::Upgrade::ALLOW_NEW_INSTALLS) == false)
b9179170
MV
43 {
44 ShowBroken(c1out,Cache,false);
45 return _error->Error(_("Internal error, AllUpgrade broke stuff"));
46 }
d8a8f9d7
MV
47
48 // parse additional cmdline pkg manipulation switches
49 if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
50 return false;
b9179170
MV
51
52 return InstallPackages(Cache,true);
53}
54 /*}}}*/