[yum-cvs] yum/yum repos.py,1.78,1.79

Seth Vidal skvidal at login.linux.duke.edu
Mon Jun 27 06:57:14 UTC 2005


Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv12417/yum

Modified Files:
	repos.py 
Log Message:

if repomd.xml is mangled, try another mirror for unmangled one. This deals,
correctly with horribly broken http servers that redirect a 404 error to an
error page and issue a 200 *Thwack*


Index: repos.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/repos.py,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- repos.py	20 Jun 2005 00:10:10 -0000	1.78
+++ repos.py	27 Jun 2005 06:57:12 -0000	1.79
@@ -20,6 +20,7 @@
 import re
 import fnmatch
 import urlparse
+import types
 
 import Errors
 from urlgrabber.grabber import URLGrabber
@@ -638,21 +639,37 @@
             else:
                 result = local
         else:
+            checkfunc = (self._checkRepoXML, (), {})
             try:
-                result = self.get(relative=remote, local=local,
-                                  copy_local=1, text=text, reget=None, 
+                result = self.get(relative=remote,
+                                  local=local,
+                                  copy_local=1,
+                                  text=text,
+                                  reget=None,
+                                  checkfunc=checkfunc,
                                   cache=self.http_caching == 'all',
                                   )
 
             except URLGrabError, e:
                 raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e)
-
+        
         try:
             self.repoXML = repoMDObject.RepoMD(self.id, result)
         except mdErrors.RepoMDError, e:
             raise Errors.RepoError, 'Error importing repomd.xml from %s: %s' % (self, e)
+            
+    def _checkRepoXML(self, fo):
+        if type(fo) is types.InstanceType:
+            filepath = fo.filename
+        else:
+            filepath = fo
+        
+        try:
+            foo = repoMDObject.RepoMD(self.id, filepath)
+        except mdErrors.RepoMDError, e:
+            raise URLGrabError(-1, 'Error importing repomd.xml for %s: %s' % (self, e))
+
 
-    
     def _checkMD(self, fn, mdtype):
         """check the metadata type against its checksum"""
         




More information about the Yum-cvs-commits mailing list