blob: e1a5223d65722c2af36b1303bda8e274ff4958b7 [file] [log] [blame]
# elog/ - 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")
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)