summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-04-16 17:40:11 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-04-16 17:40:11 +0200
commitb11f95991d844d36fc0e3832810057f72a2d810b (patch)
treecca2cc733fc237caec8ae998df8a6c0b7dc5b798 /apt-pkg
parentc62f7898b6f37b8e4b076ae3c40d56d22a884efe (diff)
use correct compression extension when loading the size of the size into the fetcher
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 834362b84..f9dd74445 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -963,12 +963,10 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target,
else
Verify = true;
- // FIXME: use the appropriate compression Extension
- // load the filesize
- indexRecords::checkSum *Record = MetaIndexParser->Lookup(string(Target->MetaKey));
- if(Record)
- FileSize = Record->Size;
-
+ // we need this in Init()
+ this->Target = Target;
+ this->MetaIndexParser = MetaIndexParser;
+
Init(Target->URI, Target->Description, Target->ShortDesc);
}
/*}}}*/
@@ -981,10 +979,22 @@ void pkgAcqIndex::Init(string const &URI, string const &URIDesc, string const &S
DestFile += URItoFileName(URI);
std::string const comprExt = CompressionExtension.substr(0, CompressionExtension.find(' '));
+ std::string MetaKey;
if (comprExt == "uncompressed")
+ {
Desc.URI = URI;
+ MetaKey = string(Target->MetaKey);
+ }
else
+ {
Desc.URI = URI + '.' + comprExt;
+ MetaKey = string(Target->MetaKey) + '.' + comprExt;
+ }
+
+ // load the filesize
+ indexRecords::checkSum *Record = MetaIndexParser->Lookup(MetaKey);
+ if(Record)
+ FileSize = Record->Size;
Desc.Description = URIDesc;
Desc.Owner = this;
@@ -1086,7 +1096,7 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash,
FinalFile += URItoFileName(RealURI);
Rename(DestFile,FinalFile);
chmod(FinalFile.c_str(),0644);
-
+
/* We restore the original name to DestFile so that the clean operation
will work OK */
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
@@ -1095,6 +1105,7 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash,
// Remove the compressed version.
if (Erase == true)
unlink(DestFile.c_str());
+
return;
}