[yum-cvs] yum/yum yumRepo.py,1.30,1.31

Seth Vidal skvidal at linux.duke.edu
Sat Feb 3 21:48:06 UTC 2007


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

Modified Files:
	yumRepo.py 
Log Message:
check for the db file before getting the xml file from the repo



Index: yumRepo.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/yumRepo.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- yumRepo.py	3 Feb 2007 21:30:08 -0000	1.30
+++ yumRepo.py	3 Feb 2007 21:48:04 -0000	1.31
@@ -104,29 +104,54 @@
                     continue
 
             if item == 'metadata':
-                xml = repo.getPrimaryXML()
-                xmldata = repo.repoXML.getData('primary')
-                (ctype, csum) = xmldata.checksum
-                dobj = repo.cacheHandler.getPrimary(xml, csum)
+                # retrieve _db first, if it exists, and bunzip2 it
+                db_fn = repo.retrieveMD('primary_db')
+                if db_fn:
+                    db_un_fn = db_fn.replace('.bz2', '')
+                    misc.bunzipFile(db_fn, db_un_fn)
+                    dobj = repo.cacheHandler.open_database(db_un_fn)
+
+                else:
+                    xml = repo.getPrimaryXML()
+                    xmldata = repo.repoXML.getData('primary')
+                    (ctype, csum) = xmldata.checksum
+                    dobj = repo.cacheHandler.getPrimary(xml, csum)
+
                 if not cacheonly:
                     self.addDict(repo, item, dobj, callback)
                 del dobj
 
             elif item == 'filelists':
-                xml = repo.getFileListsXML()
-                xmldata = repo.repoXML.getData('filelists')
-                (ctype, csum) = xmldata.checksum
-                dobj = repo.cacheHandler.getFilelists(xml, csum)
+                db_fn = repo.retrieveMD('filelists_db')
+                if db_fn:
+                    db_un_fn = db_fn.replace('.bz2', '')
+                    misc.bunzipFile(db_fn, db_un_fn)
+                    dobj = repo.cacheHandler.open_database(db_un_fn)
+
+                else:
+                    xml = repo.getFileListsXML()
+                    xmldata = repo.repoXML.getData('filelists')
+                    (ctype, csum) = xmldata.checksum
+                    dobj = repo.cacheHandler.getFilelists(xml, csum)
+
                 if not cacheonly:
                     self.addDict(repo, item, dobj, callback)
                 del dobj
 
 
             elif item == 'otherdata':
-                xml = repo.getOtherXML()
-                xmldata = repo.repoXML.getData('other')
-                (ctype, csum) = xmldata.checksum
-                dobj = repo.cacheHandler.getOtherdata(xml, csum)
+                db_fn = repo.retrieveMD('other_db')
+                if db_fn:
+                    db_un_fn = db_fn.replace('.bz2', '')
+                    misc.bunzipFile(db_fn, db_un_fn)
+                    dobj = repo.cacheHandler.open_database(db_un_fn)
+
+                else:
+                    xml = repo.getOtherXML()
+                    xmldata = repo.repoXML.getData('other')
+                    (ctype, csum) = xmldata.checksum
+                    dobj = repo.cacheHandler.getOtherdata(xml, csum)
+                    
                 if not cacheonly:
                     self.addDict(repo, item, dobj, callback)
                 del dobj




More information about the Yum-cvs-commits mailing list