+// AcqIndex::Done - Finished a fetch /*{{{*/
+// ---------------------------------------------------------------------
+/* This goes through a number of states.. On the initial fetch the
+ method could possibly return an alternate filename which points
+ to the uncompressed version of the file. If this is so the file
+ is copied into the partial directory. In all other cases the file
+ is decompressed with a gzip uri. */
+void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5)
+{
+ Item::Done(Message,Size,MD5);
+
+ if (Decompression == true)
+ {
+ // Done, move it into position
+ string FinalFile = _config->FindDir("Dir::State::lists");
+ FinalFile += URItoFileName(Location->PackagesURI());
+ Rename(DestFile,FinalFile);
+ return;
+ }
+
+ // Handle the unzipd case
+ string FileName = LookupTag(Message,"Alt-Filename");
+ if (FileName.empty() == false)
+ {
+ // The files timestamp matches
+ if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true)
+ return;
+
+ Decompression = true;
+ DestFile += ".decomp";
+ QueueURI("copy:" + FileName,string());
+ return;
+ }
+
+ FileName = LookupTag(Message,"Filename");
+ if (FileName.empty() == true)
+ {
+ Status = StatError;
+ ErrorText = "Method gave a blank filename";
+ }
+
+ // The files timestamp matches
+ if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ return;
+
+ Decompression = true;
+ DestFile += ".decomp";
+ QueueURI("gzip:" + FileName,string());
+}
+ /*}}}*/
+