// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.cc,v 1.38 1999/10/17 07:30:23 jgg Exp $
+// $Id: acquire-item.cc,v 1.40 1999/10/31 06:32:27 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
unsigned long Size,string Dsc,string ShortDesc) :
Item(Owner), Md5Hash(MD5)
{
+ Retries = _config->FindI("Acquire::Retries",0);
+
DestFile = flNotDir(URI);
// Create the item
return;
}
+ // Erase the file if it is a symlink so we can overwrite it
+ struct stat St;
+ if (lstat(DestFile.c_str(),&St) == 0)
+ {
+ if (S_ISLNK(St.st_mode) != 0)
+ unlink(DestFile.c_str());
+ }
+
+ // Symlink the file
if (symlink(FileName.c_str(),DestFile.c_str()) != 0)
{
- ErrorText = "Link to " + DestFile + "failure ";
+ ErrorText = "Link to " + DestFile + " failure ";
Status = StatError;
Complete = false;
}
}
}
/*}}}*/
+// AcqFile::Failed - Failure handler /*{{{*/
+// ---------------------------------------------------------------------
+/* Here we try other sources */
+void pkgAcqFile::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+{
+ ErrorText = LookupTag(Message,"Message");
+
+ // This is the retry counter
+ if (Retries != 0 &&
+ Cnf->LocalOnly == false &&
+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
+ {
+ Retries--;
+ QueueURI(Desc);
+ return;
+ }
+
+ Item::Failed(Message,Cnf);
+}
+ /*}}}*/