[yum-git] Branch 'yum-3_2_X' - 2 commits - cli.py yum/packages.py
James Antill
james at linux.duke.edu
Wed Jun 11 16:36:49 UTC 2008
cli.py | 4 ++--
yum/packages.py | 20 +++++++++++++++++---
2 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit 790e42b6d5109b3dcb33c5b6861b7f04d95d22bb
Author: James Antill <james at and.org>
Date: Wed Jun 11 12:34:46 2008 -0400
Try and fix bug#450826
diff --git a/cli.py b/cli.py
index ff24ac6..cb16e76 100644
--- a/cli.py
+++ b/cli.py
@@ -45,7 +45,7 @@ from yum.rpmtrans import RPMTransaction
import signal
import yumcommands
-from yum.misc import to_unicode
+from yum.misc import to_unicode, to_utf8
def sigquit(signum, frame):
""" SIGQUIT handler for the yum cli. """
@@ -374,7 +374,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
if msgs:
print _('ERROR with rpm_check_debug vs depsolve:')
for msg in msgs:
- print msg
+ print to_utf8(msg)
return 1, [_('Please report this error in bugzilla')]
commit 235b9d77c2506fff0d00a99889f8fb2a898f277e
Author: James Antill <james at and.org>
Date: Wed Jun 11 10:38:05 2008 -0400
Use sets for lookup on large prco tuples
diff --git a/yum/packages.py b/yum/packages.py
index 49630f6..169f30f 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -280,10 +280,24 @@ class RpmBase(object):
# get rid of simple cases - nothing
if not self.prco.has_key(prcotype):
return 0
- # exact match
- if prcotuple in self.prco[prcotype]:
- return 1
+
+ # First try and exact match, then search
+ # Make it faster, if it's "big".
+ if len(self.prco[prcotype]) <= 8:
+ if prcotuple in self.prco[prcotype]:
+ return 1
else:
+ if not hasattr(self, '_prco_lookup'):
+ self._prco_lookup = {'obsoletes' : None, 'conflicts' : None,
+ 'requires' : None, 'provides' : None}
+
+ if self._prco_lookup[prcotype] is None:
+ self._prco_lookup[prcotype] = set(self.prco[prcotype])
+
+ if prcotuple in self._prco_lookup[prcotype]:
+ return 1
+
+ if True: # Keep indentation for patch smallness...
# make us look it up and compare
(reqn, reqf, (reqe, reqv ,reqr)) = prcotuple
if reqf is not None:
More information about the Yum-cvs-commits
mailing list