diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-10-07 12:15:15 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-10-07 12:15:15 -0700 |
commit | 8209aeab647b1ab80a64d5931069b3533776ef75 (patch) | |
tree | 2c23b53fd46623d6e2584692b4073e3b0c6ced8b | |
parent | e04db4cc77ca0596501193120cb6ecb85aa1f639 (diff) | |
download | portage-8209aeab647b1ab80a64d5931069b3533776ef75.tar.gz portage-8209aeab647b1ab80a64d5931069b3533776ef75.tar.bz2 portage-8209aeab647b1ab80a64d5931069b3533776ef75.zip |
Preserve elog message continuity during updates.
-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 916e79290..9b95161fa 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1640,7 +1640,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(): |