<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 16, 2013 at 2:46 PM, Richard Purdie <span dir="ltr">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Mon, 2013-09-16 at 14:33 +0100, Alex DAMIAN wrote:<br>


&gt; From: Alexandru DAMIAN &lt;<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&gt;<br>
&gt;<br>
&gt; We add a new event that will be triggered by the<br>
&gt; package-building class, containing the information<br>
&gt; about the currently built package.<br>
&gt;<br>
&gt; Adding an event that will passi information about the<br>
&gt; content of each package file that gets built.<br>
&gt;<br>
&gt; Knotty UI will ignore these events by default.<br>
&gt;<br>
&gt; Maybe a mechanism for using a single generic event is in order ?<br>
&gt;<br>
&gt; Signed-off-by: Alexandru DAMIAN &lt;<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&gt;<br>
&gt; ---<br>
&gt;  bitbake/lib/bb/event.py     | 16 ++++++++++++++++<br>
&gt;  bitbake/lib/bb/ui/knotty.py |  2 ++<br>
&gt;  2 files changed, 18 insertions(+)<br>
&gt;<br>
&gt; diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py<br>
&gt; index 67cfcea..7dd9236 100644<br>
&gt; --- a/bitbake/lib/bb/event.py<br>
&gt; +++ b/bitbake/lib/bb/event.py<br>
&gt; @@ -589,6 +589,22 @@ class PackageInfo(Event):<br>
&gt;          Event.__init__(self)<br>
&gt;          self._pkginfolist = pkginfolist<br>
&gt;<br>
&gt; +class SinglePackageInfo(Event):<br>
&gt; +    &quot;&quot;&quot;<br>
&gt; +    Single Package Information sent on emit_pkgdata<br>
&gt; +    &quot;&quot;&quot;<br>
&gt; +    def __init__(self, data):<br>
&gt; +        Event.__init__(self)<br>
&gt; +        self._data = data<br>
&gt; +<br>
&gt; +class PackageFileSizes(Event):<br>
&gt; +    &quot;&quot;&quot;<br>
&gt; +    Event that contains information about the file sizes contained in a package.<br>
&gt; +    &quot;&quot;&quot;<br>
&gt; +    def __init__(self, data):<br>
&gt; +        Event.__init__(self)<br>
&gt; +        self._data = data<br>
&gt; +<br>
&gt;  class SanityCheck(Event):<br>
&gt;      &quot;&quot;&quot;<br>
<br>
</div></div>Your explanation in the commit message isn&#39;t as detailed as it could<br>
be.<br>
<br>
I&#39;m guessing but I suspect the problem we have is that the event cannot<br>
be rebuilt on the other side of an XMLRPC connection without having the<br>
event class in a common namespace?<br>
<br>
This is therefore a hack to allow the event to exist in all the client<br>
side namespaces.<br></blockquote><div><br></div><div>[Alex] Yep, this is an ugly hack.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
Ideally we should really have an API which allows the classes themselves<br>
to declare their event formats and not require adding to event.py every<br>
time a new piece of code/event is added.<br></blockquote><div><br></div><div>[Alex] I would favor a single &quot;GenericEvent&quot; that will take a set of defined parameters,</div><div>that would allow &quot;subclassing&quot; at runtime - sort of introspection if you will.</div>

<div><br></div><div>Something like this:</div><div><span style="color:rgb(80,0,80)"><br></span></div><div><font color="#000000">class GenericInfo(Event):<br></font></div><div><font color="#000000">    def __init__(self, type, data):<br>

        Event.__init__(self)</font></div><div><font color="#000000">        self._type = type<br>        self._data = data<br></font></div><div><font color="#000000"><br></font></div><div><font color="#000000">with a call like</font></div>

<div><font color="#000000"><br></font></div><div><font color="#000000">bb.event.fire(bb.event.GenericInfo(&quot;PackageInfo&quot;, pkginfolist), e.data)</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">the UI handlers / anybody would subscribe to GenericInfo events, </font></div>

<div><font color="#000000">and the processing code would look like:</font></div><div><br></div><div>if isinstance(event, bb.event.GenericInfo):</div><div>    if event._type == <span style="color:rgb(0,0,0)">&quot;PackageInfo&quot;:</span></div>

<div><span style="color:rgb(0,0,0)">         savePackageInfo(event)</span></div><div><span style="color:rgb(0,0,0)">    elif event._type == &quot;PackageFileSizes&quot;:</span></div><div><span style="color:rgb(0,0,0)">        ....</span></div>

<div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">What do you think ?</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
Presumably there is some change required to OE-Core in order for this<br>
get used to?<br></blockquote><div><br></div><div>The code using the e </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
Is the PackageFileSizes not contained in the other event data?<br></blockquote><div><br></div><div>[Alex] Not  that I could find.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
I appreciate we allowed PackageInfo in but I didn&#39;t like it at the time,<br>
I like it even less now I see we&#39;re just going to keep doing this :(.<br>
<div class="im"><br>
&gt;      Event to issue sanity check<br>
&gt; diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py<br>
&gt; index 0211b50..03baa75 100644<br>
&gt; --- a/bitbake/lib/bb/ui/knotty.py<br>
&gt; +++ b/bitbake/lib/bb/ui/knotty.py<br>
&gt; @@ -477,6 +477,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):<br>
&gt;<br>
&gt;              # ignore<br>
&gt;              if isinstance(event, (bb.event.BuildBase,<br>
&gt; +                                  bb.event.PackageFileSizes,<br>
&gt; +                                  bb.event.SinglePackageInfo,<br>
&gt;                                    bb.event.StampUpdate,<br>
&gt;                                    bb.event.ConfigParsed,<br>
&gt;                                    bb.event.RecipeParsed,<br>
<br>
<br>
</div>Given the event masking that is now in knotty, do we need to do this?<br>
Can&#39;t we remove this block?<br></blockquote><div><br></div><div>[Alex] Yep, it should get removed. I refrained from doing so since it wasn&#39;t deleted</div><div>when the subscription code got merged in.</div><div><br>

</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Cheers,<br>
<br>
Richard<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alex Damian<div>Yocto Project<br></div><div>SSG / OTC </div></div>
</div></div>