]> git.saurik.com Git - apt.git/blob - apt-private/private-upgrade.cc
remove duplicated 'the' from guides doc-base abstract
[apt.git] / apt-private / private-upgrade.cc
1 // Includes /*{{{*/
2 #include <config.h>
3
4 #include <apt-pkg/upgrade.h>
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
13 #include <iostream>
14
15 #include <apti18n.h>
16 /*}}}*/
17
18 // this is actually performing the various upgrade operations
19 static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
20 {
21 CacheFile Cache;
22 std::vector<char const *> VolatileCmdL;
23 Cache.GetSourceList()->AddVolatileFiles(CmdL, &VolatileCmdL);
24
25 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
26 return false;
27
28 if(!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeFlags))
29 return false;
30
31 return InstallPackages(Cache,true);
32 }
33
34 // DoDistUpgrade - Automatic smart upgrader /*{{{*/
35 // ---------------------------------------------------------------------
36 /* Intelligent upgrader that will install and remove packages at will */
37 bool DoDistUpgrade(CommandLine &CmdL)
38 {
39 return UpgradeHelper(CmdL, APT::Upgrade::ALLOW_EVERYTHING);
40 }
41 /*}}}*/
42 bool DoUpgrade(CommandLine &CmdL) /*{{{*/
43 {
44 if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
45 return DoUpgradeWithAllowNewPackages(CmdL);
46 else
47 return DoUpgradeNoNewPackages(CmdL);
48 }
49 /*}}}*/
50 // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
51 // ---------------------------------------------------------------------
52 /* Upgrade all packages without installing new packages or erasing old
53 packages */
54 bool DoUpgradeNoNewPackages(CommandLine &CmdL)
55 {
56 // Do the upgrade
57 return UpgradeHelper(CmdL,
58 APT::Upgrade::FORBID_REMOVE_PACKAGES|
59 APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES);
60 }
61 /*}}}*/
62 // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
63 bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
64 {
65 return UpgradeHelper(CmdL, APT::Upgrade::FORBID_REMOVE_PACKAGES);
66 }
67 /*}}}*/