[yum-cvs] yum/repomd repoMDObject.py,1.3,1.4

Seth Vidal skvidal at linux.duke.edu
Wed May 24 23:21:50 UTC 2006


Update of /home/groups/yum/cvs/yum/repomd
In directory login1.linux.duke.edu:/tmp/cvs-serv12855/repomd

Modified Files:
	repoMDObject.py 
Log Message:

- make arbitrary metadata retrieval more trivial
- renames methods from _retrieveMD to retrieveMD
-            and  _checkMD to checkMD
- simplify both functions
fix for base and href


Index: repoMDObject.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/repomd/repoMDObject.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- repoMDObject.py	24 May 2006 21:24:43 -0000	1.3
+++ repoMDObject.py	24 May 2006 23:21:48 -0000	1.4
@@ -28,7 +28,7 @@
     """represents anything beneath a <data> tag"""
     def __init__(self, elem):
         self.type = elem.attrib.get('type')
-        self.location = ""
+        self.location = (None, None)
         self.checksums = [] # type,value
         self.openchecksums = [] # type,value
         self.timestamp = None
@@ -40,7 +40,9 @@
         for child in elem:
             child_name = ns_cleanup(child.tag)
             if child_name == 'location':
-                self.location = child.attrib.get('href')
+                relative = child.attrib.get('href')
+                base = child.attrib.get('base')
+                self.location = (base, relative)
             
             elif child_name == 'checksum':
                 csum_value = child.text
@@ -85,13 +87,19 @@
         """return list of metadata file types available"""
         return self.repoData.keys()
     
+    def getData(self, type):
+        if self.repoData.has_key(type):
+            return self.repoData[type]
+        else:
+            raise RepoMDError, "Error: requested datatype %s not available"
+            
     def dump(self):
         """dump fun output"""
         
         for ft in self.fileTypes():
             thisdata = self.repoData[ft]
             print 'datatype: %s' % thisdata.type
-            print 'location: %s' % thisdata.location
+            print 'location: %s %s' % thisdata.location
             print 'timestamp: %s' % thisdata.timestamp
             print 'checksums:'
             for (type, value) in thisdata.checksums:




More information about the Yum-cvs-commits mailing list