summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2023-09-25 04:18:31 +0200
committerSteve Sakoman <steve@sakoman.com>2023-11-09 04:41:17 -1000
commit2fc0a78176165701c2a61953f521dcebfd4fb40c (patch)
tree37c1fdfa6f5b557387e0b5185c513fcf8c6bc6b8 /bitbake
parent0207478c7b071d027672e109e305b6c43637fa6a (diff)
downloadpoky-2fc0a78176165701c2a61953f521dcebfd4fb40c.tar.gz
bitbake: tinfoil: Do not fail when logging is disabled and full config is used
If Tinfoil is initialized with setup_logging = False and Tinfoil.prepare() is called with config_only = False, then it fails because self.localhandlers is only initialized when setup_logging = True. This is seen with, e.g., `bitbake-getvar -q -r busybox MACHINE`: Traceback (most recent call last): File ".../bitbake/bin/bitbake-getvar", line 41, in <module> tinfoil.prepare(quiet=2) File ".../bitbake/lib/bb/tinfoil.py", line 390, in prepare for handler in self.localhandlers: AttributeError: 'Tinfoil' object has no attribute 'localhandlers'. Did you mean: 'oldhandlers'? (Bitbake rev: e452c6d7ba5bb4f78a1d2bfb742794efdf171dbc) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 616101ddb630e2c9975022068b52a87c4cf647f6) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tinfoil.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index e68a3b879a..fa29b930ce 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -324,11 +324,11 @@ class Tinfoil:
324 self.recipes_parsed = False 324 self.recipes_parsed = False
325 self.quiet = 0 325 self.quiet = 0
326 self.oldhandlers = self.logger.handlers[:] 326 self.oldhandlers = self.logger.handlers[:]
327 self.localhandlers = []
327 if setup_logging: 328 if setup_logging:
328 # This is the *client-side* logger, nothing to do with 329 # This is the *client-side* logger, nothing to do with
329 # logging messages from the server 330 # logging messages from the server
330 bb.msg.logger_create('BitBake', output) 331 bb.msg.logger_create('BitBake', output)
331 self.localhandlers = []
332 for handler in self.logger.handlers: 332 for handler in self.logger.handlers:
333 if handler not in self.oldhandlers: 333 if handler not in self.oldhandlers:
334 self.localhandlers.append(handler) 334 self.localhandlers.append(handler)