summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-01-18 11:31:13 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2017-01-19 00:57:38 +0100
commit33f982b90a4f77be18cb82daf8c79e9c5513761c (patch)
tree0161bc7b57b3a03d959419c4c145221a7504dd3a
parent803dabde5a4345ce83b3d2ffbd475786db9769d9 (diff)
don't show update stats if cache generation is disabled
Unlikely that anyone is actually running into this, but if we asked to not generate a cache and avoid it in the first step we shouldn't create one implicitly anyway by displaying the statistics.
-rw-r--r--apt-private/private-update.cc12
-rwxr-xr-xtest/integration/test-apt-cli-update1
2 files changed, 7 insertions, 6 deletions
diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc
index ba953a088..b63b7d963 100644
--- a/apt-private/private-update.cc
+++ b/apt-private/private-update.cc
@@ -71,13 +71,13 @@ bool DoUpdate(CommandLine &CmdL)
ListUpdate(Stat, *List);
}
+ if (_config->FindB("pkgCacheFile::Generate", true) == false)
+ return true;
+
// Rebuild the cache.
- if (_config->FindB("pkgCacheFile::Generate", true) == true)
- {
- pkgCacheFile::RemoveCaches();
- if (Cache.BuildCaches() == false)
- return false;
- }
+ pkgCacheFile::RemoveCaches();
+ if (Cache.BuildCaches() == false)
+ return false;
// show basic stats (if the user whishes)
if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true)
diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update
index b423072c3..cc8d051d2 100755
--- a/test/integration/test-apt-cli-update
+++ b/test/integration/test-apt-cli-update
@@ -15,6 +15,7 @@ setupaptarchive --no-update
testfailuremsg 'E: The update command takes no arguments' apt update arguments
+testempty apt update -qq -o pkgCacheFile::Generate=false
testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -qq
cp dpkg.status rootdir/var/lib/dpkg/status