summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-27 11:31:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-08 20:18:55 +0000
commit0c6290b6bc455297bb1c5629607079bede2eba74 (patch)
tree8967652496461c2d8eb202b823446f2fa75be271 /bitbake
parentcfbd125fef570c7a1b5ef812dca17f7930e9419c (diff)
downloadpoky-0c6290b6bc455297bb1c5629607079bede2eba74.tar.gz
bitbake: server/process: Show last 60 lines of the log if the server didn't start
We're seeing issues where the server doesn't start with no logs as to why. Allow the server to print the last 60 log lines just in case this shows us something useful about what is failing. (Bitbake rev: 1351978585b76262cb104f3d609d79c184ee5d2b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/process.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index d12b06ff08..070da4fe7a 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -414,22 +414,28 @@ class BitBakeServer(object):
414 logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)')) 414 logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)'))
415 started = False 415 started = False
416 lines = [] 416 lines = []
417 lastlines = []
417 with open(logfile, "r") as f: 418 with open(logfile, "r") as f:
418 for line in f: 419 for line in f:
419 if started: 420 if started:
420 lines.append(line) 421 lines.append(line)
421 else: 422 else:
423 lastlines.append(line)
422 res = logstart_re.match(line.rstrip()) 424 res = logstart_re.match(line.rstrip())
423 if res: 425 if res:
424 ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format) 426 ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format)
425 if ldatetime >= startdatetime: 427 if ldatetime >= startdatetime:
426 started = True 428 started = True
427 lines.append(line) 429 lines.append(line)
430 if len(lastlines) > 60:
431 lastlines = lastlines[-60:]
428 if lines: 432 if lines:
429 if len(lines) > 60: 433 if len(lines) > 60:
430 bb.error("Last 60 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-60:]))) 434 bb.error("Last 60 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-60:])))
431 else: 435 else:
432 bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines))) 436 bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines)))
437 elif lastlines:
438 bb.error("Server didn't start, last 60 loglines (%s):\n%s" % (logfile, "".join(lastlines)))
433 else: 439 else:
434 bb.error("%s doesn't exist" % logfile) 440 bb.error("%s doesn't exist" % logfile)
435 441