]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: cooker/knotty: Prefix parse logs with filename being parsed
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Apr 2016 13:29:27 +0000 (14:29 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 15 Apr 2016 05:59:44 +0000 (06:59 +0100)
We now prefix log messages coming from worker task context with the
PF and task info, however parsing messages all have to be manually
prefixed which is ugly and error prone. This change modifies the log
handler filter so this happens automatically, meaning we don't have
to change every message to include that information. This makes error
messages longer but more usable.

(Bitbake rev: 1af0ccaac81e182c4ca520037dda362d180e5605)

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

index 4068b8f9b3a134a8b90e39ebdacf931d1071f2b8..9b565fc37df04ddc83cd30517246ceb3e7953545 100644 (file)
@@ -1970,9 +1970,17 @@ class Parser(multiprocessing.Process):
 
     def parse(self, filename, appends, caches_array):
         try:
+            # Record the filename we're parsing into any events generated
+            def parse_filter(self, record):
+                record.taskpid = bb.event.worker_pid
+                record.fn = filename
+                return True
+
             # Reset our environment and handlers to the original settings
             bb.utils.set_context(self.context.copy())
             bb.event.set_class_handlers(self.handlers.copy())
+            bb.event.LogHandler.filter = parse_filter
+
             return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array)
         except Exception as exc:
             tb = sys.exc_info()[2]
index dff92bce913a597427bc6aced5e5c1e725e0d06b..2fc20cfb53208c10cd736d0460b0c3f30a700d53 100644 (file)
@@ -371,7 +371,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
                     if event.taskpid in helper.running_tasks:
                         taskinfo = helper.running_tasks[event.taskpid]
                         event.msg = taskinfo['title'] + ': ' + event.msg
-
+                if hasattr(event, 'fn'):
+                        event.msg = event.fn + ': ' + event.msg
                 logger.handle(event)
                 continue