]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
* merged ddtp support
[apt.git] / apt-pkg / acquire-item.cc
index b2f896627f23e44433c4214c1ab562e4b32efa68..e0e0611f04e94dc527be17c21ecef7cd5c28f164 100644 (file)
@@ -142,20 +142,21 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
 {
    Decompression = false;
    Erase = false;
 {
    Decompression = false;
    Erase = false;
-   
+
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
 
    if(comprExt.empty()) 
    {
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
 
    if(comprExt.empty()) 
    {
-      // autoselect 
-      if(FileExists("/usr/bin/bzip2"))
-        Desc.URI = URI + ".bz2"; 
-      else
-        Desc.URI = URI + ".gz"; 
+      // autoselect the compression method
+      if(FileExists("/usr/bin/bzip2")) 
+        CompressionExtension = ".bz2";
+      else 
+        CompressionExtension = ".gz";
    } else {
    } else {
-      Desc.URI = URI + comprExt; 
+      CompressionExtension = comprExt;
    }
    }
+   Desc.URI = URI + CompressionExtension; 
 
    Desc.Description = URIDesc;
    Desc.Owner = this;
 
    Desc.Description = URIDesc;
    Desc.Owner = this;
@@ -307,6 +308,35 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
    Mode = decompProg;
 }
 
    Mode = decompProg;
 }
 
+// AcqIndexTrans::pkgAcqIndexTrans - Constructor                       /*{{{*/
+// ---------------------------------------------------------------------
+/* The Translation file is added to the queue */
+pkgAcqIndexTrans::pkgAcqIndexTrans(pkgAcquire *Owner,
+                           string URI,string URIDesc,string ShortDesc) :
+                      pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, "", "")
+{
+}
+
+                                                                       /*}}}*/
+// AcqIndexTrans::Failed - Silence failure messages for missing files  /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcqIndexTrans::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+{
+   if (Cnf->LocalOnly == true || 
+       StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
+   {      
+      // Ignore this
+      Status = StatDone;
+      Complete = false;
+      Dequeue();
+      return;
+   }
+   
+   Item::Failed(Message,Cnf);
+}
+                                                                       /*}}}*/
+
 pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
                             string URI,string URIDesc,string ShortDesc,
                             string MetaIndexURI, string MetaIndexURIDesc,
 pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
                             string URI,string URIDesc,string ShortDesc,
                             string MetaIndexURI, string MetaIndexURIDesc,
@@ -400,6 +430,13 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
    unlink(Final.c_str());
 
    string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
    unlink(Final.c_str());
 
+   // if we get a timeout if fail
+   if(LookupTag(Message,"FailReason") == "Timeout" || 
+      LookupTag(Message,"FailReason") == "TmpResolveFailure") {
+      Item::Failed(Message,Cnf);
+      return;
+   }
+
    // queue a pkgAcqMetaIndex with no sigfile
    new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
                       "", IndexTargets, MetaIndexParser);
    // queue a pkgAcqMetaIndex with no sigfile
    new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
                       "", IndexTargets, MetaIndexParser);
@@ -898,7 +935,8 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash,
       {
         Status = StatError;
         ErrorText = _("MD5Sum mismatch");
       {
         Status = StatError;
         ErrorText = _("MD5Sum mismatch");
-        Rename(DestFile,DestFile + ".FAILED");
+        if(FileExists(DestFile))
+           Rename(DestFile,DestFile + ".FAILED");
         return;
       }
    }
         return;
       }
    }