diff options
author | Richard Purdie <richard@openedhand.com> | 2008-06-17 11:46:50 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-06-17 11:46:50 +0000 |
commit | a833e9a35f51d656443c9493df288b708dc7da6d (patch) | |
tree | 3825d6c1e023d4a5d977653f02bfb4f71d7da961 /meta/classes/poky-autobuild-notifier.bbclass | |
parent | afe20e409112a244212c2820c8bb2960085c9c25 (diff) | |
download | openembedded-core-a833e9a35f51d656443c9493df288b708dc7da6d.tar.gz openembedded-core-a833e9a35f51d656443c9493df288b708dc7da6d.tar.bz2 openembedded-core-a833e9a35f51d656443c9493df288b708dc7da6d.zip |
classes: Add poky-autobuild-notifier class
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4679 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/poky-autobuild-notifier.bbclass')
-rw-r--r-- | meta/classes/poky-autobuild-notifier.bbclass | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/classes/poky-autobuild-notifier.bbclass b/meta/classes/poky-autobuild-notifier.bbclass new file mode 100644 index 0000000000..ef353e0f19 --- /dev/null +++ b/meta/classes/poky-autobuild-notifier.bbclass @@ -0,0 +1,61 @@ +# +# Copyright Openedhand Ltd 2008 +# Author: Richard Purdie +# + +""" +Designed for use with the Poky autobuilder only and provides custom hooks for +certain specific events. +""" + +def do_autobuilder_failure_report(event): + from bb.event import getName + from bb import data, mkdirhier, build + import os, glob + + if data.getVar('PN', event.data, True) != "clutter": + return + + import smtplib + import email.Message + + version = data.expand("${PN}: ${PV}-${PR}", event.data) + + message = email.Message.Message() + message["To"] = "richard@o-hand.com, ebassi@o-hand.com, pippin@o-hand.com" + message["From"] = "Poky Autobuilder Failure <poky@o-hand.com>" + message["Subject"] = "Poky Autobuild Failure Report - " + version + + mesg = "Poky Build Failure for:\n\n" + + for var in ["DISTRO", "MACHINE", "PN", "PV", "PR"]: + mesg += var + ": " + data.getVar(var, event.data, True) + "\n" + + mesg += "\nLog of the failure follows:\n\n" + + log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) + if len(log_file) != 0: + mesg += "".join(open(log_file[0], 'r').readlines()) + + message.set_payload(mesg) + + mailServer = smtplib.SMTP("pug.o-hand.com") + mailServer.sendmail(message["From"], message["To"], message.as_string()) + mailServer.quit() + +# we want to be an event handler +addhandler poky_autobuilder_notifier_eventhandler +python poky_autobuilder_notifier_eventhandler() { + from bb import note, error, data + from bb.event import NotHandled, getName + + if e.data is None: + return NotHandled + + name = getName(e) + + if name == "TaskFailed": + do_autobuilder_failure_report(e) + + return NotHandled +} |