]> git.saurik.com Git - apt.git/commitdiff
Minor Acquire cleanup
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:47 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:47 +0000 (16:51 +0000)
Author: jgg
Date: 1998-11-29 01:24:14 GMT
Minor Acquire cleanup

apt-pkg/acquire-item.cc
apt-pkg/acquire-method.cc
apt-pkg/acquire-method.h
apt-pkg/acquire-worker.cc
apt-pkg/acquire.cc
apt-pkg/acquire.h

index cfd0e5d028659ea997b62e5915de034cd25bc27a..db334de98fd38f8ebc570301d879ea0269ab9ee4 100644 (file)
@@ -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                              /*{{{*/
index 75ddee14af86dc4dd18edcb515907d1a177702ff..bf2de54483290018733c9980438f6f2a229667eb 100644 (file)
@@ -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
index 69ed279e2951494ddae8e3e1021dbf81e1420c64..9e4ac65b613110152f4ed57abd7550314d21da0d 100644 (file)
@@ -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,...);
index fa349a56aa7fbe8839f85da0c05333a389f44888..3e76b3d9db5563ceb4f943091ea1acee9d9a3393 100644 (file)
@@ -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;
    }
index f9691df9c4c27e1691a6ae49e92fd891093c32f3..54de9916eca61c8a755978f4d4ff39d76a3f38d7 100644 (file)
@@ -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;
index 8bdcb8bb2f518297123f65374a4320f952bb393a..1526a1f7a28668cc4b4fd91dbef8b533b4868023 100644 (file)
@@ -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;