preserve order of ebuild messages even between different message types (bug #197905)
authorMarius Mauch <genone@gentoo.org>
Sun, 6 Apr 2008 14:20:52 +0000 (14:20 -0000)
committerMarius Mauch <genone@gentoo.org>
Sun, 6 Apr 2008 14:20:52 +0000 (14:20 -0000)
svn path=/main/trunk/; revision=9726

bin/isolated-functions.sh
pym/portage/elog/messages.py

index 08d1fcb0e7871f94fc7c4a6f6843956dbaedb80d..96594d8fef6fe110eeb13c0d7cfec3f4f7521760 100755 (executable)
@@ -164,7 +164,7 @@ elog_base() {
                        return 1
                        ;;
        esac
-       echo -e "$*" >> "${T}/logging/${EBUILD_PHASE:-other}.${messagetype}"
+       echo -e "${messagetype} $*" >> "${T}/logging/${EBUILD_PHASE:-other}"
        return 0
 }
 
index 852b71af917499539e1c95dfb78158a2280346ac..ed5c8c9dde96b7dbd28ac8408076cce256c85c85 100644 (file)
@@ -24,16 +24,27 @@ def collect_ebuild_messages(path):
        # exploit listdir() file order so we process log entries in chronological order
        mylogfiles.reverse()
        logentries = {}
-       for f in mylogfiles:
-               msgfunction, msgtype = f.split(".")
+       for msgfunction in mylogfiles:
                if msgfunction not in EBUILD_PHASES:
                        writemsg("!!! can't process invalid log file: %s\n" % f,
                                noiselevel=-1)
                        continue
                if not msgfunction in logentries:
                        logentries[msgfunction] = []
-               msgcontent = open(os.path.join(path, f), "r").readlines()
-               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:
+                                       logentries[msgfunction].append((lastmsgtype, msgcontent))
+                               msgcontent = [msg]
+                       lastmsgtype = msgtype
+
        # clean logfiles to avoid repetitions
        for f in mylogfiles:
                try: