]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/acquire-item.cc:
authormartin@piware.de <>
Thu, 10 Jun 2010 11:20:27 +0000 (13:20 +0200)
committermartin@piware.de <>
Thu, 10 Jun 2010 11:20:27 +0000 (13:20 +0200)
  - If the Acquire::GzipIndexes option is true and we download a gzipped
    index file, keep it as it is (and rename to .gz) instead of
    uncompressing it.

apt-pkg/acquire-item.cc
debian/changelog

index 6d4336425482bfa01d1d0deef027078a68f75455..eab34e26c28b60038f675226d42dcb416f1a36ee 100644 (file)
@@ -620,6 +620,8 @@ string pkgAcqIndex::Custom600Headers()
 {
    string Final = _config->FindDir("Dir::State::lists");
    Final += URItoFileName(RealURI);
+   if (_config->FindB("Acquire::GzipIndexes",false))
+      Final += ".gz";
    
    struct stat Buf;
    if (stat(Final.c_str(),&Buf) != 0)
@@ -714,6 +716,23 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
    Erase = false;
    Complete = true;
    
+   string compExt = flExtension(flNotDir(URI(Desc.URI).Path));
+
+   // If we enable compressed indexes and already have gzip, keep it
+   if (_config->FindB("Acquire::GzipIndexes",false) && compExt == "gz") {
+      string FinalFile = _config->FindDir("Dir::State::lists");
+      FinalFile += URItoFileName(RealURI) + ".gz";
+      //if(Debug)
+      //   std::clog << "pkgAcqIndex: keeping gzipped " << FinalFile << endl;
+      Rename(DestFile,FinalFile);
+      chmod(FinalFile.c_str(),0644);
+      
+      // Update DestFile for .gz suffix so that the clean operation keeps it
+      DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+      DestFile += URItoFileName(RealURI) + ".gz";
+      return;
+    }
+
    // Handle the unzipd case
    string FileName = LookupTag(Message,"Alt-Filename");
    if (FileName.empty() == false)
@@ -746,7 +765,6 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
    else
       Local = true;
    
-   string compExt = flExtension(flNotDir(URI(Desc.URI).Path));
    string decompProg;
 
    // get the binary name for your used compression type
index 80c504b99a47ca1eecbcced9c2063c0c81b9f1a1..4122a728e9bc11d96d35b1c25afc125bc36fd2f3 100644 (file)
@@ -11,6 +11,10 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low
   * apt-pkg/deb/debindexfile.cc:
     - If we do not find uncompressed package/source/translation indexes, look
       for gzip compressed ones.
+  * apt-pkg/acquire-item.cc:
+    - If the Acquire::GzipIndexes option is true and we download a gzipped
+      index file, keep it as it is (and rename to .gz) instead of
+      uncompressing it.
 
  -- Christian Perrier <bubulle@debian.org>  Tue, 11 May 2010 19:52:00 +0200