[yum-cvs] yum/yum __init__.py,1.91,1.92 sqlitesack.py,1.11,1.12
Seth Vidal
skvidal at login.linux.duke.edu
Fri Mar 4 18:29:37 UTC 2005
Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv23326/yum
Modified Files:
__init__.py sqlitesack.py
Log Message:
- made excludeArches in repomd pkgsack and sqlite pkgsack.
- makes more sense to be in that class
- sql select is a bit faster than iterating all the packages and comparing
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- __init__.py 4 Mar 2005 08:39:45 -0000 1.91
+++ __init__.py 4 Mar 2005 18:29:35 -0000 1.92
@@ -344,13 +344,8 @@
self.log(3, 'Excluding Incompatible Archs')
if not archlist:
- #archlist = ['src'] # source rpms are allowed
archlist.extend(rpmUtils.arch.getArchList())
-
- for po in self.pkgSack.returnPackages():
- if po.arch not in archlist:
- self.log(7, 'Arch Excluding %s' % po)
- self.pkgSack.delPackage(po)
+ self.pkgSack.excludeArchs(archlist)
self.log(3, 'Finished')
Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sqlitesack.py 3 Mar 2005 12:14:01 -0000 1.11
+++ sqlitesack.py 4 Mar 2005 18:29:35 -0000 1.12
@@ -398,3 +398,19 @@
continue
returnList.append(self.pc(self.db2class(x),rep))
return returnList
+
+ def excludeArchs(self, archlist):
+ """excludes incompatible arches - archlist is a list of compat arches"""
+ tmpstring = "select * from packages WHERE "
+ for arch in archlist:
+ tmpstring = tmpstring + 'arch != "%s" AND ' % arch
+
+ last = tmpstring.rfind('AND') # clip that last AND
+ querystring = tmpstring[:last]
+ for (rep, cache) in self.primarydb.items():
+ cur = cache.cursor()
+ cur.execute(querystring)
+ for x in cur.fetchall():
+ obj = self.pc(self.db2class(x), rep)
+ self.delPackage(obj)
+
More information about the Yum-cvs-commits
mailing list