summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-25 22:52:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-26 09:27:34 +0100
commit8c3dd2d9eb2c593d5b7cf28d7627e6725ab7dbfe (patch)
tree02a4b793873141f30eb92f91dda1f2a3db6c46f6
parent00ca43be056e32bcc237ea4ada78f8df5faaf568 (diff)
downloadpoky-8c3dd2d9eb2c593d5b7cf28d7627e6725ab7dbfe.tar.gz
bitbake: event: Handle recursive events and the data store better
Events can call each other recursively, e.g. an event handler can call bb.note which in turn generates another event. If these loop, it can lead to multiple deletions of 'd' from __builtins__ which can fail since __builtins__ is global scope. Add handling to only remove 'd' when we added it and it wasn't already present. (Bitbake rev: b45952650ce8f470f124df36185b79e0d3a1783a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/event.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index f0391b8565..61a7f4a265 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -72,7 +72,10 @@ _eventfilter = None
72 72
73def execute_handler(name, handler, event, d): 73def execute_handler(name, handler, event, d):
74 event.data = d 74 event.data = d
75 __builtins__['d'] = d 75 addedd = False
76 if 'd' not in __builtins__:
77 __builtins__['d'] = d
78 addedd = True
76 try: 79 try:
77 ret = handler(event) 80 ret = handler(event)
78 except (bb.parse.SkipRecipe, bb.BBHandledException): 81 except (bb.parse.SkipRecipe, bb.BBHandledException):
@@ -88,7 +91,8 @@ def execute_handler(name, handler, event, d):
88 raise 91 raise
89 finally: 92 finally:
90 del event.data 93 del event.data
91 del __builtins__['d'] 94 if addedd:
95 del __builtins__['d']
92 96
93def fire_class_handlers(event, d): 97def fire_class_handlers(event, d):
94 if isinstance(event, logging.LogRecord): 98 if isinstance(event, logging.LogRecord):