From ea346917910734b6a9e537f83bd26b18cd3bf4f0 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 23 May 2013 10:49:57 +0100 Subject: bitbake: cooker/cookerdata/utils: Improve context management The current execution context management for bitbake is ugly and the use of a global variable is nasty. Fixing that is hard, however we can improve things to start to establish an API for accessing and changing that context. This patch also adds in an explicit reset of the context when we reparse the configuration data which starts to improve the lifecycle of the data in setups like hob. (Bitbake rev: 6c3281a140125337fc75783973485e16785d05a1) Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/cooker.py') diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 41f70ab95a..e8686475b9 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -1454,7 +1454,7 @@ class Parser(multiprocessing.Process): self.quit = quit self.init = init multiprocessing.Process.__init__(self) - self.context = bb.utils._context.copy() + self.context = bb.utils.get_context().copy() self.handlers = bb.event._handlers.copy() def run(self): @@ -1490,7 +1490,8 @@ class Parser(multiprocessing.Process): def parse(self, filename, appends, caches_array): try: - bb.utils._context = self.context.copy() + # Reset our environment and handlers to the original settings + bb.utils.set_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: -- cgit v1.2.3-54-g00ecf