private-upgrade.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <apt-pkg/algorithms.h>
  2. #include "private-install.h"
  3. #include "private-cachefile.h"
  4. #include "private-upgrade.h"
  5. #include "private-output.h"
  6. // DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
  7. // ---------------------------------------------------------------------
  8. /* Upgrade all packages without installing new packages or erasing old
  9. packages */
  10. bool DoUpgradeNoNewPackages(CommandLine &CmdL)
  11. {
  12. if (CmdL.FileSize() != 1)
  13. return _error->Error(_("The upgrade command takes no arguments"));
  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. return InstallPackages(Cache,true);
  24. }
  25. /*}}}*/
  26. // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
  27. bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
  28. {
  29. if (CmdL.FileSize() != 1)
  30. return _error->Error(_("The upgrade command takes no arguments"));
  31. CacheFile Cache;
  32. if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
  33. return false;
  34. // Do the upgrade
  35. if (pkgAllUpgradeNoDelete(Cache) == false)
  36. {
  37. ShowBroken(c1out,Cache,false);
  38. return _error->Error(_("Internal error, AllUpgrade broke stuff"));
  39. }
  40. return InstallPackages(Cache,true);
  41. }
  42. /*}}}*/