Parcourir la source

Added fallback to uncompressed files while acquiring index files (Sources and Packages)

Eugene V. Lyubimkin il y a 17 ans
Parent
commit
0d7a243df5
2 fichiers modifiés avec 28 ajouts et 6 suppressions
  1. 19 6
      apt-pkg/acquire-item.cc
  2. 9 0
      debian/changelog

+ 19 - 6
apt-pkg/acquire-item.cc

@@ -570,7 +570,7 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
    } else {
       CompressionExtension = comprExt;
    }
-   Desc.URI = URI + CompressionExtension; 
+   Desc.URI = URI + (CompressionExtension == "plain" ? "" : CompressionExtension); 
 
    Desc.Description = URIDesc;
    Desc.Owner = this;
@@ -597,19 +597,30 @@ string pkgAcqIndex::Custom600Headers()
 
 void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 {
+   bool descChanged = false;
    // no .bz2 found, retry with .gz
    if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
-      Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; 
+      Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz";
 
-      // retry with a gzip one 
-      new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc, 
+      new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
 		      ExpectedHash, string(".gz"));
+	  descChanged = true;
+   }
+   // no .gz found, retry with uncompressed
+   else if(Desc.URI.substr(Desc.URI.size()-2) == "gz") {
+      Desc.URI = Desc.URI.substr(0,Desc.URI.size()-2);
+
+      new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
+		      ExpectedHash, string("plain"));
+	  descChanged = true;
+   }
+   if (descChanged) {
       Status = StatDone;
       Complete = false;
       Dequeue();
       return;
-   } 
-   
+   }
+
    // on decompression failure, remove bad versions in partial/
    if(Decompression && Erase) {
       string s = _config->FindDir("Dir::State::lists") + "partial/";
@@ -706,6 +717,8 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
       decompProg = "bzip2";
    else if(compExt == ".gz") 
       decompProg = "gzip";
+   else if(compExt == "ges" || compExt == "ces") // packaGES or sourCES
+      decompProg = "copy";
    else {
       _error->Error("Unsupported extension: %s", compExt.c_str());
       return;

+ 9 - 0
debian/changelog

@@ -1,3 +1,12 @@
+apt (0.7.17) unstable; urgency=low
+
+  [ Eugene V. Lyubimkin ]
+  * apt-pkg/acquire-item.cc:
+    - Added fallback to uncompressed 'Packages' if neither 'bz2' nor 'gz'
+      available. (Closes: #409284)
+
+ -- Eugene V. Lyubimkin <jackyf.devel@gmail.com>  Fri, 24 Oct 2008 23:45:17 +0300
+
 apt (0.7.16) unstable; urgency=low
 
   [ Luca Bruno ]