diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-20 22:54:41 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-22 12:10:13 +0100 |
commit | f0930c8d63cc9fd8ead759b3230ab708fffa6ed4 (patch) | |
tree | d589dce4ac5f1fb34ee6d21fc9889a9d6a48b81d /bitbake/lib/bb/ui | |
parent | f242f5060bbc62815b6d5a245c1a9bf18f23675f (diff) | |
download | poky-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')
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 16 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/goggle.py | 14 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/hob.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 19 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 14 |
5 files changed, 38 insertions, 28 deletions
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index 85910f6925..885c31aeac 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py | |||
@@ -196,16 +196,18 @@ class gtkthread(threading.Thread): | |||
196 | gtkthread.quit.set() | 196 | gtkthread.quit.set() |
197 | 197 | ||
198 | 198 | ||
199 | def main(server, eventHandler): | 199 | def main(server, eventHandler, params): |
200 | try: | 200 | try: |
201 | cmdline, error = server.runCommand(["getCmdLineAction"]) | 201 | params.updateFromServer(server) |
202 | if error: | 202 | cmdline = params.parseActions() |
203 | print("Error getting bitbake commandline: %s" % error) | 203 | if not cmdline: |
204 | return 1 | ||
205 | elif not cmdline: | ||
206 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") | 204 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") |
207 | return 1 | 205 | return 1 |
208 | elif not cmdline or cmdline[0] != "generateDotGraph": | 206 | if 'msg' in cmdline and cmdline['msg']: |
207 | logger.error(cmdline['msg']) | ||
208 | return 1 | ||
209 | cmdline = cmdline['action'] | ||
210 | if not cmdline or cmdline[0] != "generateDotGraph": | ||
209 | print("This UI is only compatible with the -g option") | 211 | print("This UI is only compatible with the -g option") |
210 | return 1 | 212 | return 1 |
211 | ret, error = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]]) | 213 | ret, error = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]]) |
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py index e8a54ab295..16faba4c21 100644 --- a/bitbake/lib/bb/ui/goggle.py +++ b/bitbake/lib/bb/ui/goggle.py | |||
@@ -63,7 +63,7 @@ class MainWindow (gtk.Window): | |||
63 | scrolled_window.add (self.cur_build_tv) | 63 | scrolled_window.add (self.cur_build_tv) |
64 | 64 | ||
65 | 65 | ||
66 | def main (server, eventHandler): | 66 | def main (server, eventHandler, params): |
67 | gobject.threads_init() | 67 | gobject.threads_init() |
68 | gtk.gdk.threads_init() | 68 | gtk.gdk.threads_init() |
69 | 69 | ||
@@ -80,13 +80,15 @@ def main (server, eventHandler): | |||
80 | running_build.connect ("build-failed", running_build_failed_cb) | 80 | running_build.connect ("build-failed", running_build_failed_cb) |
81 | 81 | ||
82 | try: | 82 | try: |
83 | cmdline, error = server.runCommand(["getCmdLineAction"]) | 83 | params.updateFromServer(server) |
84 | if error: | 84 | cmdline = params.parseActions() |
85 | print("Error getting bitbake commandline: %s" % error) | 85 | if not cmdline: |
86 | return 1 | ||
87 | elif not cmdline: | ||
88 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") | 86 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") |
89 | return 1 | 87 | return 1 |
88 | if 'msg' in cmdline and cmdline['msg']: | ||
89 | logger.error(cmdline['msg']) | ||
90 | return 1 | ||
91 | cmdline = cmdline['action'] | ||
90 | ret, error = server.runCommand(cmdline) | 92 | ret, error = server.runCommand(cmdline) |
91 | if error: | 93 | if error: |
92 | print("Error running command '%s': %s" % (cmdline, error)) | 94 | print("Error running command '%s': %s" % (cmdline, error)) |
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py index 55bd84cca8..2c75cb8fd1 100755 --- a/bitbake/lib/bb/ui/hob.py +++ b/bitbake/lib/bb/ui/hob.py | |||
@@ -58,7 +58,8 @@ def event_handle_idle_func(eventHandler, hobHandler): | |||
58 | event = eventHandler.getEvent() | 58 | event = eventHandler.getEvent() |
59 | return True | 59 | return True |
60 | 60 | ||
61 | def main (server = None, eventHandler = None): | 61 | def main (server, eventHandler, params): |
62 | params.updateFromServer(server) | ||
62 | gobject.threads_init() | 63 | gobject.threads_init() |
63 | 64 | ||
64 | # That indicates whether the Hob and the bitbake server are | 65 | # That indicates whether the Hob and the bitbake server are |
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 | ||
219 | def main(server, eventHandler, tf = TerminalFilter): | 219 | def 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 |
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 98647fc3e0..c45ffd63ac 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -196,7 +196,7 @@ class NCursesUI: | |||
196 | # t.start() | 196 | # t.start() |
197 | 197 | ||
198 | #-------------------------------------------------------------------------# | 198 | #-------------------------------------------------------------------------# |
199 | def main(self, stdscr, server, eventHandler): | 199 | def main(self, stdscr, server, eventHandler, params): |
200 | #-------------------------------------------------------------------------# | 200 | #-------------------------------------------------------------------------# |
201 | height, width = stdscr.getmaxyx() | 201 | height, width = stdscr.getmaxyx() |
202 | 202 | ||
@@ -236,13 +236,15 @@ class NCursesUI: | |||
236 | shutdown = 0 | 236 | shutdown = 0 |
237 | 237 | ||
238 | try: | 238 | try: |
239 | cmdline, error = server.runCommand(["getCmdLineAction"]) | 239 | params.updateFromServer(server) |
240 | cmdline = params.parseActions() | ||
240 | if not cmdline: | 241 | if not cmdline: |
241 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") | 242 | print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") |
242 | return | 243 | return 1 |
243 | elif error: | 244 | if 'msg' in cmdline and cmdline['msg']: |
244 | print("Error getting bitbake commandline: %s" % error) | 245 | logger.error(cmdline['msg']) |
245 | return | 246 | return 1 |
247 | cmdline = cmdline['action'] | ||
246 | ret, error = server.runCommand(cmdline) | 248 | ret, error = server.runCommand(cmdline) |
247 | if error: | 249 | if error: |
248 | print("Error running command '%s': %s" % (cmdline, error)) | 250 | print("Error running command '%s': %s" % (cmdline, error)) |