summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-11-24 11:16:13 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2008-11-24 11:16:13 +0100
commit73e0ee1e7f97571d7be3277e3c25c2f41b2bb946 (patch)
tree788e6a2c6052c70b6d3c478e80bf2e013f3b0dc0 /apt-pkg/acquire-item.cc
parent07dd557b6fd80ce2df235f1697189b6a8f190ff4 (diff)
parent8071aa806453a3e275576c196d6645051475c894 (diff)
merged from debian-sid
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc36
1 files changed, 27 insertions, 9 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index aee187227..91f3d0605 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -618,9 +618,9 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
else
CompressionExtension = ".gz";
} else {
- CompressionExtension = comprExt;
+ CompressionExtension = (comprExt == "plain" ? "" : comprExt);
}
- Desc.URI = URI + CompressionExtension;
+ Desc.URI = URI + CompressionExtension;
Desc.Description = URIDesc;
Desc.Owner = this;
@@ -646,19 +646,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/";
@@ -750,12 +761,19 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
else
Local = true;
- string compExt = Desc.URI.substr(Desc.URI.size()-3);
+ string compExt = flExtension(flNotDir(URI(Desc.URI).Path));
const char *decompProg;
if(compExt == "bz2")
decompProg = "bzip2";
- else if(compExt == ".gz")
+ else if(compExt == "gz")
decompProg = "gzip";
+ // flExtensions returns the full name if no extension is found
+ // this is why we have this complicated compare operation here
+ // FIMXE: add a new flJustExtension() that return "" if no
+ // extension is found and use that above so that it can
+ // be tested against ""
+ else if(compExt == flNotDir(URI(Desc.URI).Path))
+ decompProg = "copy";
else {
_error->Error("Unsupported extension: %s", compExt.c_str());
return;