apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

private-upgrade.cc
Go to the documentation of this file.
1 // Includes /*{{{*/
2 #include <config.h>
3 
4 #include <apt-pkg/configuration.h>
5 #include <apt-pkg/error.h>
6 #include <apt-pkg/upgrade.h>
7 
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  auto VolatileCmdL = GetPseudoPackages(Cache.GetSourceList(), CmdL, AddVolatileBinaryFile, "");
23 
24  if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
25  return false;
26 
27  if(!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeFlags))
28  return false;
29 
30  return InstallPackages(Cache,true);
31 }
32 
33 // DoDistUpgrade - Automatic smart upgrader /*{{{*/
34 // ---------------------------------------------------------------------
35 /* Intelligent upgrader that will install and remove packages at will */
37 {
39 }
40  /*}}}*/
41 bool DoUpgrade(CommandLine &CmdL) /*{{{*/
42 {
43  if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
44  return DoUpgradeWithAllowNewPackages(CmdL);
45  else
46  return DoUpgradeNoNewPackages(CmdL);
47 }
48  /*}}}*/
49 // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
50 // ---------------------------------------------------------------------
51 /* Upgrade all packages without installing new packages or erasing old
52  packages */
54 {
55  // Do the upgrade
56  return UpgradeHelper(CmdL,
59 }
60  /*}}}*/
61 // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
63 {
65 }
66  /*}}}*/
bool OpenForInstall()
bool CheckDeps(bool AllowBroken=false)
bool FindB(const char *Name, bool const &Default=false) const
pkgSourceList * GetSourceList()
Definition: cachefile.h:76
Configuration * _config
@ FORBID_REMOVE_PACKAGES
Definition: upgrade.h:23
@ FORBID_INSTALL_NEW_PACKAGES
Definition: upgrade.h:24
@ ALLOW_EVERYTHING
Definition: upgrade.h:25
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int UpgradeMode)
bool AddVolatileBinaryFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector< PseudoPkg > &VolatileCmdL)
bool InstallPackages(CacheFile &Cache, bool ShwKept, bool Ask, bool Safety)
std::vector< PseudoPkg > GetPseudoPackages(pkgSourceList *const SL, CommandLine &CmdL, bool(*Add)(pkgSourceList *const, PseudoPkg &&, std::vector< PseudoPkg > &), std::string const &pseudoArch)
bool DoUpgrade(CommandLine &CmdL)
bool DoDistUpgrade(CommandLine &CmdL)
bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
bool DoUpgradeNoNewPackages(CommandLine &CmdL)
static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)