diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 20 | ||||
-rw-r--r-- | apt-pkg/acquire-method.cc | 25 | ||||
-rw-r--r-- | apt-pkg/acquire-method.h | 15 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 5 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 3 | ||||
-rw-r--r-- | apt-pkg/acquire.h | 3 |
6 files changed, 41 insertions, 30 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index cfd0e5d02..db334de98 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.13 1998/11/22 03:20:30 jgg Exp $ +// $Id: acquire-item.cc,v 1.14 1998/11/29 01:24:14 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -56,6 +56,16 @@ void pkgAcquire::Item::Failed(string Message) Status = StatIdle; if (QueueCounter <= 1) { + /* This indicates that the file is not available right now but might + be sometime later. If we do a retry cycle then this should be + retried */ + if (StringToBool(LookupTag(Message,"Transient-Failure"),false) == true) + { + Status = StatIdle; + Owner->Dequeue(this); + return; + } + ErrorText = LookupTag(Message,"Message"); Status = StatError; Owner->Dequeue(this); @@ -147,9 +157,9 @@ string pkgAcqIndex::Custom600Headers() struct stat Buf; if (stat(Final.c_str(),&Buf) != 0) - return string(); + return "\nIndex-File: true"; - return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); + return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ // AcqIndex::Done - Finished a fetch /*{{{*/ @@ -267,9 +277,9 @@ string pkgAcqIndexRel::Custom600Headers() struct stat Buf; if (stat(Final.c_str(),&Buf) != 0) - return string(); + return "\nIndex-File: true"; - return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); + return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ // AcqIndexRel::Done - Item downloaded OK /*{{{*/ diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 75ddee14a..bf2de5448 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-method.cc,v 1.8 1998/11/14 01:39:41 jgg Exp $ +// $Id: acquire-method.cc,v 1.9 1998/11/29 01:24:15 jgg Exp $ /* ###################################################################### Acquire Method @@ -33,9 +33,6 @@ pkgAcqMethod::pkgAcqMethod(const char *Ver,unsigned long Flags) if ((Flags & SingleInstance) == SingleInstance) strcat(End,"Single-Instance: true\n"); - if ((Flags & PreScan) == PreScan) - strcat(End,"Pre-Scan: true\n"); - if ((Flags & Pipeline) == Pipeline) strcat(End,"Pipeline: true\n"); @@ -57,26 +54,26 @@ pkgAcqMethod::pkgAcqMethod(const char *Ver,unsigned long Flags) // AcqMethod::Fail - A fetch has failed /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqMethod::Fail() +void pkgAcqMethod::Fail(bool Transient) { string Err = "Undetermined Error"; if (_error->empty() == false) _error->PopMessage(Err); _error->Discard(); - Fail(Err); + Fail(Err,Transient); } /*}}}*/ // AcqMethod::Fail - A fetch has failed /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqMethod::Fail(string Err) +void pkgAcqMethod::Fail(string Err,bool Transient) { char S[1024]; if (Queue != 0) { snprintf(S,sizeof(S),"400 URI Failure\nURI: %s\n" - "Message: %s\n\n",Queue->Uri.c_str(),Err.c_str()); - + "Message: %s\n",Queue->Uri.c_str(),Err.c_str()); + // Dequeue FetchItem *Tmp = Queue; Queue = Queue->Next; @@ -84,8 +81,14 @@ void pkgAcqMethod::Fail(string Err) } else snprintf(S,sizeof(S),"400 URI Failure\nURI: <UNKNOWN>\n" - "Message: %s\n\n",Err.c_str()); + "Message: %s\n",Err.c_str()); + // Set the transient flag + if (Transient == true) + strcat(S,"Transient-Failure: true\n\n"); + else + strcat(S,"\n"); + if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S)) exit(100); } @@ -265,7 +268,7 @@ int pkgAcqMethod::Run(bool Single) Tmp->DestFile = LookupTag(Message,"FileName"); if (StrToTime(LookupTag(Message,"Last-Modified"),Tmp->LastModified) == false) Tmp->LastModified = 0; - + Tmp->IndexFile = StringToBool(LookupTag(Message,"Index-File"),false); Tmp->Next = 0; // Append it to the list diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 69ed279e2..9e4ac65b6 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-method.h,v 1.3 1998/11/14 01:39:43 jgg Exp $ +// $Id: acquire-method.h,v 1.4 1998/11/29 01:24:16 jgg Exp $ /* ###################################################################### Acquire Method - Method helper class + functions @@ -31,6 +31,7 @@ class pkgAcqMethod string Uri; string DestFile; time_t LastModified; + bool IndexFile; }; struct FetchResult @@ -53,16 +54,16 @@ class pkgAcqMethod virtual bool Fetch(FetchItem *Item) {return true;}; // Outgoing messages - void Fail(); - void Fail(string Why); + void Fail(bool Transient = false); + void Fail(string Why, bool Transient = false); void URIStart(FetchResult &Res); void URIDone(FetchResult &Res,FetchResult *Alt = 0); public: - - enum CnfFlags {SingleInstance = (1<<0), PreScan = (1<<1), - Pipeline = (1<<2), SendConfig = (1<<3), - LocalOnly = (1<<4)}; + + enum CnfFlags {SingleInstance = (1<<0), + Pipeline = (1<<1), SendConfig = (1<<2), + LocalOnly = (1<<3)}; void Log(const char *Format,...); void Status(const char *Format,...); diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index fa349a56a..3e76b3d9d 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-worker.cc,v 1.12 1998/11/14 01:39:44 jgg Exp $ +// $Id: acquire-worker.cc,v 1.13 1998/11/29 01:24:18 jgg Exp $ /* ###################################################################### Acquire Worker @@ -304,7 +304,6 @@ bool pkgAcquire::Worker::Capabilities(string Message) Config->Version = LookupTag(Message,"Version"); Config->SingleInstance = StringToBool(LookupTag(Message,"Single-Instance"),false); - Config->PreScan = StringToBool(LookupTag(Message,"Pre-Scan"),false); Config->Pipeline = StringToBool(LookupTag(Message,"Pipeline"),false); Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false); Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false); @@ -314,7 +313,7 @@ bool pkgAcquire::Worker::Capabilities(string Message) { clog << "Configured access method " << Config->Access << endl; clog << "Version:" << Config->Version << " SingleInstance:" << - Config->SingleInstance << " PreScan: " << Config->PreScan << + Config->SingleInstance << " Pipeline:" << Config->Pipeline << " SendConfig:" << Config->SendConfig << endl; } diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index f9691df9c..54de9916e 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.cc,v 1.18 1998/11/23 07:32:19 jgg Exp $ +// $Id: acquire.cc,v 1.19 1998/11/29 01:24:19 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -420,7 +420,6 @@ unsigned long pkgAcquire::FetchNeeded() pkgAcquire::MethodConfig::MethodConfig() { SingleInstance = false; - PreScan = false; Pipeline = false; SendConfig = false; LocalOnly = false; diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 8bdcb8bb2..1526a1f7a 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.h,v 1.14 1998/11/23 07:32:20 jgg Exp $ +// $Id: acquire.h,v 1.15 1998/11/29 01:24:20 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -179,7 +179,6 @@ struct pkgAcquire::MethodConfig string Version; bool SingleInstance; - bool PreScan; bool Pipeline; bool SendConfig; bool LocalOnly; |