[yum-commits] Branch 'yum-3_2_X' - 5 commits - yum/__init__.py yum/rpmsack.py yum/sqlitesack.py
James Antill
james at osuosl.org
Wed Dec 15 18:28:30 UTC 2010
yum/__init__.py | 37 ++++++++++++++++++++-----------------
yum/rpmsack.py | 4 ++++
yum/sqlitesack.py | 4 ++++
3 files changed, 28 insertions(+), 17 deletions(-)
New commits:
commit 59bf0888d765a18065a7be194fa07d03c4be78d0
Author: James Antill <james at and.org>
Date: Wed Dec 15 13:19:47 2010 -0500
Do the obvious fnmatch => regex change, for searchPackageProvides
diff --git a/yum/__init__.py b/yum/__init__.py
index 47cbb9d..eb34a19 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2644,6 +2644,7 @@ class YumBase(depsolve.Depsolve):
else:
arg_taglist = taglist_provonly
+ arg_regex = re.compile(fnmatch.translate(arg))
for po in where:
searchlist = []
tmpvalues = []
@@ -2657,7 +2658,7 @@ class YumBase(depsolve.Depsolve):
searchlist.append(tagdata)
for item in searchlist:
- if fnmatch.fnmatch(item, arg):
+ if arg_regex.match(item):
tmpvalues.append(item)
if len(tmpvalues) > 0:
commit de43e5dfd2eea188bd6872cb48865c09022eb1e2
Author: James Antill <james at and.org>
Date: Wed Dec 15 13:16:07 2010 -0500
Merge arg. checks in searchPackageProvides
diff --git a/yum/__init__.py b/yum/__init__.py
index c5a0f67..47cbb9d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2550,10 +2550,7 @@ class YumBase(depsolve.Depsolve):
def searchPackageProvides(self, args, callback=None,
callback_has_matchfor=False):
-
- matches = {}
- for arg in args:
- arg = to_unicode(arg)
+ def _arg_data(arg):
if not misc.re_glob(arg):
isglob = False
if arg[0] != '/':
@@ -2563,7 +2560,14 @@ class YumBase(depsolve.Depsolve):
else:
isglob = True
canBeFile = misc.re_filename(arg)
-
+
+ return isglob, canBeFile
+
+ matches = {}
+ for arg in args:
+ arg = to_unicode(arg)
+ isglob, canBeFile = _arg_data(arg)
+
if not isglob:
usedDepString = True
where = self.returnPackagesByDep(arg)
@@ -2611,16 +2615,9 @@ class YumBase(depsolve.Depsolve):
# installed rpms, too
taglist = ['filelist', 'dirnames', 'provides_names']
+ taglist_provonly = ['provides_names']
for arg in args:
- if not misc.re_glob(arg):
- isglob = False
- if arg[0] != '/':
- canBeFile = False
- else:
- canBeFile = True
- else:
- isglob = True
- canBeFile = True
+ isglob, canBeFile = _arg_data(arg)
if not isglob:
where = self.returnInstalledPackagesByDep(arg)
@@ -2641,15 +2638,16 @@ class YumBase(depsolve.Depsolve):
else:
usedDepString = False
where = self.rpmdb
-
- if not arg or arg[0] not in ('*', '?', '/'):
- # Can't be a file/dir. so don't check those.
- taglist = ['provides_names']
+
+ if canBeFile:
+ arg_taglist = taglist
+ else:
+ arg_taglist = taglist_provonly
for po in where:
searchlist = []
tmpvalues = []
- for tag in taglist:
+ for tag in arg_taglist:
tagdata = getattr(po, tag)
if tagdata is None:
continue
commit 28e2801ebe66e465fb8f395aeb8965f2f475e8bc
Author: James Antill <james at and.org>
Date: Wed Dec 15 12:32:40 2010 -0500
Add a comment about MIRE_GLOB and basenames not working FYI.
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 2302cf6..0982a7c 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -409,6 +409,10 @@ class RPMDBPackageSack(PackageSackBase):
name = os.path.normpath(name)
mi = ts.dbMatch('basenames', name)
+ # Note that globs can't be done. As of 4.8.1:
+ # mi.pattern('basenames', rpm.RPMMIRE_GLOB, name)
+ # ...produces no results.
+
for hdr in mi:
if hdr['name'] == 'gpg-pubkey':
continue
commit b3d719bce10643b63107d7a6c964c88e78937cd6
Author: James Antill <james at and.org>
Date: Wed Dec 15 12:25:37 2010 -0500
Speedup provides "perl(*)" etc. by 40% ish. -- No need to check files.
diff --git a/yum/__init__.py b/yum/__init__.py
index 1b36994..c5a0f67 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2642,6 +2642,10 @@ class YumBase(depsolve.Depsolve):
usedDepString = False
where = self.rpmdb
+ if not arg or arg[0] not in ('*', '?', '/'):
+ # Can't be a file/dir. so don't check those.
+ taglist = ['provides_names']
+
for po in where:
searchlist = []
tmpvalues = []
commit a4cf0cc98a0c5a60a7ef68ed86d6732218b6b5f9
Author: James Antill <james at and.org>
Date: Mon Dec 13 09:20:21 2010 -0500
Don't check the pkg nums for each lookup, libguestfs fix. BZ 662347.
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index ed681fb..8a6f6f3 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -932,10 +932,14 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
# Check to make sure the DB data matches, this should always pass but
# we've had weird errors. So check it for a bit.
for repo in self.filelistsdb:
+ # Only check each repo. once ... the libguestfs check :).
+ if hasattr(repo, '_checked_filelists_pkgs'):
+ continue
pri_pkgs = self._sql_MD_pkg_num('primary', repo)
fil_pkgs = self._sql_MD_pkg_num('filelists', repo)
if pri_pkgs != fil_pkgs:
raise Errors.RepoError
+ repo._checked_filelists_pkgs = True
sql_params = []
dirname_check = ""
More information about the Yum-commits
mailing list