Browse Source

remove the caches in 'apt-get update', too, as they will be

invalid in most cases anyway
tags/debian/0.8.15.7
David Kalnischkies 10 years ago
parent
commit
8de79b68a8
13 changed files with 29 additions and 28 deletions
  1. +14
    -0
      apt-pkg/cachefile.cc
  2. +1
    -0
      apt-pkg/cachefile.h
  3. +3
    -5
      cmdline/apt-get.cc
  4. +3
    -1
      debian/changelog
  5. +0
    -1
      test/integration/test-bug-254770-segfault-if-cache-not-buildable
  6. +0
    -2
      test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
  7. +1
    -1
      test/integration/test-bug-595691-empty-and-broken-archive-files
  8. +1
    -1
      test/integration/test-bug-601016-description-translation
  9. +1
    -1
      test/integration/test-bug-633350-do-not-kill-last-char-in-Release
  10. +4
    -5
      test/integration/test-compressed-indexes
  11. +0
    -2
      test/integration/test-hashsum-verification
  12. +0
    -7
      test/integration/test-policy-pinning
  13. +1
    -2
      test/integration/test-releasefile-verification

+ 14
- 0
apt-pkg/cachefile.cc View File

@@ -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 /*{{{*/
// ---------------------------------------------------------------------
/* */


+ 1
- 0
apt-pkg/cachefile.h View File

@@ -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; };


+ 3
- 5
cmdline/apt-get.cc View File

@@ -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;
}


+ 3
- 1
debian/changelog View File

@@ -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



+ 0
- 1
test/integration/test-bug-254770-segfault-if-cache-not-buildable View File

@@ -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


+ 0
- 2
test/integration/test-bug-590438-broken-provides-thanks-to-remove-order View File

@@ -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


+ 1
- 1
test/integration/test-bug-595691-empty-and-broken-archive-files View File

@@ -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"


+ 1
- 1
test/integration/test-bug-601016-description-translation View File

@@ -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}


+ 1
- 1
test/integration/test-bug-633350-do-not-kill-last-char-in-Release View File

@@ -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'


+ 4
- 5
test/integration/test-compressed-indexes View File

@@ -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


+ 0
- 2
test/integration/test-hashsum-verification View File

@@ -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


+ 0
- 7
test/integration/test-policy-pinning View File

@@ -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


+ 1
- 2
test/integration/test-releasefile-verification View File

@@ -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


Loading…
Cancel
Save