Patchwork [bitbake-devel,6/7] bitbake: event: adding generic event for metadata usage

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 18, 2013, 12:15 p.m.
Message ID <02ce17946b69d5d0875828368df1a4a31b16568a.1379505533.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58317/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 18, 2013, 12:15 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Adding the generic bb.event.MetadataEvent that is
targeted specifically at metadata usage. This is
needed in order to let the metadata code send and receive
events during asynchrous execution without having
to define each event specifically in Bitbake.

Metadata code should subscribe to and fire the MetadataEvent
in order to communicate asynchronously, and identify
the object using event.type field, and parse the
data in the event.data field.

Knotty UI will ignore these event by default.

This deprecates RequestPackageInfo/PackageInfo, and that
event pair will be removed in the future.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/bb/event.py     | 10 ++++++++++
 bitbake/lib/bb/ui/knotty.py |  1 +
 2 files changed, 11 insertions(+)

Patch

diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 67cfcea..10eae5f 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -589,6 +589,16 @@  class PackageInfo(Event):
         Event.__init__(self)
         self._pkginfolist = pkginfolist
 
+class MetadataEvent(Event):
+    """
+    Generic event that target for OE-Core classes
+    to report information during asynchrous execution
+    """
+    def __init__(self, eventtype, eventdata):
+        Event.__init__(self)
+        self.type = eventtype
+        self.data = eventdata
+
 class SanityCheck(Event):
     """
     Event to issue sanity check
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 0211b50..c1ee9f52 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -477,6 +477,7 @@  def main(server, eventHandler, params, tf = TerminalFilter):
 
             # ignore
             if isinstance(event, (bb.event.BuildBase,
+                                  bb.event.MetadataEvent,
                                   bb.event.StampUpdate,
                                   bb.event.ConfigParsed,
                                   bb.event.RecipeParsed,