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
# 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
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():
#raise NotImplementedError()
-def collect_messages(key=None):
+def collect_messages(key=None, phasefilter=None):
global _msgbuffer
if key is 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():