summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-08-22 23:10:15 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-08-22 23:10:15 +0200
commit8de79b68a834a6cc7abb8976e96ed19374fc02a2 (patch)
treeaead647a6dcafc84404073459e15d5fd603b3c6a
parent95b5f6c19d361745c4e11b214f0f07ad10c9b5b3 (diff)
remove the caches in 'apt-get update', too, as they will be
invalid in most cases anyway
-rw-r--r--apt-pkg/cachefile.cc14
-rw-r--r--apt-pkg/cachefile.h1
-rw-r--r--cmdline/apt-get.cc8
-rw-r--r--debian/changelog4
-rwxr-xr-xtest/integration/test-bug-254770-segfault-if-cache-not-buildable1
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order2
-rwxr-xr-xtest/integration/test-bug-595691-empty-and-broken-archive-files2
-rwxr-xr-xtest/integration/test-bug-601016-description-translation2
-rwxr-xr-xtest/integration/test-bug-633350-do-not-kill-last-char-in-Release2
-rwxr-xr-xtest/integration/test-compressed-indexes9
-rwxr-xr-xtest/integration/test-hashsum-verification2
-rwxr-xr-xtest/integration/test-policy-pinning7
-rwxr-xr-xtest/integration/test-releasefile-verification3
13 files changed, 29 insertions, 28 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 964c5bd8b..a76cfc08e 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -163,6 +163,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
return true;
}
/*}}}*/
+// CacheFile::RemoveCaches - remove all cache files from disk /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgCacheFile::RemoveCaches()
+{
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
+ if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+ unlink(pkgcache.c_str());
+ if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+ unlink(srcpkgcache.c_str());
+}
+ /*}}}*/
// CacheFile::Close - close the cache files /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h
index 09d3ec267..b4f41c6f4 100644
--- a/apt-pkg/cachefile.h
+++ b/apt-pkg/cachefile.h
@@ -57,6 +57,7 @@ class pkgCacheFile
bool Open(OpProgress *Progress = NULL, bool WithLock = true);
inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); };
__deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); };
+ static void RemoveCaches();
void Close();
inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; };
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 2dd1c2bce..69b9dcda9 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1625,7 +1625,8 @@ bool DoUpdate(CommandLine &CmdL)
if (_config->FindB("APT::Get::Download",true) == true)
ListUpdate(Stat, *List);
- // Rebuild the cache.
+ // Rebuild the cache.
+ pkgCacheFile::RemoveCaches();
if (Cache.BuildCaches() == false)
return false;
@@ -2227,10 +2228,7 @@ bool DoClean(CommandLine &CmdL)
Fetcher.Clean(archivedir);
Fetcher.Clean(archivedir + "partial/");
- if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
- unlink(pkgcache.c_str());
- if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
- unlink(srcpkgcache.c_str());
+ pkgCacheFile::RemoveCaches();
return true;
}
diff --git a/debian/changelog b/debian/changelog
index 495249855..e1c9ac350 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,13 +14,15 @@ apt (0.8.15.7) UNRELEASED; urgency=low
* cmdline/apt-get.cc:
- remove the binary caches in 'apt-get clean' as it is the first
thing recommend by many supporters in case of APT segfaults
+ - remove the caches in 'apt-get update', too, as they will be
+ invalid in most cases anyway
* apt-pkg/acquire-item.cc:
- if no Release.gpg file is found try to verify with hashes,
but do not fail if a hash can't be found
* apt-pkg/acquire.cc:
- non-existing directories are by definition clean
- -- David Kalnischkies <kalnischkies@gmail.com> Mon, 22 Aug 2011 23:07:29 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Mon, 22 Aug 2011 23:08:47 +0200
apt (0.8.15.6) unstable; urgency=low
diff --git a/test/integration/test-bug-254770-segfault-if-cache-not-buildable b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
index b9f45b131..8fa337ccc 100755
--- a/test/integration/test-bug-254770-segfault-if-cache-not-buildable
+++ b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
@@ -12,7 +12,6 @@ trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
chmod a-x rootdir/var/lib/dpkg
testsegfault() {
- rm -f rootdir/var/cache/apt/*.bin
msgtest "No segfault in" "$*"
local TEST="$($* 2>&1 | grep -v 'E:')"
if [ -z "$TEST" ]; then
diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
index 0f6493948..645e86d7d 100755
--- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
+++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
@@ -25,7 +25,6 @@ MD5sum: 8489687ce10e656babd467c9ee389349
Description-de: Verschiedene Dateien für das Basis-System von Debian"
predependsgawk() {
- rm rootdir/var/cache/apt/*.bin
cp $TESTDIR/$(echo "$(basename $0)" | sed 's/test-/status-/') rootdir/var/lib/dpkg/status
echo "$pkgbasefile
Pre-Depends: $1
@@ -57,7 +56,6 @@ predependsgawk "awk | aawk"
predependsgawk "awk"
predependsgawk2() {
- rm rootdir/var/cache/apt/*.bin
cp $TESTDIR/$(echo "$(basename $0)" | sed 's/test-/status-/') rootdir/var/lib/dpkg/status
echo "$pkgbasefile
Pre-Depends: $1
diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files
index 11dee0628..5c103da6f 100755
--- a/test/integration/test-bug-595691-empty-and-broken-archive-files
+++ b/test/integration/test-bug-595691-empty-and-broken-archive-files
@@ -11,7 +11,7 @@ touch aptarchive/Packages
setupflataptarchive
testaptgetupdate() {
- rm -rf rootdir/var/lib/apt rootdir/var/cache/apt
+ rm -rf rootdir/var/lib/apt
aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
GIVEN="$1"
diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/test-bug-601016-description-translation
index 2a323a201..44ab91900 100755
--- a/test/integration/test-bug-601016-description-translation
+++ b/test/integration/test-bug-601016-description-translation
@@ -57,7 +57,7 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg
testrun() {
echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
export LC_ALL=""
- rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/
+ rm -rf rootdir/var/lib/apt/lists
setupaptarchive
testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
diff --git a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
index 3d3835507..2aae7cfcc 100755
--- a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
+++ b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
@@ -15,7 +15,7 @@ echo 'NotAutomatic: yes' >> aptarchive/dists/unstable/Release
signreleasefiles
find aptarchive/dists -name 'InRelease' -delete
-rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt
+rm -rf rootdir/var/lib/apt/lists
OUTPUT="$(aptget update 2>&1)"
msgtest 'Check that parsing happens without warnings' 'with missing newline'
diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes
index 99943574e..26a45812e 100755
--- a/test/integration/test-compressed-indexes
+++ b/test/integration/test-compressed-indexes
@@ -51,17 +51,16 @@ testrun() {
aptget clean
msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
fi
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODSHOW" aptcache show testpkg
testequal "$GOODSHOW" aptcache show testpkg
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODPOLICY" aptcache policy testpkg
testequal "$GOODPOLICY" aptcache policy testpkg
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODSHOWSRC" aptcache showsrc testpkg
testequal "$GOODSHOWSRC" aptcache showsrc testpkg
- rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
- rm -rf rootdir/var/cache/apt/archives
+ aptget clean
msgtest "Check if the source is aptgetable"
aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification
index 033096ee8..3ac9eccfb 100755
--- a/test/integration/test-hashsum-verification
+++ b/test/integration/test-hashsum-verification
@@ -19,8 +19,6 @@ prepare() {
for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
touch -d 'now - 6 hours' $release
done
- rm -rf rootdir/var/cache/apt/archives
- rm -f rootdir/var/cache/apt/*.bin
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
cat aptarchive/Packages | gzip > aptarchive/Packages.gz
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index fa356ed54..6b1473564 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -30,21 +30,18 @@ testequalpolicy 100 500
testequalpolicy 990 500 -t now
sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 1 -o Test=NotAutomatic
testequalpolicy 990 1 -o Test=NotAutomatic -t now
sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 500 -o Test=Automatic
@@ -135,7 +132,6 @@ Pin-Priority: -1" > rootdir/etc/apt/preferences
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic
@@ -164,7 +160,6 @@ testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t s
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
@@ -211,7 +206,6 @@ setupaptarchive
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic
@@ -220,7 +214,6 @@ testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=N
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index 961c49895..8bf02a78f 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -19,8 +19,7 @@ prepare() {
for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
touch -d 'now - 6 hours' $release
done
- rm -rf rootdir/var/cache/apt/archives
- rm -f rootdir/var/cache/apt/*.bin
+ aptget clean
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
cat aptarchive/Packages | gzip > aptarchive/Packages.gz