]> git.saurik.com Git - apt.git/commitdiff
use correct compression extension when loading the size of the size into the fetcher
authorMichael Vogt <mvo@ubuntu.com>
Wed, 16 Apr 2014 15:40:11 +0000 (17:40 +0200)
committerMichael Vogt <mvo@ubuntu.com>
Wed, 16 Apr 2014 15:40:11 +0000 (17:40 +0200)
apt-pkg/acquire-item.cc

index 834362b8403ac47e2ad31f2b015859f5262c7b09..f9dd744451f41d8b3004ed9ea2cc9b6f3ea844ca 100644 (file)
@@ -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;
    }