summaryrefslogtreecommitdiffstats
path: root/pym/portage/elog_modules/mod_custom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/elog_modules/mod_custom.py')
-rw-r--r--pym/portage/elog_modules/mod_custom.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pym/portage/elog_modules/mod_custom.py b/pym/portage/elog_modules/mod_custom.py
new file mode 100644
index 000000000..d609e79ba
--- /dev/null
+++ b/pym/portage/elog_modules/mod_custom.py
@@ -0,0 +1,16 @@
+import elog_modules.mod_save, portage_exec, portage_exception
+
+def process(mysettings, cpv, logentries, fulltext):
+ elogfilename = 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 = mylogcmd.replace("${LOGFILE}", elogfilename)
+ mylogcmd = 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