diff options
-rwxr-xr-x | bin/bitbake | 7 | ||||
-rw-r--r-- | lib/bb/__init__.py | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/bin/bitbake b/bin/bitbake index 55d1a670..c0ad32fa 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -70,6 +70,8 @@ Default BBFILES are the .bb files in the current directory.""" ) parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal", action = "store_true", dest = "verbose", default = False ) + parser.add_option( "-D", "--debug", help = "Increase the debug level", + action = "count", dest="debug", default = 0) parser.add_option( "-n", "--dry-run", help = "don't execute, just go through the motions", action = "store_true", dest = "dry_run", default = False ) @@ -588,14 +590,13 @@ def printStats( ): if __name__ == "__main__": - if "BBDEBUG" in os.environ: - bbdebug = int(os.environ["BBDEBUG"]) - make.options, args = handle_options( sys.argv ) if not make.options.cmd: make.options.cmd = "build" + if make.options.debug: + bb.debug_level = make.options.debug make.pkgdata = {} make.cfg = bb.data.init() diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index 07a7f42b..1188145f 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -78,7 +78,15 @@ if sys.version_info[:3] < (2, 3, 0): #projectdir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) projectdir = os.getcwd() -env = {} + +debug_level = 0 + +if "BBDEBUG" in os.environ: + level = int(os.environ["BBDEBUG"]) + if level: + debug_level = level + else: + debug_level = 0 class VarExpandError(Exception): pass @@ -101,7 +109,7 @@ debug_prepend = '' def debug(lvl, *args): - if 'BBDEBUG' in env and (env['BBDEBUG'] >= str(lvl)): + if debug_level >= lvl: print debug_prepend + 'DEBUG:', ''.join(args) def note(*args): |