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-02-25 22:27:46 +0000
commit27d5f46f45eacc32ad14a29edbc15428279d6b63 (patch)
tree2ce7456c309bd0e38256cf5c2402ddfe4011039f /bitbake
parentba9f093318fffb3abef7eb2a6ca60566cf24ac69 (diff)
downloadpoky-27d5f46f45eacc32ad14a29edbc15428279d6b63.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: da54a3fef9cee308dfa87eea9b9638796d734abd) 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 1f71c5cd2e..0c6351d2e8 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -408,22 +408,28 @@ class BitBakeServer(object):
408 logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)')) 408 logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)'))
409 started = False 409 started = False
410 lines = [] 410 lines = []
411 lastlines = []
411 with open(logfile, "r") as f: 412 with open(logfile, "r") as f:
412 for line in f: 413 for line in f:
413 if started: 414 if started:
414 lines.append(line) 415 lines.append(line)
415 else: 416 else:
417 lastlines.append(line)
416 res = logstart_re.match(line.rstrip()) 418 res = logstart_re.match(line.rstrip())
417 if res: 419 if res:
418 ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format) 420 ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format)
419 if ldatetime >= startdatetime: 421 if ldatetime >= startdatetime:
420 started = True 422 started = True
421 lines.append(line) 423 lines.append(line)
424 if len(lastlines) > 60:
425 lastlines = lastlines[-60:]
422 if lines: 426 if lines:
423 if len(lines) > 60: 427 if len(lines) > 60:
424 bb.error("Last 60 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-60:]))) 428 bb.error("Last 60 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-60:])))
425 else: 429 else:
426 bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines))) 430 bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines)))
431 elif lastlines:
432 bb.error("Server didn't start, last 60 loglines (%s):\n%s" % (logfile, "".join(lastlines)))
427 else: 433 else:
428 bb.error("%s doesn't exist" % logfile) 434 bb.error("%s doesn't exist" % logfile)
429 435