[oe-commits] [bitbake] 05/13: eventreplay: fix event loading code

git at git.openembedded.org git at git.openembedded.org
Thu Jul 7 13:30:30 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 98f3085572df76d3348a17c764cf493ad5c9dd01
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Wed Jul 6 12:00:31 2016 +0100

    eventreplay: fix event loading code
    
    Event objects are represented by base64-encoded strings in
    the event file and can't be loaded by existing eventreplay code.
    
    Fixed the code of loading events from file by decoding base64 strings
    into the binary form and loading them with pickle.load.
    
    [YOCTO #9585]
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 bin/toaster-eventreplay | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/toaster-eventreplay b/bin/toaster-eventreplay
index 03b5dde..a107298 100755
--- a/bin/toaster-eventreplay
+++ b/bin/toaster-eventreplay
@@ -29,6 +29,7 @@
 from __future__ import print_function
 import os
 import sys, logging
+import codecs
 
 # mangle syspath to allow easy import of modules
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
@@ -117,7 +118,8 @@ class FileReadEventsServerConnection():
             try:
                 event_data = json.loads(line.strip())
                 event_class = _import_class(event_data['class'])
-                event_object = pickle.loads(json.loads(event_data['vars']))
+                event_str = event_data['vars'].encode('utf-8')
+                event_object = pickle.loads(codecs.decode(event_str, 'base64'))
             except ValueError as e:
                 print("Failed loading ", line)
                 raise e

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list