diff options
-rw-r--r-- | pym/portage/dbapi/vartree.py | 3 | ||||
-rw-r--r-- | pym/portage/elog/__init__.py | 6 | ||||
-rw-r--r-- | pym/portage/elog/messages.py | 14 |
3 files changed, 15 insertions, 8 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index afdb339cb..83e3be601 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1639,7 +1639,8 @@ class dblink(object): self._eerror(ebuild_phase, msg_lines) # process logs created during pre/postrm - elog_process(self.mycpv, self.settings) + elog_process(self.mycpv, self.settings, + phasefilter=('prerm', 'postrm')) if retval == os.EX_OK: # myebuildpath might be None, so ensure diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 6bb52d065..082acff9a 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -107,7 +107,7 @@ def elog_process(cpv, mysettings, phasefilter=None): # A build dir isn't necessarily required since the messages.e* # functions allow messages to be generated in-memory. ebuild_logentries = {} - all_logentries = collect_messages(key=cpv) + all_logentries = collect_messages(key=cpv, phasefilter=phasefilter) if cpv in all_logentries: # Messages generated by the python elog implementation are assumed # to come first. For example, this ensures correct order for einfo @@ -124,10 +124,6 @@ def elog_process(cpv, mysettings, phasefilter=None): all_logentries[key] = _preserve_logentries[key] del _preserve_logentries[key] - if phasefilter != None: - for key in all_logentries: - all_logentries[key], _preserve_logentries[key] = phasefilter(all_logentries[key]) - my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) logsystems = {} for token in mysettings.get("PORTAGE_ELOG_SYSTEM", "").split(): diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py index bee0a7747..a8a3e9a5f 100644 --- a/pym/portage/elog/messages.py +++ b/pym/portage/elog/messages.py @@ -121,7 +121,7 @@ def _elog_base(level, msg, phase="other", key=None, color=None, out=None): #raise NotImplementedError() -def collect_messages(key=None): +def collect_messages(key=None, phasefilter=None): global _msgbuffer if key is None: @@ -130,7 +130,17 @@ def collect_messages(key=None): else: rValue = {} if key in _msgbuffer: - rValue[key] = _msgbuffer.pop(key) + if phasefilter is None: + rValue[key] = _msgbuffer.pop(key) + else: + rValue[key] = {} + for phase in phasefilter: + try: + rValue[key][phase] = _msgbuffer[key].pop(phase) + except KeyError: + pass + if not _msgbuffer[key]: + del _msgbuffer[key] return rValue def _reset_buffer(): |