From 749ca687091d6ee7f92fce4c385a7ff4bd2636aa Mon Sep 17 00:00:00 2001
From: Joshua Lock <josh@linux.intel.com>
Date: Wed, 5 Jan 2011 19:23:46 +0000
Subject: bitbake/uievent: fix queueing of events for xmlrpc before UI has
 loaded

The recent change to Queue up events before the UI is spawned (in
26eda933379801ef1c8b4b09e67d14f498cd3813) broke the xmlrpc server because the
uievent implementation of BBUIEventQueue expects pickled strings for its
queue_event() method.

This is because the RPC exposed event.send() method must accept pickled
strings, but for xmlrpc event.send() is just mapped to queue_event().

Work around this by adding a send_event method which unpickles strings and
hands them off to queue_event() which can then be used for the remapping.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 bitbake/lib/bb/ui/uievent.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'bitbake')

diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index b404805d8..2fef4e465 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -63,17 +63,20 @@ class BBUIEventQueue:
 
     def queue_event(self, event):
         self.eventQueueLock.acquire()
-        self.eventQueue.append(pickle.loads(event))
+        self.eventQueue.append(event)
         self.eventQueueNotify.set()
         self.eventQueueLock.release()
 
+    def send_event(self, event):
+        self.queue_event(pickle.loads(event))
+
     def startCallbackHandler(self):
 
         server = UIXMLRPCServer()
         self.host, self.port = server.socket.getsockname()
 
         server.register_function( self.system_quit, "event.quit" )
-        server.register_function( self.queue_event, "event.send" )
+        server.register_function( self.send_event, "event.send" )
         server.socket.settimeout(1)
 
         self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
-- 
cgit v1.2.3