[yum-cvs] yum/yum depsolve.py,1.80,1.81 sqlitesack.py,1.33,1.34
Seth Vidal
skvidal at linux.duke.edu
Thu May 25 22:06:21 UTC 2006
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv6175/yum
Modified Files:
depsolve.py sqlitesack.py
Log Message:
collection of changes to speed up whatProvides() using the sqlite db's
Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- depsolve.py 3 Mar 2006 03:48:48 -0000 1.80
+++ depsolve.py 25 May 2006 22:06:19 -0000 1.81
@@ -73,10 +73,10 @@
self.doSackFilelistPopulate()
pkgs = self.pkgSack.searchProvides(name)
+
+
if flags == 0:
flags = None
-
-
if type(version) in (types.StringType, types.NoneType):
(r_e, r_v, r_r) = rpmUtils.miscutils.stringToVersion(version)
elif type(version) in (types.TupleType, types.ListType): # would this ever be a ListType?
Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- sqlitesack.py 9 May 2006 18:08:18 -0000 1.33
+++ sqlitesack.py 25 May 2006 22:06:19 -0000 1.34
@@ -22,6 +22,7 @@
import os
import os.path
import types
+import re
import repos
import yumRepo
from packages import YumAvailablePackage
@@ -301,7 +302,7 @@
# If it's not a provides or a filename, we are done
- if (prcotype != "provides" or name.find('/') != 0):
+ if prcotype != "provides" or name[0] != '/':
return results
# If it is a filename, search the primary.xml file info
@@ -319,28 +320,56 @@
pkg.files = {name: res['type']}
results.append(self.pc(pkg,rep))
+ matched = 0
+ globs = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$']
+ for glob in globs:
+ globc = re.compile(glob)
+ if globc.match(name):
+ matched = 1
+
+ if matched: # if its in the primary.xml files then skip the other check
+ return results
+
# If it is a filename, search the files.xml file info
for (rep,cache) in self.filelistsdb.items():
cur = cache.cursor()
(dirname,filename) = os.path.split(name)
- cur.execute("select packages.pkgId as pkgId,\
- filelist.dirname as dirname,\
- filelist.filetypes as filetypes,\
- filelist.filenames as filenames \
- from filelist,packages where dirname = %s AND filelist.pkgKey = packages.pkgKey" , (dirname))
+ if name.find('%') == -1: # no %'s in the thing safe to LIKE
+ cur.execute("select packages.pkgId as pkgId,\
+ filelist.dirname as dirname,\
+ filelist.filetypes as filetypes,\
+ filelist.filenames as filenames \
+ from packages,filelist where \
+ (filelist.dirname LIKE '%%%s%%' \
+ OR (filelist.dirname LIKE '%%%s%%' AND\
+ filelist.filenames LIKE '%%%s%%'))\
+ AND (filelist.pkgKey = packages.pkgKey)" % (name,dir,filename))
+ else:
+ cur.execute("select packages.pkgId as pkgId,\
+ filelist.dirname as dirname,\
+ filelist.filetypes as filetypes,\
+ filelist.filenames as filenames \
+ from filelist,packages where dirname = %s AND filelist.pkgKey = packages.pkgKey" , (dirname))
+
files = cur.fetchall()
+
for res in files:
if (self.excludes[rep].has_key(res['pkgId'])):
continue
-
+
+ quicklookup = {}
+ for fn in decodefilenamelist(res['filenames']):
+ quicklookup[fn] = 1
+
# If it matches the dirname, that doesnt mean it matches
# the filename, check if it does
- if filename and \
- not filename in res['filenames'].split('/'):
+ if filename and not quicklookup.has_key(filename):
continue
+
# If it matches we only know the packageId
pkg = self.getPackageDetails(res['pkgId'])
results.append(self.pc(pkg,rep))
+
return results
def searchProvides(self, name):
More information about the Yum-cvs-commits
mailing list