summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2005-07-30 12:11:01 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2005-07-30 12:11:01 +0000
commit783e917c87d84130bb6a6f6f48a87627431a53cd (patch)
treebdda566fd713e147b56874fd4438958cdec032f6 /doc
parent7095687aac08786821953c418970991fb35c41b4 (diff)
downloadbitbake-783e917c87d84130bb6a6f6f48a87627431a53cd.tar.gz
bitbake/manual/usermanual.xml:
-Provide an example for writing an event handler
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/usermanual.xml16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/manual/usermanual.xml b/doc/manual/usermanual.xml
index 4fa3d1c92..d54300b23 100644
--- a/doc/manual/usermanual.xml
+++ b/doc/manual/usermanual.xml
@@ -12,7 +12,7 @@
<corpauthor>BitBake Team</corpauthor>
</authorgroup>
<copyright>
- <year>2004</year>
+ <year>2004, 2005</year>
<holder>Chris Larson</holder>
<holder>Phil Blundell</holder>
</copyright>
@@ -190,7 +190,19 @@ addtask printdate before do_build</screen></para>
<title>Events</title>
<para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
<para>BitBake also implements a means of registering event handlers. Events are triggered at certain points during operation, such as, the beginning of operation against a given .bb, the start of a given task, task failure, task success, et cetera. The intent was to make it easy to do things like email notifications on build failure.</para>
- <para><emphasis>[Insert instructions on how to add event handlers here]</emphasis></para>
+ <para><screen>addhandler myclass_eventhandler
+python myclass_eventhandler() {
+ from bb.event import NotHandled, getName
+ from bb import data
+
+ print "The name of the Event is %s" % getName(e)
+ print "The file we run for is %s" % data.getVar('FILE', e.data, True)
+
+ return NotHandled
+</screen></para><para>
+This event handler gets called every time an event is triggered. A global variable <varname>e</varname> is defined. <varname>e</varname>.data contains an instance of bb.data. With the getName(<varname>e</varname>)
+method one can get the name of the triggered event.</para><para>The above event handler prints the name
+of the event and the content of the <varname>FILE</varname> variable.</para>
</section>
</section>
<section>