summaryrefslogtreecommitdiff
path: root/apt-private/private-update.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private/private-update.cc')
-rw-r--r--apt-private/private-update.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc
index da83d7741..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;
}
@@ -75,6 +82,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;
}
/*}}}*/