private-upgrade.cc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. CacheFile Cache;
  13. if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
  14. return false;
  15. // Do the upgrade
  16. if (pkgAllUpgrade(Cache) == false)
  17. {
  18. ShowBroken(c1out,Cache,false);
  19. return _error->Error(_("Internal error, AllUpgrade broke stuff"));
  20. }
  21. return InstallPackages(Cache,true);
  22. }
  23. /*}}}*/
  24. // DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
  25. bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
  26. {
  27. CacheFile Cache;
  28. if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
  29. return false;
  30. // Do the upgrade
  31. if (pkgAllUpgradeNoDelete(Cache) == false)
  32. {
  33. ShowBroken(c1out,Cache,false);
  34. return _error->Error(_("Internal error, AllUpgrade broke stuff"));
  35. }
  36. return InstallPackages(Cache,true);
  37. }
  38. /*}}}*/