From 08cfc005c3529d4ff63d229b05d75c6ceb88225b Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:54:52 +0000 Subject: [PATCH] Retries and tweaked dselect script Author: jgg Date: 1999-10-17 20:58:36 GMT Retries and tweaked dselect script --- apt-pkg/acquire-item.cc | 24 +++++++++++++++++++++++- apt-pkg/acquire-item.h | 4 +++- debian/changelog | 4 ++++ dselect/update | 7 +++++-- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7639dd59..2bae109f 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1,6 +1,6 @@ // -*- 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.39 1999/10/17 20:58:36 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -567,6 +567,8 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5, unsigned long Size,string Dsc,string ShortDesc) : Item(Owner), Md5Hash(MD5) { + Retries = _config->FindI("Acquire::Retries",0); + DestFile = flNotDir(URI); // Create the item @@ -645,3 +647,23 @@ void pkgAcqFile::Done(string Message,unsigned long Size,string MD5) } } /*}}}*/ +// 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); +} + /*}}}*/ diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index d07a49bb..fd74280b 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-item.h,v 1.21 1999/09/01 07:01:15 jgg Exp $ +// $Id: acquire-item.h,v 1.22 1999/10/17 20:58:36 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -151,10 +151,12 @@ class pkgAcqFile : public pkgAcquire::Item { pkgAcquire::ItemDesc Desc; string Md5Hash; + unsigned int Retries; public: // Specialized action members + virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Done(string Message,unsigned long Size,string Md5Hash); virtual string MD5Sum() {return Md5Hash;}; virtual string DescURI() {return Desc.URI;}; diff --git a/debian/changelog b/debian/changelog index 59069d61..b4e5991b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,10 @@ apt (0.3.13.1) unstable; urgency=low Closes: #46639, #47498 * mipsel arch Closes: #47614 * Beautified URI printing to not include passwords Closes: #46857 + * Fixed little problem with --no-download Closes: #47557 + * Tweaked Dselect 'update' script to re-gen the avail file even in the + event of a failure Closes: #47112 + * Retries for source archives too Closes: #47529 -- Jason Gunthorpe Fri, 3 Sep 1999 09:04:28 -0700 diff --git a/dselect/update b/dselect/update index 87dc21aa..90464842 100755 --- a/dselect/update +++ b/dselect/update @@ -17,7 +17,10 @@ eval $RES # It looks slightly ugly to have a double / in the dpkg output CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"` -$APTGET $OPTS update +set +e +FAILED=0 +$APTGET $OPTS update || FAILED=1 +set -e echo "Merging Available information" rm -f /var/cache/apt/available @@ -29,4 +32,4 @@ if [ $PROMPT = "yes" ]; then echo "Press enter to continue." && read RES; fi -exit 0 +exit $FAILED -- 2.20.1