2 #include <apt-pkg/algorithms.h>
4 #include "private-install.h"
5 #include "private-cachefile.h"
6 #include "private-upgrade.h"
7 #include "private-output.h"
10 // this is actually performing the various upgrade operations
11 static bool UpgradeHelper(CommandLine
&CmdL
, int UpgradeFlags
)
14 if (Cache
.OpenForInstall() == false || Cache
.CheckDeps() == false)
17 c0out
<< _("Calculating upgrade... ") << std::flush
;
18 if (APT::Upgrade::Upgrade(Cache
, UpgradeFlags
) == false)
20 c0out
<< _("Failed") << std::endl
;
21 ShowBroken(c1out
,Cache
,false);
22 return _error
->Error(_("Internal error, Upgrade broke stuff"));
24 c0out
<< _("Done") << std::endl
;
26 // parse additional cmdline pkg manipulation switches
27 if(!DoCacheManipulationFromCommandLine(CmdL
, Cache
))
30 return InstallPackages(Cache
,true);
33 // DoDistUpgrade - Automatic smart upgrader /*{{{*/
34 // ---------------------------------------------------------------------
35 /* Intelligent upgrader that will install and remove packages at will */
36 bool DoDistUpgrade(CommandLine
&CmdL
)
38 return UpgradeHelper(CmdL
, 0);
41 // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
42 // ---------------------------------------------------------------------
43 /* Upgrade all packages without installing new packages or erasing old
45 bool DoUpgradeNoNewPackages(CommandLine
&CmdL
)
48 return UpgradeHelper(CmdL
,
49 APT::Upgrade::FORBID_REMOVE_PACKAGES
|
50 APT::Upgrade::FORBID_NEW_INSTALL_PACKAGES
);
53 // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
54 bool DoUpgradeWithAllowNewPackages(CommandLine
&CmdL
)
56 return UpgradeHelper(CmdL
, APT::Upgrade::FORBID_REMOVE_PACKAGES
);