diff options
author | Michael 'Mickey' Lauer <mickey@vanille-media.de> | 2005-09-08 13:11:53 +0000 |
---|---|---|
committer | Michael 'Mickey' Lauer <mickey@vanille-media.de> | 2005-09-08 13:11:53 +0000 |
commit | 6a5f647e83145ab6d470469974c618511b458827 (patch) | |
tree | 26714b93e571c271bcfa2fc72679791a47d81be9 | |
parent | 3d7348c9eb7deebecce594f005f0019f9139e51c (diff) | |
download | bitbake-6a5f647e83145ab6d470469974c618511b458827.tar.gz |
parser: add function to update the mtime for one file, courtesy Justin Patrin
parser: move import bb and import os out of the commands (import in a function that's called often has a performance penalty)
lib: increase revision
shell: add 'reparse' and 'fileReparse' commands, courtesy Justin Patrin
-rw-r--r-- | lib/bb/__init__.py | 2 | ||||
-rw-r--r-- | lib/bb/parse/__init__.py | 9 | ||||
-rw-r--r-- | lib/bb/shell.py | 31 |
3 files changed, 37 insertions, 5 deletions
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index 00b0e8b57..f27f53b39 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -23,7 +23,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. """ -__version__ = "1.3.2" +__version__ = "1.3.2.1" __all__ = [ diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py index b8839c09f..cb2741606 100644 --- a/lib/bb/parse/__init__.py +++ b/lib/bb/parse/__init__.py @@ -26,6 +26,8 @@ __all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency', 'supports', 'handle', 'init' ] handlers = [] +import bb, os + class ParseError(Exception): """Exception raised when parsing fails""" @@ -34,13 +36,14 @@ class SkipPackage(Exception): __mtime_cache = {} def cached_mtime(f): - import os if not __mtime_cache.has_key(f): - __mtime_cache[f] = os.stat(f)[8] + update_mtime(f) return __mtime_cache[f] +def update_mtime(f): + __mtime_cache[f] = os.stat(f)[8] + def mark_dependency(d, f): - import bb, os if f.startswith('./'): f = "%s/%s" % (os.getcwd(), f[2:]) deps = (bb.data.getVar('__depends', d) or "").split() diff --git a/lib/bb/shell.py b/lib/bb/shell.py index 97e61e116..24406bb80 100644 --- a/lib/bb/shell.py +++ b/lib/bb/shell.py @@ -18,6 +18,12 @@ # Place, Suite 330, Boston, MA 02111-1307 USA. # ########################################################################## +# +# Thanks to: +# * Holger Freyther <zecke@handhelds.org> +# * Justin Patrin <papercrane@reversefold.com> +# +########################################################################## """ BitBake Shell @@ -53,7 +59,7 @@ import sys, os, imp, readline, socket, httplib, urllib, commands, popen2, copy, imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) from bb import data, parse, build, fatal -__version__ = "0.5.2" +__version__ = "0.5.3" __credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> Type 'help' for more information, press CTRL-D to exit.""" % __version__ @@ -252,6 +258,19 @@ class BitBakeShellCommands: self.fileBuild( params ) fileRebuild.usage = "<bbfile>" + def fileReparse( self, params ): + """(re)Parse a bb file""" + bbfile = params[0] + print "SHELL: Parsing '%s'" % bbfile + parse.update_mtime( bbfile ) + bb_data, fromCache = cooker.load_bbfile( bbfile ) + cooker.pkgdata[bbfile] = bb_data + if fromCache: + print "SHELL: File has not been updated, not reparsing" + else: + print "SHELL: Parsed" + fileReparse.usage = "<bbfile>" + def force( self, params ): """Toggle force task execution flag (see bitbake -f)""" cooker.configuration.force = not cooker.configuration.force @@ -391,6 +410,16 @@ SRC_URI = "" parsed = True print + def reparse( self, params ): + """(re)Parse a providee's bb file""" + bbfile = self._findProvider( params[0] ) + if bbfile is not None: + print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ) + self.fileReparse( [ bbfile ] ) + else: + print "ERROR: Nothing provides '%s'" % params[0] + reparse.usage = "<providee>" + def getvar( self, params ): """Dump the contents of an outer BitBake environment variable""" var = params[0] |