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>
This commit is contained in:
Benjamin Szőke 2025-01-25 13:27:52 +01:00 committed by Richard Purdie
parent 48e771c4a6
commit 576d8e4b40

View File

@ -243,9 +243,10 @@ class TerminalFilter(object):
def keepAlive(self, t):
if not self.cuu:
print("Bitbake still alive (no events for %ds). Active tasks:" % t)
msgbuf = ["Bitbake still alive (no events for %ds). Active tasks:" % t]
for t in self.helper.running_tasks:
print(t)
msgbuf.append(str(t))
print("\n".join(msgbuf))
sys.stdout.flush()
def updateFooter(self):
@ -379,13 +380,12 @@ class TerminalFilter(object):
self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
def print_event_log(event, includelogs, loglines, termfilter):
# FIXME refactor this out further
logfile = event.logfile
if logfile and os.path.exists(logfile):
termfilter.clearFooter()
bb.error("Logfile of failure stored in: %s" % logfile)
if includelogs and not event.errprinted:
bb.plain("Log data follows:")
msgbuf = ["Log data follows:"]
f = open(logfile, "r")
lines = []
while True:
@ -398,11 +398,11 @@ def print_event_log(event, includelogs, loglines, termfilter):
if len(lines) > int(loglines):
lines.pop(0)
else:
bb.plain('| %s' % l)
msgbuf.append('| %s' % l)
f.close()
if lines:
for line in lines:
bb.plain(line)
msgbuf.extend(lines)
print("\n".join(msgbuf))
def _log_settings_from_server(server, observe_only):
# Get values of variables which control our output