X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/d428d131a29a08fa7c1d95b98b684fb2ebb554c0..acfbd607bd92cc1ba391873ce0ccec7103d858e0:/apt-private/private-update.cc diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index f6c12c26a..860d84b86 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -1,37 +1,23 @@ // Include files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include +#include -#include -#include -#include +#include +#include +#include +#include -#include "private-cachefile.h" -#include "private-output.h" -#include "acqprogress.h" +#include +#include #include /*}}}*/ @@ -89,6 +75,27 @@ bool DoUpdate(CommandLine &CmdL) return false; } + // show basic stats (if the user whishes) + if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true) + { + int upgradable = 0; + Cache.Open(); + for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I) + { + pkgDepCache::StateCache &state = Cache[I]; + if (I->CurrentVer != 0 && state.Upgradable() && state.CandidateVer != NULL) + upgradable++; + } + const char *msg = P_( + "%i package can be upgraded. Run 'apt list --upgradable' to see it.\n", + "%i packages can be upgraded. Run 'apt list --upgradable' to see them.\n", + upgradable); + if (upgradable == 0) + c1out << _("All packages are up to date.") << std::endl; + else + ioprintf(c1out, msg, upgradable); + } + return true; } /*}}}*/