private-upgrade.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Includes /*{{{*/
  2. #include <apt-pkg/algorithms.h>
  3. #include "private-install.h"
  4. #include "private-cachefile.h"
  5. #include "private-upgrade.h"
  6. #include "private-output.h"
  7. /*}}}*/
  8. // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
  9. // ---------------------------------------------------------------------
  10. /* Upgrade all packages without installing new packages or erasing old
  11. packages */
  12. bool DoUpgradeNoNewPackages(CommandLine &CmdL)
  13. {
  14. CacheFile Cache;
  15. if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
  16. return false;
  17. // Do the upgrade
  18. if (pkgAllUpgrade(Cache) == false)
  19. {
  20. ShowBroken(c1out,Cache,false);
  21. return _error->Error(_("Internal error, AllUpgrade broke stuff"));
  22. }
  23. // parse additional cmdline pkg manipulation switches
  24. if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
  25. return false;
  26. return InstallPackages(Cache,true);
  27. }
  28. /*}}}*/
  29. // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
  30. bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
  31. {
  32. CacheFile Cache;
  33. if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
  34. return false;
  35. // Do the upgrade
  36. if (pkgAllUpgradeNoDelete(Cache) == false)
  37. {
  38. ShowBroken(c1out,Cache,false);
  39. return _error->Error(_("Internal error, AllUpgrade broke stuff"));
  40. }
  41. // parse additional cmdline pkg manipulation switches
  42. if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
  43. return false;
  44. return InstallPackages(Cache,true);
  45. }
  46. /*}}}*/