summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-29 09:06:52 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-29 09:06:52 +0000
commit94ea294e4b07a4f9cb5814a205510a899d1c106a (patch)
tree293ccf54d3fc47711cad2b9f23eed91f5c3a631e /pym
parentc7d55759963ab10685ec142613c30101f5baa999 (diff)
downloadportage-94ea294e4b07a4f9cb5814a205510a899d1c106a.tar.gz
portage-94ea294e4b07a4f9cb5814a205510a899d1c106a.tar.bz2
portage-94ea294e4b07a4f9cb5814a205510a899d1c106a.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). svn path=/main/trunk/; revision=8749
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/vartree.py7
-rw-r--r--pym/portage/elog/__init__.py10
2 files changed, 13 insertions, 4 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 12ecb3171..e0cc8e45b 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2355,7 +2355,9 @@ class dblink(object):
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 \
@@ -2377,6 +2379,9 @@ class dblink(object):
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,
+ phasefilter=filter_mergephases)
return self._merge(mergeroot, inforoot,
myroot, myebuild=myebuild, cleanup=cleanup,
diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py
index e1df6d9bd..c68fedca0 100644
--- a/pym/portage/elog/__init__.py
+++ b/pym/portage/elog/__init__.py
@@ -42,6 +42,7 @@ def _combine_logentries(logentries):
rValue.append("\n")
return "".join(rValue)
+_elog_mod_imports = {}
_elog_atexit_handlers = []
_preserve_logentries = {}
def elog_process(cpv, mysettings, phasefilter=None):
@@ -94,9 +95,12 @@ def elog_process(cpv, mysettings, phasefilter=None):
# FIXME: ugly ad.hoc import code
# TODO: implement a common portage module loader
name = "portage.elog.mod_" + s
- m = __import__(name)
- for comp in name.split(".")[1:]:
- m = getattr(m, comp)
+ m = _elog_mod_imports.get(name)
+ if m is None:
+ m = __import__(name)
+ for comp in name.split(".")[1:]:
+ m = getattr(m, comp)
+ _elog_mod_imports[name] = m
def timeout_handler(signum, frame):
raise PortageException("Timeout in elog_process for system '%s'" % s)
import signal