summaryrefslogtreecommitdiffstats
path: root/pym/portage/elog/mod_custom.py
blob: e1a5223d65722c2af36b1303bda8e274ff4958b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# elog/mod_custom.py - elog dispatch module
# Copyright 2006-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import portage.elog.mod_save, portage.process, portage.exception

def process(mysettings, key, logentries, fulltext):
	elogfilename = portage.elog.mod_save.process(mysettings, key, logentries, fulltext)
	
	if not mysettings.get("PORTAGE_ELOG_COMMAND"):
		raise portage.exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined")
	else:
		mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"]
		mylogcmd = mylogcmd.replace("${LOGFILE}", elogfilename)
		mylogcmd = mylogcmd.replace("${PACKAGE}", key)
		retval = portage.process.spawn_bash(mylogcmd)
		if retval != 0:
			raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval)
	return