summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 389c3cc64d..c6a1d3f98a 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -216,21 +216,25 @@ class TerminalFilter(object):
216 fd = sys.stdin.fileno() 216 fd = sys.stdin.fileno()
217 self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup) 217 self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
218 218
219def main(server, eventHandler, params, tf = TerminalFilter): 219def _log_settings_from_server(server):
220
221 # Get values of variables which control our output 220 # Get values of variables which control our output
222 includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"]) 221 includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"])
223 if error: 222 if error:
224 logger.error("Unable to get the value of BBINCLUDELOGS variable: %s" % error) 223 logger.error("Unable to get the value of BBINCLUDELOGS variable: %s" % error)
225 return 1 224 raise BaseException(error)
226 loglines, error = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"]) 225 loglines, error = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"])
227 if error: 226 if error:
228 logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error) 227 logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error)
229 return 1 228 raise BaseException(error)
230 consolelogfile, error = server.runCommand(["getVariable", "BB_CONSOLELOG"]) 229 consolelogfile, error = server.runCommand(["getVariable", "BB_CONSOLELOG"])
231 if error: 230 if error:
232 logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error) 231 logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error)
233 return 1 232 raise BaseException(error)
233 return includelogs, loglines, consolelogfile
234
235def main(server, eventHandler, params, tf = TerminalFilter):
236
237 includelogs, loglines, consolelogfile = _log_settings_from_server(server)
234 238
235 if sys.stdin.isatty() and sys.stdout.isatty(): 239 if sys.stdin.isatty() and sys.stdout.isatty():
236 log_exec_tty = True 240 log_exec_tty = True
@@ -254,7 +258,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
254 consolelog.setFormatter(conlogformat) 258 consolelog.setFormatter(conlogformat)
255 logger.addHandler(consolelog) 259 logger.addHandler(consolelog)
256 260
257 try: 261 if not params.observe_only:
258 params.updateFromServer(server) 262 params.updateFromServer(server)
259 cmdline = params.parseActions() 263 cmdline = params.parseActions()
260 if not cmdline: 264 if not cmdline:
@@ -271,9 +275,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
271 elif ret != True: 275 elif ret != True:
272 logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) 276 logger.error("Command '%s' failed: returned %s" % (cmdline, ret))
273 return 1 277 return 1
274 except xmlrpclib.Fault as x: 278
275 logger.error("XMLRPC Fault getting commandline:\n %s" % x)
276 return 1
277 279
278 parseprogress = None 280 parseprogress = None
279 cacheprogress = None 281 cacheprogress = None
@@ -320,7 +322,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
320 elif event.levelno == format.WARNING: 322 elif event.levelno == format.WARNING:
321 warnings = warnings + 1 323 warnings = warnings + 1
322 # For "normal" logging conditions, don't show note logs from tasks 324 # For "normal" logging conditions, don't show note logs from tasks
323 # but do show them if the user has changed the default log level to 325 # but do show them if the user has changed the default log level to
324 # include verbose/debug messages 326 # include verbose/debug messages
325 if event.taskpid != 0 and event.levelno <= format.NOTE: 327 if event.taskpid != 0 and event.levelno <= format.NOTE:
326 continue 328 continue
@@ -469,12 +471,15 @@ def main(server, eventHandler, params, tf = TerminalFilter):
469 pass 471 pass
470 except KeyboardInterrupt: 472 except KeyboardInterrupt:
471 termfilter.clearFooter() 473 termfilter.clearFooter()
472 if main.shutdown == 1: 474 if params.observe_only:
475 print("\nKeyboard Interrupt, exiting observer...")
476 main.shutdown = 2
477 if not params.observe_only and main.shutdown == 1:
473 print("\nSecond Keyboard Interrupt, stopping...\n") 478 print("\nSecond Keyboard Interrupt, stopping...\n")
474 _, error = server.runCommand(["stateStop"]) 479 _, error = server.runCommand(["stateStop"])
475 if error: 480 if error:
476 logger.error("Unable to cleanly stop: %s" % error) 481 logger.error("Unable to cleanly stop: %s" % error)
477 if main.shutdown == 0: 482 if not params.observe_only and main.shutdown == 0:
478 print("\nKeyboard Interrupt, closing down...\n") 483 print("\nKeyboard Interrupt, closing down...\n")
479 interrupted = True 484 interrupted = True
480 _, error = server.runCommand(["stateShutdown"]) 485 _, error = server.runCommand(["stateShutdown"])