diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-10 17:56:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-23 12:06:06 +0000 |
commit | 6ca541175e1915d3af6687490609edbb3d9eaad1 (patch) | |
tree | 364ea486d0f485b90887631b9e0ec9771d443617 /bitbake/lib/bb/cooker.py | |
parent | 4bc0346d8c4211bf03a283ed1cde5b779dbfd3b4 (diff) | |
download | poky-6ca541175e1915d3af6687490609edbb3d9eaad1.tar.gz |
bitbake: cooker: Add support for BB_DEFAULT_EVENTLOG
Currently it is only possible to specify an eventlog on the bitbake
commandline. Add a variable that can be used in bitbake.conf so that
we can log data by default more easily.
(Bitbake rev: ee174b231897a53cdde0f68769518342e53210cf)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 4bf1809bc0..9f84030962 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -303,6 +303,10 @@ class BBCooker: | |||
303 | self.data_hash = self.databuilder.data_hash | 303 | self.data_hash = self.databuilder.data_hash |
304 | self.extraconfigdata = {} | 304 | self.extraconfigdata = {} |
305 | 305 | ||
306 | eventlog = self.data.getVar("BB_DEFAULT_EVENTLOG") | ||
307 | if not self.configuration.writeeventlog and eventlog: | ||
308 | self.setupEventLog(eventlog) | ||
309 | |||
306 | if consolelog: | 310 | if consolelog: |
307 | self.data.setVar("BB_CONSOLELOG", consolelog) | 311 | self.data.setVar("BB_CONSOLELOG", consolelog) |
308 | 312 | ||
@@ -409,6 +413,18 @@ class BBCooker: | |||
409 | 413 | ||
410 | self._parsecache_set(False) | 414 | self._parsecache_set(False) |
411 | 415 | ||
416 | def setupEventLog(self, eventlog): | ||
417 | if self.eventlog and self.eventlog[0] != eventlog: | ||
418 | bb.event.unregister_UIHhandler(self.eventlog[1]) | ||
419 | if not self.eventlog or self.eventlog[0] != eventlog: | ||
420 | # we log all events to a file if so directed | ||
421 | # register the log file writer as UI Handler | ||
422 | if not os.path.exists(os.path.dirname(eventlog)): | ||
423 | bb.utils.mkdirhier(os.path.dirname(eventlog)) | ||
424 | writer = EventWriter(self, eventlog) | ||
425 | EventLogWriteHandler = namedtuple('EventLogWriteHandler', ['event']) | ||
426 | self.eventlog = (eventlog, bb.event.register_UIHhandler(EventLogWriteHandler(writer))) | ||
427 | |||
412 | def updateConfigOpts(self, options, environment, cmdline): | 428 | def updateConfigOpts(self, options, environment, cmdline): |
413 | self.ui_cmdline = cmdline | 429 | self.ui_cmdline = cmdline |
414 | clean = True | 430 | clean = True |
@@ -428,14 +444,7 @@ class BBCooker: | |||
428 | setattr(self.configuration, o, options[o]) | 444 | setattr(self.configuration, o, options[o]) |
429 | 445 | ||
430 | if self.configuration.writeeventlog: | 446 | if self.configuration.writeeventlog: |
431 | if self.eventlog and self.eventlog[0] != self.configuration.writeeventlog: | 447 | self.setupEventLog(self.configuration.writeeventlog) |
432 | bb.event.unregister_UIHhandler(self.eventlog[1]) | ||
433 | if not self.eventlog or self.eventlog[0] != self.configuration.writeeventlog: | ||
434 | # we log all events to a file if so directed | ||
435 | # register the log file writer as UI Handler | ||
436 | writer = EventWriter(self, self.configuration.writeeventlog) | ||
437 | EventLogWriteHandler = namedtuple('EventLogWriteHandler', ['event']) | ||
438 | self.eventlog = (self.configuration.writeeventlog, bb.event.register_UIHhandler(EventLogWriteHandler(writer))) | ||
439 | 448 | ||
440 | bb.msg.loggerDefaultLogLevel = self.configuration.default_loglevel | 449 | bb.msg.loggerDefaultLogLevel = self.configuration.default_loglevel |
441 | bb.msg.loggerDefaultDomains = self.configuration.debug_domains | 450 | bb.msg.loggerDefaultDomains = self.configuration.debug_domains |