summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-06-20 14:00:49 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-20 17:23:57 +0100
commite28b36e1e8b2d6b1531698d6d50658e3fc73adc0 (patch)
tree9da1169db54cc25a5048d8340bac35779b9c3a20 /bitbake
parent3e7edc303cfcb08d16b357b04441fb295099f314 (diff)
downloadpoky-e28b36e1e8b2d6b1531698d6d50658e3fc73adc0.tar.gz
bitbake: cooker: encode event objects to base64
pickle converts python objects into the binary form that can't be decoded to text and therefore can't be converted to JSON format. Attempt to convert event objects raises this error: TypeError: b'\x80\x03cbb.runqueue\nrunQueueTaskSkipped\nq\x00)... is not JSON serializable Encoded pickled event objects to base64 to be able to convert data structure to JSON. [YOCTO #9803] (Bitbake rev: f18055237e6084f90f6221442e3ba021dcc59c50) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index b2cf0cda17..2de6b3e0dd 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -44,6 +44,7 @@ import prserv.serv
44import pyinotify 44import pyinotify
45import json 45import json
46import pickle 46import pickle
47import codecs
47 48
48logger = logging.getLogger("BitBake") 49logger = logging.getLogger("BitBake")
49collectlog = logging.getLogger("BitBake.Collection") 50collectlog = logging.getLogger("BitBake.Collection")
@@ -143,7 +144,9 @@ class EventLogWriteHandler:
143 def write_event(self, event): 144 def write_event(self, event):
144 with open(self.eventfile, "a") as f: 145 with open(self.eventfile, "a") as f:
145 try: 146 try:
146 f.write("%s\n" % json.dumps({"class":event.__module__ + "." + event.__class__.__name__, "vars":json.dumps(pickle.dumps(event)) })) 147 str_event = codecs.encode(pickle.dumps(event), 'base64').decode('utf-8')
148 f.write("%s\n" % json.dumps({"class": event.__module__ + "." + event.__class__.__name__,
149 "vars": str_event}))
147 except Exception as e: 150 except Exception as e:
148 import traceback 151 import traceback
149 print(e, traceback.format_exc()) 152 print(e, traceback.format_exc())