[yum-git] Branch 'yum-3_2_X' - 2 commits - yum/config.py yum/misc.py yum/sqlitesack.py
James Antill
james at linux.duke.edu
Tue Jul 29 14:55:34 UTC 2008
yum/config.py | 2 ++
yum/misc.py | 34 ++++++++++++++++++++++++----------
yum/sqlitesack.py | 22 ++++++++++++++--------
3 files changed, 40 insertions(+), 18 deletions(-)
New commits:
commit 800f8bfd0d0294f837a91e664fc539898a7250c3
Author: James Antill <james at and.org>
Date: Tue Jul 29 10:55:27 2008 -0400
Don't give up if PATTERNS_MAX reached, just do the operation multiple times
diff --git a/yum/misc.py b/yum/misc.py
index 3224a8e..0e8c195 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -557,7 +557,31 @@ def find_ts_remaining(timestamp, yumlibpath='/var/lib/yum'):
to_complete_items.append((action, pkgspec))
return to_complete_items
+
+def seq_max_split(seq, max_entries):
+ """ Given a seq, split into a list of lists of length max_entries each. """
+ ret = []
+ num = len(seq)
+ beg = 0
+ while num > max_entries:
+ end = beg + max_entries
+ ret.append(seq[beg:end])
+ beg += max_entries
+ num -= max_entries
+ ret.append(seq[beg:])
+ return ret
+def to_xml(item, attrib=False):
+ import xml.sax.saxutils
+ item = to_utf8(item) # verify this does enough conversion
+ item = item.rstrip()
+ if attrib:
+ item = xml.sax.saxutils.escape(item, entities={'"':"""})
+ else:
+ item = xml.sax.saxutils.escape(item)
+ return item
+
+# ---------- i18n ----------
def to_unicode(obj, encoding='utf-8', errors='replace'):
''' convert a 'str' to 'unicode' '''
if isinstance(obj, basestring):
@@ -587,16 +611,6 @@ def to_str(obj):
obj = str(obj)
return obj
-def to_xml(item, attrib=False):
- import xml.sax.saxutils
- item = to_utf8(item) # verify this does enough conversion
- item = item.rstrip()
- if attrib:
- item = xml.sax.saxutils.escape(item, entities={'"':"""})
- else:
- item = xml.sax.saxutils.escape(item)
- return item
-
def get_my_lang_code():
import locale
mylang = locale.getlocale()
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 8bb5248..2c8dd20 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -34,6 +34,7 @@ import sqlutils
import constants
import operator
import time
+from yum.misc import seq_max_split
def catchSqliteException(func):
"""This decorator converts sqlite exceptions into RepoError"""
@@ -825,12 +826,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
return []
returnList = []
- if len(names) > constants.PATTERNS_MAX:
- names = set(names)
- for pkg in self.returnPackages():
- if pkg.name not in names:
- continue
- returnList.append(pkg)
+ max_entries = constants.PATTERNS_MAX
+ if len(names) > max_entries:
+ for names in seq_max_split(names, max_entries):
+ returnList.extend(self.searchNames(names))
return returnList
pat_sqls = []
@@ -1057,10 +1056,17 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
"""Builds a list of packages, only containing nevra information. No
excludes are done at this stage. """
- if patterns is None or len(patterns) > (constants.PATTERNS_MAX / 7):
+ if patterns is None:
patterns = []
+
+ returnList = []
+ max_entries = constants.PATTERNS_MAX / 7
+ if len(patterns) > max_entries:
+ for patterns in seq_max_split(patterns, max_entries):
+ returnList.extend(self._buildPkgObjList(repoid, patterns,
+ ignore_case))
+ return returnList
- returnList = []
for (repo,cache) in self.primarydb.items():
if (repoid == None or repoid == repo.id):
cur = cache.cursor()
commit 57e7ad9b27069f9e9408529a7f50c3827eaff947
Author: James Antill <james at and.org>
Date: Tue Jul 29 10:54:56 2008 -0400
Make gpgcheck true/false work again
diff --git a/yum/config.py b/yum/config.py
index 5904638..3df157b 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -628,8 +628,10 @@ class YumConf(StartupConf):
('none', 'all', 'packages', 'repo'),
{'0' : 'none',
'no' : 'none',
+ 'false' : 'none',
'1' : 'all',
'yes' : 'all',
+ 'true' : 'all',
'pkgs' : 'packages',
'repository' : 'repo'})
obsoletes = BoolOption(False)
More information about the Yum-cvs-commits
mailing list