]> git.saurik.com Git - apt.git/blame - apt-private/private-upgrade.cc
make all d-pointer * const pointers
[apt.git] / apt-private / private-upgrade.cc
CommitLineData
ee0167c4 1// Includes /*{{{*/
453b82a3
DK
2#include <config.h>
3
82e369c4 4#include <apt-pkg/upgrade.h>
453b82a3
DK
5#include <apt-pkg/configuration.h>
6#include <apt-pkg/error.h>
7
8#include <apt-private/private-install.h>
9#include <apt-private/private-cachefile.h>
10#include <apt-private/private-upgrade.h>
11#include <apt-private/private-output.h>
12
5ca0cf51 13#include <iostream>
453b82a3
DK
14
15#include <apti18n.h>
ee0167c4 16 /*}}}*/
b9179170 17
5ca0cf51
MV
18// this is actually performing the various upgrade operations
19static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
b9179170
MV
20{
21 CacheFile Cache;
22 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
23 return false;
24
172947cd
DK
25 if(!DoCacheManipulationFromCommandLine(CmdL, Cache, UpgradeFlags))
26 return false;
d8a8f9d7 27
b9179170
MV
28 return InstallPackages(Cache,true);
29}
5ca0cf51
MV
30
31// DoDistUpgrade - Automatic smart upgrader /*{{{*/
32// ---------------------------------------------------------------------
33/* Intelligent upgrader that will install and remove packages at will */
34bool DoDistUpgrade(CommandLine &CmdL)
35{
67caa2e6 36 return UpgradeHelper(CmdL, APT::Upgrade::ALLOW_EVERYTHING);
5ca0cf51
MV
37}
38 /*}}}*/
59e81cec
MV
39bool DoUpgrade(CommandLine &CmdL) /*{{{*/
40{
41 if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
42 return DoUpgradeWithAllowNewPackages(CmdL);
43 else
44 return DoUpgradeNoNewPackages(CmdL);
45}
46 /*}}}*/
5ca0cf51
MV
47// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
48// ---------------------------------------------------------------------
49/* Upgrade all packages without installing new packages or erasing old
50 packages */
51bool DoUpgradeNoNewPackages(CommandLine &CmdL)
52{
53 // Do the upgrade
54 return UpgradeHelper(CmdL,
55 APT::Upgrade::FORBID_REMOVE_PACKAGES|
3f506f68 56 APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES);
5ca0cf51 57}
b9179170 58 /*}}}*/
b9179170
MV
59// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
60bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
61{
5ca0cf51 62 return UpgradeHelper(CmdL, APT::Upgrade::FORBID_REMOVE_PACKAGES);
b9179170
MV
63}
64 /*}}}*/