diff mbox series

[bitbake-devel,v2] build: prefix the tasks with a timestamp in the log task_order

Message ID 20220805094750.390489-1-jose.quaresma@foundries.io
State New
Headers show
Series [bitbake-devel,v2] build: prefix the tasks with a timestamp in the log task_order | expand

Commit Message

Jose Quaresma Aug. 5, 2022, 9:47 a.m. UTC
This is useful when debugging as it helps understand possible
race conditions between tasks of diferent recipes.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---

 V2: import full datetime module

 lib/bb/build.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 55f68b98..b8c1099e 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -20,6 +20,7 @@  import itertools
 import time
 import re
 import stat
+import datetime
 import bb
 import bb.msg
 import bb.process
@@ -618,7 +619,8 @@  def _exec_task(fn, task, d, quieterr):
     logorder = os.path.join(tempdir, 'log.task_order')
     try:
         with open(logorder, 'a') as logorderfile:
-            logorderfile.write('{0} ({1}): {2}\n'.format(task, os.getpid(), logbase))
+            timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S.%f")
+            logorderfile.write('{0} {1} ({2}): {3}\n'.format(timestamp, task, os.getpid(), logbase))
     except OSError:
         logger.exception("Opening log file '%s'", logorder)
         pass