summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-29 09:14:28 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-29 09:14:28 +0000
commitb5d5d7c15cf4470d9c94a2cf19e03120e731a0ed (patch)
treecc77164ca37aaf11a93014800644b20d3dfff4e0
parentfd8a5b59604363171893f0d9e14c329222176526 (diff)
downloadportage-b5d5d7c15cf4470d9c94a2cf19e03120e731a0ed.tar.gz
portage-b5d5d7c15cf4470d9c94a2cf19e03120e731a0ed.tar.bz2
portage-b5d5d7c15cf4470d9c94a2cf19e03120e731a0ed.zip
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
-rw-r--r--pym/portage.py13
1 files changed, 10 insertions, 3 deletions
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,