]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
* add "purge" commandline argument, closes: #133421)
[apt.git] / apt-pkg / acquire-item.cc
index 020047c06e1d66d438d7c8d62756713f7a096847..1b912058614de84cdb3bf874850d23b40110ab7d 100644 (file)
@@ -13,9 +13,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/acquire-item.h"
-#endif
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/sourcelist.h>
@@ -78,7 +75,7 @@ void pkgAcquire::Item::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
         Dequeue();
         return;
       }
-
+      
       Status = StatError;
       Dequeue();
    }   
@@ -274,9 +271,9 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
       if(found) 
       {
         // queue the diffs
-       int last_space = Description.rfind(" ");
-       if(last_space != string::npos)
-         Description.erase(last_space, Description.size()-last_space);
+        int last_space = Description.rfind(" ");
+        if(last_space != string::npos)
+           Description.erase(last_space, Description.size()-last_space);
         new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
                              ExpectedMD5, available_patches);
         Complete = false;
@@ -285,7 +282,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
         return true;
       }
    }
-
+   
    // Nothing found, report and return false
    // Failing here is ok, if we return false later, the full
    // IndexFile is queued
@@ -467,7 +464,6 @@ bool pkgAcqIndexDiffs::QueueNextDiff()
    // queue the right diff
    Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz";
    Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
-
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file);
 
@@ -617,9 +613,15 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
       Complete = false;
       Dequeue();
       return;
+   } 
+   
+   // on decompression failure, remove bad versions in partial/
+   if(Decompression && Erase) {
+      string s = _config->FindDir("Dir::State::lists") + "partial/";
+      s += URItoFileName(RealURI);
+      unlink(s.c_str());
    }
 
-   
    Item::Failed(Message,Cnf);
 }
 
@@ -848,7 +850,7 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    if(Status == StatTransientNetworkError)
    {
       Item::Failed(Message,Cnf);
-      // move the sigfile back on network failures (and re-authenticated?)
+      // move the sigfile back on transient network failures 
       if(FileExists(DestFile))
         Rename(DestFile,Final);