[yum-git] 3 commits - yum/__init__.py yum/plugins.py yum/repos.py yum/yumRepo.py
James Antill
james at linux.duke.edu
Wed Mar 26 18:38:30 UTC 2008
yum/__init__.py | 13 +++++++------
yum/plugins.py | 4 +++-
yum/repos.py | 4 +++-
yum/yumRepo.py | 5 +++++
4 files changed, 18 insertions(+), 8 deletions(-)
New commits:
commit 1c6641edc5622ee61375d6e496d89e284598a8c4
Author: James Antill <james at and.org>
Date: Wed Mar 26 14:37:59 2008 -0400
Add developer comment, and stab seth/RHN people who did this
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 0585f99..65ecb50 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -251,6 +251,11 @@ class YumRepository(Repository, config.RepoConf):
# callback function for handling media
self.mediafunc = None
+ # FIXME: Note that having the repo hold the sack, which holds "repos"
+ # is not only confusing but creates a circular dep.
+ # Atm. we don't leak memory because RepoStorage.close() is called,
+ # which calls repo.close() which calls sack.close() which removes the
+ # repos from the sack ... thus. breaking the cycle.
self.sack = sqlitesack.YumSqlitePackageSack(
sqlitesack.YumAvailablePackageSqlite)
commit aba44156a22de2f9d26234a67523b8096731d82b
Author: James Antill <james at and.org>
Date: Wed Mar 26 12:15:10 2008 -0400
Fix user_agent when creating multiple YumBase instances
diff --git a/yum/__init__.py b/yum/__init__.py
index cba31e7..e77a5ad 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -67,10 +67,16 @@ from misc import to_unicode
import string
-from urlgrabber.grabber import default_grabber as urlgrab
+from urlgrabber.grabber import default_grabber
__version__ = '3.2.13'
+# Setup a default_grabber UA here that says we are yum, done using the global
+# so that other API users can easily add to it if they want.
+# Don't do it at init time, or we'll get multiple additions if you create
+# multiple YumBase() objects.
+default_grabber.opts.user_agent += " yum/" + __version__
+
class YumBase(depsolve.Depsolve):
"""This is a primary structure and base class. It houses the objects and
methods needed to perform most things in yum. It is almost an abstract
@@ -170,11 +176,6 @@ class YumBase(depsolve.Depsolve):
self._conf = config.readMainConfig(startupconf)
- # Setup a default_grabber UA here that says we are yum, done this way
- # so that other API users can add to it if they want.
- add_ua = " yum/" + __version__
- urlgrab.opts.user_agent += add_ua
-
# run the postconfig plugin hook
self.plugins.run('postconfig')
self.yumvar = self.conf.yumvar
commit d6b5b3c418e068e3186b9488243bf8c2aa91e639
Author: James Antill <james at and.org>
Date: Wed Mar 26 11:43:57 2008 -0400
Use weakref to avoid circular refs
diff --git a/yum/plugins.py b/yum/plugins.py
index 1624c7e..0a7f57a 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -35,6 +35,8 @@ from i18n import _
import fnmatch
+from weakref import proxy as weakref
+
# TODO: expose rpm package sack objects to plugins (once finished)
# TODO: allow plugins to use the existing config stuff to define options for
# their own configuration files (would replace confString() etc).
@@ -131,7 +133,7 @@ class YumPlugins:
self.searchpath = searchpath
self.pluginconfpath = pluginconfpath
- self.base = base
+ self.base = weakref(base)
self.optparser = optparser
self.cmdline = (None, None)
self.verbose_logger = logging.getLogger("yum.verbose.YumPlugins")
diff --git a/yum/repos.py b/yum/repos.py
index 377517c..9c0960b 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -23,6 +23,8 @@ import misc
import Errors
from packageSack import MetaSack
+from weakref import proxy as weakref
+
class RepoStorage:
"""This class contains multiple repositories and core configuration data
about them."""
@@ -37,7 +39,7 @@ class RepoStorage:
self._setup = False
- self.ayum = ayum
+ self.ayum = weakref(ayum)
def doSetup(self, thisrepo = None):
More information about the Yum-cvs-commits
mailing list