# may reuse the previous log file so restart the bitbake server.
bitbake("--kill-server")
+ def print_condensed_error_log(logs, context_lines=10, tail_lines=20):
+ """Prints errors with context and the end of the log."""
+
+ logs = logs.split("\n")
+ for i, line in enumerate(logs):
+ if line.startswith("ERROR"):
+ self.logger.info("Found ERROR (line %d):" % (i + 1))
+ for l in logs[i-context_lines:i+context_lines]:
+ self.logger.info(" " + l)
+
+ self.logger.info("End of log:")
+ for l in logs[-tail_lines:]:
+ self.logger.info(" " + l)
+
bitbake_failure_count = 0
if not use_sstate:
if self.sstate_targets:
self.logger.info("Building prebuild for %s (sstate allowed)..." % (name))
self.write_config(config)
try:
- bitbake("--continue "+' '.join(self.sstate_targets), limit_exc_output=20)
+ bitbake("--continue "+' '.join(self.sstate_targets))
except AssertionError as e:
bitbake_failure_count += 1
self.logger.error("Bitbake failed! but keep going... Log:")
- for line in str(e).split("\n"):
- self.logger.info(" "+line)
+ print_condensed_error_log(str(e))
# This config fragment will disable using shared and the sstate
# mirror, forcing a complete build from scratch
d = get_bb_vars(capture_vars)
# targets used to be called images
try:
- bitbake("--continue "+' '.join(getattr(self, 'images', self.targets)), limit_exc_output=20)
+ bitbake("--continue "+' '.join(getattr(self, 'images', self.targets)))
except AssertionError as e:
bitbake_failure_count += 1
-
self.logger.error("Bitbake failed! but keep going... Log:")
- for line in str(e).split("\n"):
- self.logger.info(" "+line)
+ print_condensed_error_log(str(e))
# The calling function expects the existence of the deploy
# directories containing the packages.