summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@tas>2008-10-28 16:48:16 +0100
committerMichael Vogt <egon@tas>2008-10-28 16:48:16 +0100
commit70b3d263556241a0cb8217006f4dbef1138de25d (patch)
treea09c56df0b59a984a10392a090adbac29e734806 /apt-pkg/acquire-item.cc
parenta15489ce5d8946c6cf76e24afb5f9288814e49fc (diff)
parent4b94b383390fb93c58fb14460679fadbb3c8ee93 (diff)
* apt-pkg/acquire-item.cc:
- Added fallback to uncompressed 'Packages' if neither 'bz2' nor 'gz' available. (Closes: #409284) * apt-pkg/algorithm.cc: - Strip username and password from source URL in error message. (Closes: #425150)
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 7cae6c8b7..679f9cee7 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -568,9 +568,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;
@@ -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/";
@@ -700,12 +711,14 @@ 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(URI(Desc.URI).Path);
const char *decompProg;
if(compExt == "bz2")
decompProg = "bzip2";
else if(compExt == ".gz")
decompProg = "gzip";
+ else if(compExt == "")
+ decompProg = "copy";
else {
_error->Error("Unsupported extension: %s", compExt.c_str());
return;