From 4b4c7e596cd4667da773e73ff9864eca8d85804c Mon Sep 17 00:00:00 2001 From: Michael 'Mickey' Lauer Date: Tue, 14 Jun 2005 09:19:20 +0000 Subject: - add 'fetch', 'unpack', 'patch', 'configure', 'compile', 'stage' which reflect the execution of the respective tasks on providees - add 'force' to toggle make.options.force - switch to a more sane context sensitive completion method inspecting the 'usage' attribute --- lib/bb/shell.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'lib/bb') diff --git a/lib/bb/shell.py b/lib/bb/shell.py index fb12d7a5f..f8176cd36 100644 --- a/lib/bb/shell.py +++ b/lib/bb/shell.py @@ -129,6 +129,16 @@ class BitBakeShellCommands: self.build( params, "clean" ) clean.usage = "" + def compile( self, params ): + """Execute 'compile' on a providee""" + self.build( params, "compile" ) + compile.usage = "" + + def configure( self, params ): + """Execute 'configure' on a providee""" + self.build( params, "configure" ) + configure.usage = "" + def edit( self, params ): """Call $EDITOR on a .bb file""" name = params[0] @@ -145,6 +155,11 @@ class BitBakeShellCommands: global leave_mainloop leave_mainloop = True + def fetch( self, params ): + """Fetch a providee""" + self.build( params, "fetch" ) + fetch.usage = "" + def fileBuild( self, params, cmd = "build" ): """Parse and build a .bb file""" name = params[0] @@ -184,6 +199,11 @@ class BitBakeShellCommands: self.fileBuild( params ) fileRebuild.usage = "" + def force( self, params ): + """Toggle force task execution flag (see bitbake -f)""" + make.options.force = not make.options.force + print "SHELL: Force Flag is now '%s'" % repr( make.options.force ) + def help( self, params ): """Show a comprehensive list of commands and their purpose""" print "="*30, "Available Commands", "="*30 @@ -287,6 +307,11 @@ SRC_URI = "" else: print "ERROR: %s %s" % ( response.status, response.reason ) + def patch( self, params ): + """Execute 'patch' command on a providee""" + self.build( params, "patch" ) + patch.usage = "" + def parse( self, params ): """(Re-)parse .bb files and calculate the dependency graph""" cooker.status = cooker.ParsingStatus() @@ -334,6 +359,11 @@ SRC_URI = "" print commands.getoutput( " ".join( params ) ) shell.usage = "<...>" + def stage( self, params ): + """Execute 'stage' on a providee""" + self.build( params, "stage" ) + stage.usage = "" + def status( self, params ): """""" print "-" * 78 @@ -350,6 +380,11 @@ SRC_URI = "" """""" print "testCommand called with '%s'" % params + def unpack( self, params ): + """Execute 'unpack' on a providee""" + self.build( params, "unpack" ) + unpack.usage = "" + def which( self, params ): """Computes the providers for a given providee""" item = params[0] @@ -417,14 +452,17 @@ def completer( text, state ): if " " in line: line = line.split() # we are in second (or more) argument - if line[0] == "print" or line[0] == "set": - allmatches = make.cfg.keys() - elif line[0].startswith( "file" ): - if make.pkgdata is None: allmatches = [ "(No Matches Available. Parsed yet?)" ] - else: allmatches = [ x.split("/")[-1] for x in make.pkgdata.keys() ] - elif line[0] == "build" or line[0] == "clean" or line[0] == "which": - if make.pkgdata is None: allmatches = [ "(No Matches Available. Parsed yet?)" ] - else: allmatches = cooker.status.providers.iterkeys() + if line[0] in cmds and hasattr( cmds[line[0]][0], "usage" ): # known command and usage + u = getattr( cmds[line[0]][0], "usage" ).split()[0] + if u == "": + allmatches = make.cfg.keys() + elif u == "": + if make.pkgdata is None: allmatches = [ "(No Matches Available. Parsed yet?)" ] + else: allmatches = [ x.split("/")[-1] for x in make.pkgdata.keys() ] + elif u == "": + if make.pkgdata is None: allmatches = [ "(No Matches Available. Parsed yet?)" ] + else: allmatches = cooker.status.providers.iterkeys() + else: allmatches = [ "(No tab completion available for this command)" ] else: allmatches = [ "(No tab completion available for this command)" ] else: # we are in first argument -- cgit 1.2.3-korg