summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-20 22:54:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-22 12:10:13 +0100
commitf0930c8d63cc9fd8ead759b3230ab708fffa6ed4 (patch)
treed589dce4ac5f1fb34ee6d21fc9889a9d6a48b81d /bitbake/lib/bb/ui/knotty.py
parentf242f5060bbc62815b6d5a245c1a9bf18f23675f (diff)
downloadpoky-f0930c8d63cc9fd8ead759b3230ab708fffa6ed4.tar.gz
bitbake: cooker: Move commandline parsing back into the UI/cookerdata
Building up a set of actions for the server is tricky since we depend upon the commandline but fall back to values from the datastore. We should be able to build a datastore without a commandline and vice versa. Ultimately the UI should send the commands to the server. This patch amounts to code rearranging, moving the heavy lifting to the UI, though a helper in the configuration option. This will need further cleanup/tweaking but this should be the only update needed to the UIs. The code now queries the server for any missing data should it need to. This code allows various knowledge of configuration variables to move to the UI side only, partcularly pkgs_to_build but also all the command specifiers. It should also be possible to move cmd eventually, I'm just unsure if any callers call the commands expecting this to default to something sane right now. (Bitbake rev: 2dbbb1d51dafd4451fef8fe16f095bcd4b8f1177) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 6ea7d8694c..389c3cc64d 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -216,7 +216,7 @@ 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, tf = TerminalFilter): 219def main(server, eventHandler, params, tf = TerminalFilter):
220 220
221 # Get values of variables which control our output 221 # Get values of variables which control our output
222 includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"]) 222 includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"])
@@ -245,7 +245,8 @@ def main(server, eventHandler, tf = TerminalFilter):
245 bb.msg.addDefaultlogFilter(console) 245 bb.msg.addDefaultlogFilter(console)
246 console.setFormatter(format) 246 console.setFormatter(format)
247 logger.addHandler(console) 247 logger.addHandler(console)
248 if consolelogfile: 248
249 if consolelogfile and not params.options.show_environment:
249 bb.utils.mkdirhier(os.path.dirname(consolelogfile)) 250 bb.utils.mkdirhier(os.path.dirname(consolelogfile))
250 conlogformat = bb.msg.BBLogFormatter(format_str) 251 conlogformat = bb.msg.BBLogFormatter(format_str)
251 consolelog = logging.FileHandler(consolelogfile) 252 consolelog = logging.FileHandler(consolelogfile)
@@ -254,14 +255,16 @@ def main(server, eventHandler, tf = TerminalFilter):
254 logger.addHandler(consolelog) 255 logger.addHandler(consolelog)
255 256
256 try: 257 try:
257 cmdline, error = server.runCommand(["getCmdLineAction"]) 258 params.updateFromServer(server)
258 if error: 259 cmdline = params.parseActions()
259 logger.error("Unable to get bitbake commandline arguments: %s" % error) 260 if not cmdline:
260 return 1
261 elif not cmdline:
262 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") 261 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
263 return 1 262 return 1
264 ret, error = server.runCommand(cmdline) 263 if 'msg' in cmdline and cmdline['msg']:
264 logger.error(cmdline['msg'])
265 return 1
266
267 ret, error = server.runCommand(cmdline['action'])
265 if error: 268 if error:
266 logger.error("Command '%s' failed: %s" % (cmdline, error)) 269 logger.error("Command '%s' failed: %s" % (cmdline, error))
267 return 1 270 return 1