[yum-commits] Branch 'yum-3_2_X' - 3 commits - yum/i18n.py yum/misc.py yum/packages.py yum/rpmsack.py yum/sqlitesack.py
skvidal at osuosl.org
skvidal at osuosl.org
Thu Feb 18 04:11:24 UTC 2010
yum/i18n.py | 11 ++++++++++-
yum/misc.py | 4 +++-
yum/packages.py | 8 +++-----
yum/rpmsack.py | 11 +++++++++--
yum/sqlitesack.py | 9 ++++++---
5 files changed, 31 insertions(+), 12 deletions(-)
New commits:
commit c12ea1487dcd0181aba61c6d052a350117d65857
Merge: 376dc5a... 47203d8...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Feb 17 23:11:34 2010 -0500
Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
* 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
l10n: Updates to Italian (it) translation
l10n: Updates to French (fr) translation
l10n: Updates to Italian (it) translation
commit 376dc5a5853ebce8ec2179881f66a133ea76d916
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Feb 17 17:14:14 2010 -0500
- fix up more spots where we were converting the version flags wrongly
- add i18n.str_eq for doing equality checks against strings of dubious types and content
- fix a lot of bad provides checks - but only with versioned deps.
diff --git a/yum/i18n.py b/yum/i18n.py
index 6b9eab5..9889bf6 100755
--- a/yum/i18n.py
+++ b/yum/i18n.py
@@ -452,7 +452,16 @@ def to_str(obj):
obj = str(obj)
return obj
-
+def str_eq(a, b):
+ """ convert between unicode and not and compare them, w/o warning or being annoying"""
+ if isinstance(a, unicode) == isinstance(b, unicode):
+ if a == b: # stupid python...
+ return True
+ elif to_utf8(a) == to_utf8(b):
+ return True
+
+ return False
+
try:
'''
Setup the yum translation domain and make _() and P_() translation wrappers
diff --git a/yum/misc.py b/yum/misc.py
index 70ccb0a..66b0653 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -79,6 +79,8 @@ def unshare_data():
_re_compiled_glob_match = None
def re_glob(s):
""" Tests if a string is a shell wildcard. """
+ # TODO/FIXME maybe consider checking if it is a stringsType before going on - otherwise
+ # returning None
global _re_compiled_glob_match
if _re_compiled_glob_match is None:
_re_compiled_glob_match = re.compile('[*?]|\[.+\]').search
@@ -647,7 +649,7 @@ def string_to_prco_tuple(prcoString):
n, f, v = prco_split
# now we have 'n, f, v' where f and v could be None and None
- if f is not None:
+ if f is not None and f not in constants.LETTERFLAGS:
if f not in constants.SYMBOLFLAGS:
try:
f = flagToString(int(f))
diff --git a/yum/packages.py b/yum/packages.py
index d932bfe..c473ece 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -23,6 +23,7 @@ import rpm
import os
import os.path
import misc
+import i18n
import re
import fnmatch
import stat
@@ -414,8 +415,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:
+ if i18n.str_eq(reqn, n):
return 1
return 0
@@ -431,10 +431,7 @@ class RpmBase(object):
# find the named entry in pkgobj, do the comparsion
result = []
for (n, f, (e, v, r)) in self.returnPrco(prcotype):
- if isinstance(reqn, unicode) == isinstance(n, unicode):
- if reqn != n: # stupid python...
- continue
- elif misc.to_utf8(reqn) != misc.to_utf8(n):
+ if not i18n.str_eq(reqn, n):
continue
if f == '=':
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 57f696d..83b684e 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -285,7 +285,7 @@ class RPMDBPackageSack(PackageSackBase):
(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):
+ if misc.re_glob(n):
glob = True
ts = self.readOnlyTS()
commit 9d8ca40e8f5b7380f83890c87e032d917780f8c2
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Feb 17 15:21:07 2010 -0500
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 :(
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.
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
More information about the Yum-commits
mailing list