From 8f418981337503ff7abedd872f788b51bcdbc886 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 22 Apr 2014 16:07:32 +0200 Subject: show upgradable packages after apt update Closes: 748389 --- apt-private/private-update.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'apt-private/private-update.cc') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index da83d7741..fa827dea4 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -75,6 +75,24 @@ 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()) + upgradable++; + } + const char *msg = ngettext( + "%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); + ioprintf(c1out, msg, upgradable); + } + return true; } /*}}}*/ -- cgit v1.2.3 From 24d05892fe96d52aaceef7af94d0e444e140067c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 18 Jun 2014 08:25:16 +0200 Subject: Tell the user if no updates are available after apt update Thanks to Jakub Wilk for the suggestion. Closes: #751388 --- apt-private/private-update.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-private/private-update.cc') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index fa827dea4..a843d6f86 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -90,7 +90,10 @@ bool DoUpdate(CommandLine &CmdL) "%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); - ioprintf(c1out, msg, upgradable); + if (upgradable == 0) + c1out << _("All packages are up to date.") << std::endl; + else + ioprintf(c1out, msg, upgradable); } return true; -- cgit v1.2.3 From dab5f8745b8d6df1060490c8c5ac895832657a74 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 17 Jun 2014 11:33:00 +0200 Subject: use P_ instead of ngettext to compiling with --disable-nls Closes: 751857 --- apt-private/private-update.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private/private-update.cc') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index a843d6f86..0f2f7a8da 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -86,7 +86,7 @@ bool DoUpdate(CommandLine &CmdL) if (I->CurrentVer != 0 && state.Upgradable()) upgradable++; } - const char *msg = ngettext( + 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); -- cgit v1.2.3 From 7d1b93d94083a3856efc821bacd9e91f80bbf760 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 8 Jul 2014 16:06:56 +0200 Subject: Only show packages as upgradable if the have a CandidateVer != 0 Closes: #753297 --- apt-private/private-update.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private/private-update.cc') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index 0f2f7a8da..860d84b86 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -83,7 +83,7 @@ bool DoUpdate(CommandLine &CmdL) for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I) { pkgDepCache::StateCache &state = Cache[I]; - if (I->CurrentVer != 0 && state.Upgradable()) + if (I->CurrentVer != 0 && state.Upgradable() && state.CandidateVer != NULL) upgradable++; } const char *msg = P_( -- cgit v1.2.3 From b0f4b486e6850c5f98520ccf19da71d0ed748ae4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 21 Sep 2014 10:18:03 +0200 Subject: generalize Acquire::GzipIndex --- apt-private/private-update.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-private/private-update.cc') diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index 860d84b86..1cf3012ed 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -56,10 +56,17 @@ bool DoUpdate(CommandLine &CmdL) if (List->GetIndexes(&Fetcher,true) == false) return false; + std::string compExt = APT::Configuration::getCompressionTypes()[0]; pkgAcquire::UriIterator I = Fetcher.UriBegin(); for (; I != Fetcher.UriEnd(); ++I) - c1out << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << + { + std::string FileName = flNotDir(I->Owner->DestFile); + if(compExt.empty() == false && + APT::String::Endswith(FileName, compExt)) + FileName = FileName.substr(0, FileName.size() - compExt.size() - 1); + c1out << '\'' << I->URI << "' " << FileName << ' ' << I->Owner->FileSize << ' ' << I->Owner->HashSum() << std::endl; + } return true; } -- cgit v1.2.3