[Yum-devel] [PATCH 1/2] if we're searching for globs (like from repoquery) we have to take whatever we get from the sql results b/c we can't rangecheck globs :(
Seth Vidal
skvidal at fedoraproject.org
Wed Feb 17 22:18:03 UTC 2010
also convert the items coming out of the provides to unicode before comparing them
b/c frequently they can't convert on their own
boo.
---
yum/packages.py | 1 +
yum/rpmsack.py | 11 +++++++++--
yum/sqlitesack.py | 9 ++++++---
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/yum/packages.py b/yum/packages.py
index ba10136..d932bfe 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -414,6 +414,7 @@ class RpmBase(object):
return self.inPrcoRange(prcotype, prcotuple)
else:
for (n, f, (e, v, r)) in self.returnPrco(prcotype):
+ n = misc.to_unicode(n)
if reqn == n:
return 1
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 4ab20e9..57f696d 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -283,7 +283,11 @@ class RPMDBPackageSack(PackageSackBase):
if result is not None:
return result
(n,f,(e,v,r)) = misc.string_to_prco_tuple(name)
+ glob = False
+ if misc.re_glob(n) or misc.re_glob(e) or misc.re_glob(r), or misc.re_glob(v):
+ glob = True
+
ts = self.readOnlyTS()
result = {}
tag = self.DEP_TABLE[prcotype][0]
@@ -292,8 +296,11 @@ class RPMDBPackageSack(PackageSackBase):
if hdr['name'] == 'gpg-pubkey':
continue
po = self._makePackageObject(hdr, mi.instance())
- if po.checkPrco(prcotype, (n, f, (e,v,r))):
- result[po.pkgid] = po
+ if not glob:
+ if po.checkPrco(prcotype, (n, f, (e,v,r))):
+ result[po.pkgid] = po
+ else:
+ result[po.pkgid] = po
del mi
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 6b9acfc..1d6c764 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1296,10 +1296,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
# file dep add all matches to the results
results.append(po)
continue
-
- if po.checkPrco(prcotype, (n, f, (e,v,r))):
+
+ if not glob:
+ if po.checkPrco(prcotype, (n, f, (e,v,r))):
+ results.append(po)
+ else:
+ # if it is a glob we can't really get any closer to checking it
results.append(po)
-
# If it's not a provides or a filename, we are done
if prcotype != "provides":
return results
--
1.6.6
More information about the Yum-devel
mailing list