[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/misc.py yum/repos.py
James Antill
james at osuosl.org
Tue Mar 24 22:41:11 UTC 2009
yum/misc.py | 1 +
yum/repos.py | 20 +++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 9ef1d3f6193fe6135fa7d8c31eca447a66007dfe
Author: James Antill <james at and.org>
Date: Thu Mar 19 11:05:35 2009 -0400
Really fix the leak due to gpg_import_func.
*hates python GC*
diff --git a/yum/repos.py b/yum/repos.py
index 63d1493..5185d98 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -25,6 +25,18 @@ from packageSack import MetaSack
from weakref import proxy as weakref
+class _wrap_ayum_getKeyForRepo:
+ """ This is a wrapper for calling YumBase.getKeyForRepo() because
+ otherwise we take a real reference through the bound method and
+ that is d00m (this applies to YumBase and RepoStorage, hence why
+ we have a seperate class).
+ A "better" fix might be to explicitly pass the YumBase instance to
+ the callback ... API change! """
+ def __init__(self, ayum):
+ self.ayum = weakref(ayum)
+ def __call__(self, repo, callback=None):
+ return self.ayum.getKeyForRepo(repo, callback)
+
class RepoStorage:
"""This class contains multiple repositories and core configuration data
about them."""
@@ -44,15 +56,9 @@ class RepoStorage:
# need to be set from outside of the repos object to do anything
# even quasi-useful
# defaults to what is probably sane-ish
- self.gpg_import_func = self._wrap_ayum_getKeyForRepo
+ self.gpg_import_func = _wrap_ayum_getKeyForRepo(ayum)
self.confirm_func = None
- def _wrap_ayum_getKeyForRepo(repo, callback=None):
- """ This is a wrapper for calling self.ayum.getKeyForRepo() because
- otherwise we take a real reference through the bound method and
- that is d00m. """
- return self.ayum.getKeyForRepo(repo, callback)
-
def doSetup(self, thisrepo = None):
self.ayum.plugins.run('prereposetup')
commit 23c7ee5881f1fd06dd7c77fb08fe8d1ea5be6223
Author: James Antill <james at and.org>
Date: Tue Mar 24 11:25:26 2009 -0400
Fix calling seq_max_split() on sets/etc.
diff --git a/yum/misc.py b/yum/misc.py
index e0d3388..d631af2 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -696,6 +696,7 @@ 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)
+ seq = list(seq) # Trying to use a set/etc. here is bad
beg = 0
while num > max_entries:
end = beg + max_entries
More information about the Yum-commits
mailing list