summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorBenjamin Szőke <egyszeregy@freemail.hu>2025-01-25 13:27:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-19 11:33:23 +0100
commit576d8e4b40ae35bb016035c8ded8351e6d319855 (patch)
treebc764a79489a749fe34f046574badfbbad5efd8c /bitbake
parent48e771c4a6a21373d5070453cb1482e68b30ce56 (diff)
downloadpoky-576d8e4b40ae35bb016035c8ded8351e6d319855.tar.gz
bitbake: knotty: print() was eliminated from all loops for better performance.
Refactoring prints, print() functions were eliminated from all loops and it uses "\n".join(...) in a single print() call for better performance. (Bitbake rev: c32c3d9b83818661e12f3e437563ab4e1fa05e15) Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/knotty.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 732540b462..492ea20763 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -243,9 +243,10 @@ class TerminalFilter(object):
243 243
244 def keepAlive(self, t): 244 def keepAlive(self, t):
245 if not self.cuu: 245 if not self.cuu:
246 print("Bitbake still alive (no events for %ds). Active tasks:" % t) 246 msgbuf = ["Bitbake still alive (no events for %ds). Active tasks:" % t]
247 for t in self.helper.running_tasks: 247 for t in self.helper.running_tasks:
248 print(t) 248 msgbuf.append(str(t))
249 print("\n".join(msgbuf))
249 sys.stdout.flush() 250 sys.stdout.flush()
250 251
251 def updateFooter(self): 252 def updateFooter(self):
@@ -379,13 +380,12 @@ class TerminalFilter(object):
379 self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup) 380 self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
380 381
381def print_event_log(event, includelogs, loglines, termfilter): 382def print_event_log(event, includelogs, loglines, termfilter):
382 # FIXME refactor this out further
383 logfile = event.logfile 383 logfile = event.logfile
384 if logfile and os.path.exists(logfile): 384 if logfile and os.path.exists(logfile):
385 termfilter.clearFooter() 385 termfilter.clearFooter()
386 bb.error("Logfile of failure stored in: %s" % logfile) 386 bb.error("Logfile of failure stored in: %s" % logfile)
387 if includelogs and not event.errprinted: 387 if includelogs and not event.errprinted:
388 bb.plain("Log data follows:") 388 msgbuf = ["Log data follows:"]
389 f = open(logfile, "r") 389 f = open(logfile, "r")
390 lines = [] 390 lines = []
391 while True: 391 while True:
@@ -398,11 +398,11 @@ def print_event_log(event, includelogs, loglines, termfilter):
398 if len(lines) > int(loglines): 398 if len(lines) > int(loglines):
399 lines.pop(0) 399 lines.pop(0)
400 else: 400 else:
401 bb.plain('| %s' % l) 401 msgbuf.append('| %s' % l)
402 f.close() 402 f.close()
403 if lines: 403 if lines:
404 for line in lines: 404 msgbuf.extend(lines)
405 bb.plain(line) 405 print("\n".join(msgbuf))
406 406
407def _log_settings_from_server(server, observe_only): 407def _log_settings_from_server(server, observe_only):
408 # Get values of variables which control our output 408 # Get values of variables which control our output