Add a _preload_elog_modules() function.
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Oct 2010 18:43:35 +0000 (11:43 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Oct 2010 18:43:35 +0000 (11:43 -0700)
pym/portage/dbapi/vartree.py
pym/portage/elog/__init__.py

index c6d37d0fea0d308a69fa102a02ffea1bc9d2cab7..916e79290f4acc34258bf3f9e23270f2d5a4628d 100644 (file)
@@ -12,7 +12,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
        'portage.dbapi.dep_expand:dep_expand',
        'portage.dep:dep_getkey,isjustname,match_from_list,' + \
                'use_reduce,_slot_re',
-       'portage.elog:elog_process',
+       'portage.elog:elog_process,_preload_elog_modules',
        'portage.locks:lockdir,unlockdir',
        'portage.output:bold,colorize',
        'portage.package.ebuild.doebuild:doebuild_environment,' + \
@@ -3826,7 +3826,7 @@ class dblink(object):
                                os.chmod(var_new, dir_perms)
                        os.chmod(base_path_tmp, dir_perms)
                        # This serves so pre-load the modules.
-                       elog_process(self.mycpv, self.settings)
+                       _preload_elog_modules()
 
                return self._merge(mergeroot, inforoot,
                                myebuild=myebuild, cleanup=cleanup,
index 78b6d83983941e5bb1da12c47a24b96ad4f6b500..6bb52d0656a7f0cdeb1e5800a351b516e0e9a8c9 100644 (file)
@@ -15,6 +15,20 @@ from portage.elog.filtering import filter_loglevels
 from portage.localization import _
 from portage import os
 
+def _preload_elog_modules(settings):
+       logsystems = settings.get("PORTAGE_ELOG_SYSTEM", "").split()
+       for s in logsystems:
+               # allow per module overrides of PORTAGE_ELOG_CLASSES
+               if ":" in s:
+                       s, levels = s.split(":", 1)
+                       levels = levels.split(",")
+               # - is nicer than _ for module names, so allow people to use it.
+               s = s.replace("-", "_")
+               try:
+                       _load_mod("portage.elog.mod_" + s)
+               except ImportError:
+                       pass
+
 def _merge_logentries(a, b):
        rValue = {}
        phases = set(a)