summaryrefslogtreecommitdiffstats
path: root/pym/portage/elog/mod_echo.py
blob: 73928b4372736633456dcb5bcfe5bc9e8469fb6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# elog/mod_echo.py - elog dispatch module
# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

from portage.output import EOutput
from portage.const import EBUILD_PHASES

_items = {}
def process(mysettings, cpv, logentries, fulltext):
	_items[cpv] = logentries

def finalize(mysettings):
	printer = EOutput()
	for cpv in _items.keys():
		print
		printer.einfo("Messages for package %s:" % cpv)
		print
		for phase in EBUILD_PHASES:
			if not phase in _items[cpv]:
				continue
			for msgtype, msgcontent in _items[cpv][phase]:
				fmap = {"INFO": printer.einfo,
						"WARN": printer.ewarn,
						"ERROR": printer.eerror,
						"LOG": printer.einfo,
						"QA": printer.ewarn}
				for line in msgcontent:
					fmap[msgtype](line.strip("\n"))
	return