diff options
Diffstat (limited to 'pym/elog_modules/mod_custom.py')
-rw-r--r-- | pym/elog_modules/mod_custom.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pym/elog_modules/mod_custom.py b/pym/elog_modules/mod_custom.py new file mode 100644 index 000000000..eebbdd55b --- /dev/null +++ b/pym/elog_modules/mod_custom.py @@ -0,0 +1,16 @@ +import elog_modules.mod_save, portage_exec, portage_exception + +def process(mysettings, cpv, logentries, fulltext): + elog_modules.mod_save.process(mysettings, cpv, logentries, fulltext) + + if (not "PORTAGE_ELOG_COMMAND" in mysettings.keys()) \ + or len(mysettings["PORTAGE_ELOG_COMMAND"]) == 0: + raise portage_exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined") + else: + mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"] + mylogcmd.replace("${LOGFILE}", elogfilename) + mylogcmd.replace("${PACKAGE}", cpv) + retval = portage_exec.spawn_bash(mylogcmd) + if retval != 0: + raise portage_exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval) + return |