]> git.saurik.com Git - apt.git/commitdiff
remove the caches in 'apt-get update', too, as they will be
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 22 Aug 2011 21:10:15 +0000 (23:10 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 22 Aug 2011 21:10:15 +0000 (23:10 +0200)
invalid in most cases anyway

13 files changed:
apt-pkg/cachefile.cc
apt-pkg/cachefile.h
cmdline/apt-get.cc
debian/changelog
test/integration/test-bug-254770-segfault-if-cache-not-buildable
test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
test/integration/test-bug-595691-empty-and-broken-archive-files
test/integration/test-bug-601016-description-translation
test/integration/test-bug-633350-do-not-kill-last-char-in-Release
test/integration/test-compressed-indexes
test/integration/test-hashsum-verification
test/integration/test-policy-pinning
test/integration/test-releasefile-verification

index 964c5bd8bc9ad486472ea3854947bac4fc809874..a76cfc08e2184f1b8c100184473e3d6f72151d7d 100644 (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                            /*{{{*/
 // ---------------------------------------------------------------------
 /* */
index 09d3ec2676675c3063f32f5cc016b11eb7d245fe..b4f41c6f4b04cdde6f55b9ac54332bfda7ea6cf3 100644 (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; };
index 2dd1c2bce55ec56182a99ed30ff46902cbd8bb9b..69b9dcda947e6b827667e8fd361774840845ac15 100644 (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;
 }
index 49524985593fc50d36673756643148d51469a28b..e1c9ac35096dfa5287043cc7230ff08b4db1f3a9 100644 (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
 
index b9f45b131c49c0fecbf64489e47e8cb34933e972..8fa337ccc19734a55d266070c941984d66ca0d90 100755 (executable)
@@ -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
index 0f64939484f1497bec69b28a5886be8d7b863b42..645e86d7d130404bea08186fa25aa599aa9c7ed4 100755 (executable)
@@ -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
index 11dee062898a64aee488faeb49750cd08c54592a..5c103da6f49f35553b290d8d7be68ead6746b20f 100755 (executable)
@@ -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"
index 2a323a201b84ec2386f0169431fee27f1a18e655..44ab919006dfa0de3a8c3433709af90fd35b5b12 100755 (executable)
@@ -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}
index 3d3835507ffd8575e71ebccec002cccec2adb34f..2aae7cfccecc853c57b97d25976f555b28a81616 100755 (executable)
@@ -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'
index 99943574e1b621682ca490be5bdb6553c17602ee..26a45812ea32a8acf5a10df6707484133866b101 100755 (executable)
@@ -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
index 033096ee8504a93f5fc60a79549ef0f4e68e9357..3ac9eccfbf3362b5f7da11eef348507173d922fc 100755 (executable)
@@ -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
index fa356ed5475e4598e321e56f7df498e6027a110e..6b1473564810676536c6285729735755fa920587 100755 (executable)
@@ -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
index 961c498950dc716fc3b85b6744e13dc82f3c6fab..8bf02a78fbdc8e642ccf65773c666d04faf47298 100755 (executable)
@@ -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