summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authormartin@piware.de <>2010-06-10 13:20:27 +0200
committermartin@piware.de <>2010-06-10 13:20:27 +0200
commit01606def78105c9d64f12c89e387d37ed46925b6 (patch)
treee11159f051f6b3594417643508ac6b19f668fb32 /apt-pkg/acquire-item.cc
parentec7a129eeb1611ec097bc99a148d6d3a3dccf044 (diff)
* 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.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 6d4336425..eab34e26c 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -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