]> git.saurik.com Git - apt.git/blame - apt-private/private-upgrade.cc
rename "distribution" in sources.list to "suite"
[apt.git] / apt-private / private-upgrade.cc
CommitLineData
ee0167c4 1// Includes /*{{{*/
b9179170 2#include <apt-pkg/algorithms.h>
82e369c4 3#include <apt-pkg/upgrade.h>
5ca0cf51 4#include <iostream>
b9179170
MV
5#include "private-install.h"
6#include "private-cachefile.h"
7#include "private-upgrade.h"
8#include "private-output.h"
ee0167c4 9 /*}}}*/
b9179170 10
5ca0cf51
MV
11// this is actually performing the various upgrade operations
12static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
b9179170
MV
13{
14 CacheFile Cache;
15 if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
16 return false;
17
7cf45682 18 c0out << _("Calculating upgrade... ") << std::flush;
5ca0cf51 19 if (APT::Upgrade::Upgrade(Cache, UpgradeFlags) == false)
b9179170 20 {
5ca0cf51 21 c0out << _("Failed") << std::endl;
b9179170 22 ShowBroken(c1out,Cache,false);
5ca0cf51 23 return _error->Error(_("Internal error, Upgrade broke stuff"));
b9179170 24 }
7cf45682 25 c0out << _("Done") << std::endl;
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}
5ca0cf51
MV
33
34// DoDistUpgrade - Automatic smart upgrader /*{{{*/
35// ---------------------------------------------------------------------
36/* Intelligent upgrader that will install and remove packages at will */
37bool DoDistUpgrade(CommandLine &CmdL)
38{
39 return UpgradeHelper(CmdL, 0);
40}
41 /*}}}*/
42// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
43// ---------------------------------------------------------------------
44/* Upgrade all packages without installing new packages or erasing old
45 packages */
46bool DoUpgradeNoNewPackages(CommandLine &CmdL)
47{
48 // Do the upgrade
49 return UpgradeHelper(CmdL,
50 APT::Upgrade::FORBID_REMOVE_PACKAGES|
3f506f68 51 APT::Upgrade::FORBID_INSTALL_NEW_PACKAGES);
5ca0cf51 52}
b9179170 53 /*}}}*/
b9179170
MV
54// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
55bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
56{
5ca0cf51 57 return UpgradeHelper(CmdL, APT::Upgrade::FORBID_REMOVE_PACKAGES);
b9179170
MV
58}
59 /*}}}*/