[yum-cvs] yum/yum rpmsack.py,1.23,1.24

Seth Vidal skvidal at linux.duke.edu
Sun Sep 3 02:50:07 UTC 2006


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

Modified Files:
	rpmsack.py 
Log Message:

make sure every package object returned from the rpmsack has an idx
attribute


Index: rpmsack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/rpmsack.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- rpmsack.py	2 Sep 2006 07:47:27 -0000	1.23
+++ rpmsack.py	3 Sep 2006 02:50:05 -0000	1.24
@@ -80,7 +80,7 @@
         mi = self.ts.dbMatch()
         mi.pattern(table[0], rpm.RPMMIRE_GLOB, name)
         for hdr in mi:
-            pkg = YumInstalledPackage(hdr)
+            pkg = self.makePackageObject(hdr, mi.instance())
             if not result.has_key(pkg.pkgid):
                 result[pkg.pkgid] = pkg
 
@@ -100,7 +100,7 @@
         
         mi = self.ts.dbMatch('basenames', name)
         for hdr in mi:
-            pkg = YumInstalledPackage(hdr)
+            pkg = self.makePackageObject(hdr, mi.instance())
             if not result.has_key(pkg.pkgid):
                 result[pkg.pkgid] = pkg
         del mi
@@ -112,7 +112,7 @@
         table = self.dep_table[prcotype]
         mi = self.ts.dbMatch(table[0], name)
         for hdr in mi:
-            po = YumInstalledPackage(hdr)
+            po = self.makePackageObject(hdr, mi.instance())
             prcotup = (name, None, (None, None, None))
             if po.checkPrco(prcotype, prcotup):
                 if not result.has_key(po.pkgid):
@@ -252,10 +252,16 @@
 
     # Helper functions
 
+    def makePackageObject(self, hdr, index):
+        
+        po = YumInstalledPackage(hdr)
+        po.idx = index
+        return po
+        
     def mi2list(self, mi):
         returnList = []
         for hdr in mi:
-            returnList.append(YumInstalledPackage(hdr))
+            returnList.append(self.makePackageObject(hdr, mi.instance()))
         return returnList
 
     def hdrByindex(self, index):
@@ -269,10 +275,7 @@
         all = []
         for idx in indexlist:
             hdr  = self.hdrByindex(idx)
-            po = YumInstalledPackage(hdr)
-            # store our index in the po
-            po.idx = idx
-            all.append(po)
+            all.append(self.makePackageObject(hdr, idx))
         
         return all
 




More information about the Yum-cvs-commits mailing list