summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-08 04:54:35 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-08 04:54:35 +0000
commitc1bb5e536ded49fb6f799304f0d9ac7f6b4d1d90 (patch)
tree851369634daa9f9c9f15348c2fb90cb431e47d9b /pym/portage.py
parent02e408373cee15c20ea2320774320807c274dd95 (diff)
downloadportage-c1bb5e536ded49fb6f799304f0d9ac7f6b4d1d90.tar.gz
portage-c1bb5e536ded49fb6f799304f0d9ac7f6b4d1d90.tar.bz2
portage-c1bb5e536ded49fb6f799304f0d9ac7f6b4d1d90.zip
Bug #197905 - Preserve order of ebuild messages even between different
message types. (trunk r9726 and r9747) svn path=/main/branches/2.1.2/; revision=9748
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/pym/portage.py b/pym/portage.py
index fecfec3dd..0cc187da1 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -520,23 +520,40 @@ def elog_process(cpv, mysettings):
except ImportError:
pass
- mylogfiles = listdir(mysettings["T"]+"/logging/")
+ path = os.path.join(mysettings["T"], "logging")
+ mylogfiles = None
+ try:
+ mylogfiles = os.listdir(path)
+ except OSError:
+ pass
# shortcut for packages without any messages
if len(mylogfiles) == 0:
return
# exploit listdir() file order so we process log entries in chronological order
mylogfiles.reverse()
all_logentries = {}
- for f in mylogfiles:
- msgfunction, msgtype = f.split(".")
+ for msgfunction in mylogfiles:
if msgfunction not in portage_const.EBUILD_PHASES:
writemsg("!!! can't process invalid log file: %s\n" % f,
noiselevel=-1)
continue
if not msgfunction in all_logentries:
all_logentries[msgfunction] = []
- msgcontent = open(mysettings["T"]+"/logging/"+f, "r").readlines()
- all_logentries[msgfunction].append((msgtype, msgcontent))
+ lastmsgtype = None
+ msgcontent = []
+ for l in open(os.path.join(path, msgfunction), "r").readlines():
+ msgtype, msg = l.split(" ", 1)
+ if lastmsgtype is None:
+ lastmsgtype = msgtype
+ if msgtype == lastmsgtype:
+ msgcontent.append(msg)
+ else:
+ if msgcontent:
+ all_logentries[msgfunction].append((lastmsgtype, msgcontent))
+ msgcontent = [msg]
+ lastmsgtype = msgtype
+ if msgcontent:
+ all_logentries[msgfunction].append((lastmsgtype, msgcontent))
def filter_loglevels(logentries, loglevels):
# remove unwanted entries from all logentries