]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cooker.py: Remove global scope class event handlers
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 23 May 2013 09:48:26 +0000 (10:48 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 23 May 2013 09:57:11 +0000 (10:57 +0100)
Its confusing when an event handler in for example a bbclass receives
events for a recipe which doesn't use the class. This is due to the
class event handlers having confusing scope. Worse, the issue is not
deterministic and the events a handler will see depends on the parse
order.

To avoid these issues, remove the class event handler global scope
and only have class handlers recieve events for recipes using the
class.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/cooker.py

index eed489f5d44f478883614834fb224a2a0fbfd560..41f70ab95a5cd009927987ae952e407adc862c38 100644 (file)
@@ -1455,6 +1455,7 @@ class Parser(multiprocessing.Process):
         self.init = init
         multiprocessing.Process.__init__(self)
         self.context = bb.utils._context.copy()
+        self.handlers = bb.event._handlers.copy()
 
     def run(self):
         if self.init:
@@ -1490,6 +1491,7 @@ class Parser(multiprocessing.Process):
     def parse(self, filename, appends, caches_array):
         try:
             bb.utils._context = self.context.copy()
+            bb.event._handlers = self.handlers.copy()
             return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array)
         except Exception as exc:
             tb = sys.exc_info()[2]