+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(Location->ReleaseURI());
+
+ // Create the item
+ Desc.URI = Location->ReleaseURI();
+ Desc.Description = Location->ReleaseInfo();
+ Desc.Owner = this;
+
+ // Set the short description to the archive component
+ if (Location->Dist[Location->Dist.size() - 1] == '/')
+ Desc.ShortDesc = Location->Dist;
+ else
+ Desc.ShortDesc = Location->Dist + '/' + Location->Section;
+
+ QueueURI(Desc);
+}
+ /*}}}*/
+// AcqIndexRel::Custom600Headers - Insert custom request headers /*{{{*/
+// ---------------------------------------------------------------------
+/* The only header we use is the last-modified header. */
+string pkgAcqIndexRel::Custom600Headers()
+{
+ string Final = _config->FindDir("Dir::State::lists");
+ Final += URItoFileName(Location->ReleaseURI());
+
+ struct stat Buf;
+ if (stat(Final.c_str(),&Buf) != 0)
+ return "\nIndex-File: true";
+
+ return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
+}
+ /*}}}*/
+// AcqIndexRel::Done - Item downloaded OK /*{{{*/
+// ---------------------------------------------------------------------
+/* The release file was not placed into the download directory then
+ a copy URI is generated and it is copied there otherwise the file
+ in the partial directory is moved into .. and the URI is finished. */
+void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5)
+{
+ Item::Done(Message,Size,MD5);
+
+ string FileName = LookupTag(Message,"Filename");
+ if (FileName.empty() == true)
+ {
+ Status = StatError;
+ ErrorText = "Method gave a blank filename";
+ return;
+ }
+
+ Complete = true;
+
+ // The files timestamp matches
+ if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ return;
+
+ // We have to copy it into place
+ if (FileName != DestFile)
+ {
+ Local = true;
+ Desc.URI = "copy:" + FileName;
+ QueueURI(Desc);
+ return;
+ }
+
+ // Done, move it into position
+ string FinalFile = _config->FindDir("Dir::State::lists");
+ FinalFile += URItoFileName(Location->ReleaseURI());
+ Rename(DestFile,FinalFile);
+}
+ /*}}}*/
+// AcqIndexRel::Describe - Describe the Item /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgAcqIndexRel::Describe()
+{
+ return Location->ReleaseURI();
+}
+ /*}}}*/
+// AcqIndexRel::Failed - Silence failure messages for missing rel files /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+{
+ // This is the retry counter
+ if (Cnf->LocalOnly == true ||
+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
+ {
+ Status = StatIdle;
+ Dequeue();
+ return;
+ }
+
+ Item::Failed(Message,Cnf);
+}
+ /*}}}*/
+
+// AcqArchive::AcqArchive - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* This just sets up the initial fetch environment and queues the first
+ possibilitiy */
+pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
+ pkgRecords *Recs,pkgCache::VerIterator const &Version,
+ string &StoreFilename) :
+ Item(Owner), Version(Version), Sources(Sources), Recs(Recs),
+ StoreFilename(StoreFilename), Vf(Version.FileList())
+{
+ Retries = _config->FindI("Acquire::Retries",0);
+
+ // Generate the final file name as: package_version_arch.deb
+ StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
+ QuoteString(Version.VerStr(),"_:") + '_' +
+ QuoteString(Version.Arch(),"_:.") + ".deb";
+
+ // Select a source
+ if (QueueNext() == false && _error->PendingError() == false)
+ _error->Error("I wasn't able to locate file for the %s package. "
+ "This might mean you need to manually fix this package.",
+ Version.ParentPkg().Name());