From: Zac Medico Date: Thu, 29 Nov 2007 09:14:28 +0000 (-0000) Subject: When portage reinstalls itself, pre-load elog modules in X-Git-Tag: v2.1.4~173 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b5d5d7c15cf4470d9c94a2cf19e03120e731a0ed;p=portage.git When portage reinstalls itself, pre-load elog modules in dblink.merge() since we won't be able to later if they get unmerged (happens when namespace changes). (trunk r8749) svn path=/main/branches/2.1.2/; revision=8750 --- diff --git a/pym/portage.py b/pym/portage.py index 82565dcba..88f0b3fb4 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -492,7 +492,7 @@ class digraph: print " ",child, print "(%s)" % self.nodes[node][0][child] - +_elog_mod_imports = {} _elog_atexit_handlers = [] def elog_process(cpv, mysettings): mylogfiles = listdir(mysettings["T"]+"/logging/") @@ -567,7 +567,10 @@ def elog_process(cpv, mysettings): # FIXME: ugly ad.hoc import code # TODO: implement a common portage module loader logmodule = __import__("elog_modules.mod_"+s) - m = getattr(logmodule, "mod_"+s) + m = _elog_mod_imports.get(logmodule) + if m is None: + m = getattr(logmodule, "mod_"+s) + _elog_mod_imports[logmodule] = m def timeout_handler(signum, frame): raise portage_exception.PortageException( "Timeout in elog_process for system '%s'" % s) @@ -9056,7 +9059,9 @@ class dblink: copies of PORTAGE_BIN_PATH and PORTAGE_PYM_PATH in order to avoid relying on the new versions which may be incompatible. Register an atexit hook to clean up the - temporary directories. + temporary directories. Pre-load elog modules here since + we won't be able to later if they get unmerged (happens + when namespace changes). """ if self.myroot == "/" and \ "sys-apps" == self.cat and \ @@ -9078,6 +9083,8 @@ class dblink: shutil.copytree(var_orig, var_new, symlinks=True) 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) return self._merge(mergeroot, inforoot, myroot, myebuild=myebuild, cleanup=cleanup,