]> git.saurik.com Git - apt.git/blob - apt-private/private-upgrade.cc
display errortext for all Err as well as Ign logs
[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 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
23 return false;
24
25 if(!DoCacheManipulationFromCommandLine(CmdL, Cache, UpgradeFlags))
26 return false;
27
28 return InstallPackages(Cache,true);
29 }
30
31 // DoDistUpgrade - Automatic smart upgrader /*{{{*/
32 // ---------------------------------------------------------------------
33 /* Intelligent upgrader that will install and remove packages at will */
34 bool DoDistUpgrade(CommandLine &CmdL)
35 {
36 return UpgradeHelper(CmdL, APT::Upgrade::ALLOW_EVERYTHING);
37 }
38 /*}}}*/
39 bool 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 /*}}}*/
47 // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
48 // ---------------------------------------------------------------------
49 /* Upgrade all packages without installing new packages or erasing old
50 packages */
51 bool DoUpgradeNoNewPackages(CommandLine &CmdL)
52 {
53 // Do the upgrade
54 return UpgradeHelper(CmdL,
55 APT::Upgrade::FORBID_REMOVE_PACKAGES|
56 APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES);
57 }
58 /*}}}*/
59 // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
60 bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
61 {
62 return UpgradeHelper(CmdL, APT::Upgrade::FORBID_REMOVE_PACKAGES);
63 }
64 /*}}}*/