summaryrefslogtreecommitdiff
path: root/bitbake/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake165
-rwxr-xr-xbitbake/bin/bitdoc26
2 files changed, 101 insertions, 90 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 6d74e5b85..fdf1e20f8 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -22,127 +22,137 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import sys, os, getopt, re, time, optparse, xmlrpclib
-sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+import os
+import sys
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])),
+ 'lib'))
+
+import optparse
+import warnings
+from traceback import format_exception
import bb
+import bb.msg
from bb import cooker
from bb import ui
from bb import server
from bb.server import none
#from bb.server import xmlrpc
-__version__ = "1.9.0"
+__version__ = "1.11.0"
+
-if sys.hexversion < 0x020500F0:
- print "Sorry, python 2.5 or later is required for this version of bitbake"
- sys.exit(1)
#============================================================================#
# BBOptions
#============================================================================#
-class BBConfiguration( object ):
+class BBConfiguration(object):
"""
Manages build options and configurations for one run
"""
- def __init__( self, options ):
+
+ def __init__(self, options):
for key, val in options.__dict__.items():
- setattr( self, key, val )
+ setattr(self, key, val)
+ self.pkgs_to_build = []
def print_exception(exc, value, tb):
- """
- Print the exception to stderr, only showing the traceback if bitbake
- debugging is enabled.
- """
- if not bb.msg.debug_level['default']:
- tb = None
+ """Send exception information through bb.msg"""
+ bb.fatal("".join(format_exception(exc, value, tb, limit=8)))
+
+sys.excepthook = print_exception
- sys.__excepthook__(exc, value, tb)
+_warnings_showwarning = warnings.showwarning
+def _showwarning(message, category, filename, lineno, file=None, line=None):
+ """Display python warning messages using bb.msg"""
+ if file is not None:
+ if _warnings_showwarning is not None:
+ _warnings_showwarning(message, category, filename, lineno, file, line)
+ else:
+ s = warnings.formatwarning(message, category, filename, lineno)
+ s = s.split("\n")[0]
+ bb.msg.warn(None, s)
+
+warnings.showwarning = _showwarning
+warnings.simplefilter("ignore", DeprecationWarning)
#============================================================================#
# main
#============================================================================#
def main():
- return_value = 0
- pythonver = sys.version_info
- if pythonver[0] < 2 or (pythonver[0] == 2 and pythonver[1] < 5):
- print "Sorry, bitbake needs python 2.5 or later."
- sys.exit(1)
+ return_value = 1
- parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ),
- usage = """%prog [options] [package ...]
+ parser = optparse.OptionParser(
+ version = "BitBake Build Tool Core version %s, %%prog version %s" % (bb.__version__, __version__),
+ usage = """%prog [options] [package ...]
Executes the specified task (default is 'build') for a given set of BitBake files.
It expects that BBFILES is defined, which is a space separated list of files to
be executed. BBFILES does support wildcards.
-Default BBFILES are the .bb files in the current directory.""" )
-
- parser.add_option( "-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
- action = "store", dest = "buildfile", default = None )
+Default BBFILES are the .bb files in the current directory.""")
- parser.add_option( "-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
- action = "store_false", dest = "abort", default = True )
+ parser.add_option("-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
+ action = "store", dest = "buildfile", default = None)
- parser.add_option( "-a", "--tryaltconfigs", help = "continue with builds by trying to use alternative providers where possible.",
- action = "store_true", dest = "tryaltconfigs", default = False )
+ parser.add_option("-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
+ action = "store_false", dest = "abort", default = True)
- parser.add_option( "-f", "--force", help = "force run of specified cmd, regardless of stamp status",
- action = "store_true", dest = "force", default = False )
+ parser.add_option("-a", "--tryaltconfigs", help = "continue with builds by trying to use alternative providers where possible.",
+ action = "store_true", dest = "tryaltconfigs", default = False)
- parser.add_option( "-i", "--interactive", help = "drop into the interactive mode also called the BitBake shell.",
- action = "store_true", dest = "interactive", default = False )
+ parser.add_option("-f", "--force", help = "force run of specified cmd, regardless of stamp status",
+ action = "store_true", dest = "force", default = False)
- parser.add_option( "-c", "--cmd", help = "Specify task to execute. Note that this only executes the specified task for the providee and the packages it depends on, i.e. 'compile' does not implicitly call stage for the dependencies (IOW: use only if you know what you are doing). Depending on the base.bbclass a listtasks tasks is defined and will show available tasks",
- action = "store", dest = "cmd" )
+ parser.add_option("-c", "--cmd", help = "Specify task to execute. Note that this only executes the specified task for the providee and the packages it depends on, i.e. 'compile' does not implicitly call stage for the dependencies (IOW: use only if you know what you are doing). Depending on the base.bbclass a listtasks tasks is defined and will show available tasks",
+ action = "store", dest = "cmd")
- parser.add_option( "-r", "--read", help = "read the specified file before bitbake.conf",
- action = "append", dest = "file", default = [] )
+ parser.add_option("-r", "--read", help = "read the specified file before bitbake.conf",
+ action = "append", dest = "file", default = [])
- parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal",
- action = "store_true", dest = "verbose", default = False )
+ 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. You can specify this more than once.",
+ parser.add_option("-D", "--debug", help = "Increase the debug level. You can specify this more than once.",
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 )
+ parser.add_option("-n", "--dry-run", help = "don't execute, just go through the motions",
+ action = "store_true", dest = "dry_run", default = False)
- parser.add_option( "-p", "--parse-only", help = "quit after parsing the BB files (developers only)",
- action = "store_true", dest = "parse_only", default = False )
+ parser.add_option("-p", "--parse-only", help = "quit after parsing the BB files (developers only)",
+ action = "store_true", dest = "parse_only", default = False)
- parser.add_option( "-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
- action = "store_true", dest = "disable_psyco", default = False )
+ parser.add_option("-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
+ action = "store_true", dest = "disable_psyco", default = False)
- parser.add_option( "-s", "--show-versions", help = "show current and preferred versions of all packages",
- action = "store_true", dest = "show_versions", default = False )
+ parser.add_option("-s", "--show-versions", help = "show current and preferred versions of all packages",
+ action = "store_true", dest = "show_versions", default = False)
- parser.add_option( "-e", "--environment", help = "show the global or per-package environment (this is what used to be bbread)",
- action = "store_true", dest = "show_environment", default = False )
+ parser.add_option("-e", "--environment", help = "show the global or per-package environment (this is what used to be bbread)",
+ action = "store_true", dest = "show_environment", default = False)
- parser.add_option( "-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
- action = "store_true", dest = "dot_graph", default = False )
+ parser.add_option("-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
+ action = "store_true", dest = "dot_graph", default = False)
- parser.add_option( "-I", "--ignore-deps", help = """Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""",
- action = "append", dest = "extra_assume_provided", default = [] )
+ parser.add_option("-I", "--ignore-deps", help = """Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""",
+ action = "append", dest = "extra_assume_provided", default = [])
- parser.add_option( "-l", "--log-domains", help = """Show debug logging for the specified logging domains""",
- action = "append", dest = "debug_domains", default = [] )
+ parser.add_option("-l", "--log-domains", help = """Show debug logging for the specified logging domains""",
+ action = "append", dest = "debug_domains", default = [])
- parser.add_option( "-P", "--profile", help = "profile the command and print a report",
- action = "store_true", dest = "profile", default = False )
+ parser.add_option("-P", "--profile", help = "profile the command and print a report",
+ action = "store_true", dest = "profile", default = False)
- parser.add_option( "-u", "--ui", help = "userinterface to use",
+ parser.add_option("-u", "--ui", help = "userinterface to use",
action = "store", dest = "ui")
- parser.add_option( "", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
- action = "store_true", dest = "revisions_changed", default = False )
+ parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
+ action = "store_true", dest = "revisions_changed", default = False)
options, args = parser.parse_args(sys.argv)
configuration = BBConfiguration(options)
- configuration.pkgs_to_build = []
configuration.pkgs_to_build.extend(args[1:])
#server = bb.server.xmlrpc
@@ -150,7 +160,7 @@ Default BBFILES are the .bb files in the current directory.""" )
# Save a logfile for cooker into the current working directory. When the
# server is daemonized this logfile will be truncated.
- cooker_logfile = os.path.join (os.getcwd(), "cooker.log")
+ cooker_logfile = os.path.join(os.getcwd(), "cooker.log")
bb.utils.init_logger(bb.msg, configuration.verbose, configuration.debug,
configuration.debug_domains)
@@ -169,8 +179,6 @@ Default BBFILES are the .bb files in the current directory.""" )
server.BitBakeServerFork(serverinfo, cooker.serve, cooker_logfile)
del cooker
- sys.excepthook = print_exception
-
# Setup a connection to the server (cooker)
serverConnection = server.BitBakeServerConnection(serverinfo)
@@ -181,19 +189,24 @@ Default BBFILES are the .bb files in the current directory.""" )
ui = "knotty"
try:
- # Dynamically load the UI based on the ui name. Although we
- # suggest a fixed set this allows you to have flexibility in which
- # ones are available.
- exec "from bb.ui import " + ui
- exec "return_value = " + ui + ".init(serverConnection.connection, serverConnection.events)"
- except ImportError:
+ # Dynamically load the UI based on the ui name. Although we
+ # suggest a fixed set this allows you to have flexibility in which
+ # ones are available.
+ uimodule = __import__("bb.ui", fromlist = [ui])
+ ui_init = getattr(uimodule, ui).init
+ except AttributeError:
print "FATAL: Invalid user interface '%s' specified. " % ui
print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
- except Exception, e:
- print "FATAL: Unable to start to '%s' UI due to exception: %s." % (configuration.ui, e)
+ else:
+ try:
+ return_value = ui_init(serverConnection.connection, serverConnection.events)
+ except Exception as e:
+ print "FATAL: Unable to start to '%s' UI: %s" % (ui, e)
+ raise
finally:
serverConnection.terminate()
- return return_value
+
+ return return_value
if __name__ == "__main__":
ret = main()
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 4940f660a..8043b2bd1 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -48,7 +48,7 @@ class HTMLFormatter:
From pydoc... almost identical at least
"""
while pairs:
- (a,b) = pairs[0]
+ (a, b) = pairs[0]
text = join(split(text, a), b)
pairs = pairs[1:]
return text
@@ -87,7 +87,7 @@ class HTMLFormatter:
return txt + ",".join(txts)
- def groups(self,item):
+ def groups(self, item):
"""
Create HTML to link to related groups
"""
@@ -99,12 +99,12 @@ class HTMLFormatter:
txt = "<p><b>See also:</b><br>"
txts = []
for group in item.groups():
- txts.append( """<a href="group%s.html">%s</a> """ % (group,group) )
+ txts.append( """<a href="group%s.html">%s</a> """ % (group, group) )
return txt + ",".join(txts)
- def createKeySite(self,item):
+ def createKeySite(self, item):
"""
Create a site for a key. It contains the header/navigator, a heading,
the description, links to related keys and to the groups.
@@ -149,8 +149,7 @@ class HTMLFormatter:
"""
groups = ""
- sorted_groups = doc.groups()
- sorted_groups.sort()
+ sorted_groups = sorted(doc.groups())
for group in sorted_groups:
groups += """<a href="group%s.html">%s</a><br>""" % (group, group)
@@ -185,8 +184,7 @@ class HTMLFormatter:
Create Overview of all avilable keys
"""
keys = ""
- sorted_keys = doc.doc_keys()
- sorted_keys.sort()
+ sorted_keys = sorted(doc.doc_keys())
for key in sorted_keys:
keys += """<a href="key%s.html">%s</a><br>""" % (key, key)
@@ -214,7 +212,7 @@ class HTMLFormatter:
description += "<h2 Description of Grozp %s</h2>" % gr
description += _description
- items.sort(lambda x,y:cmp(x.name(),y.name()))
+ items.sort(lambda x, y:cmp(x.name(), y.name()))
for group in items:
groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name())
@@ -343,7 +341,7 @@ class DocumentationItem:
def addGroup(self, group):
self._groups.append(group)
- def addRelation(self,relation):
+ def addRelation(self, relation):
self._related.append(relation)
def sort(self):
@@ -396,7 +394,7 @@ class Documentation:
"""
return self.__groups.keys()
- def group_content(self,group_name):
+ def group_content(self, group_name):
"""
Return a list of keys/names that are in a specefic
group or the empty list
@@ -412,7 +410,7 @@ def parse_cmdline(args):
Parse the CMD line and return the result as a n-tuple
"""
- parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__,__version__))
+ parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__, __version__))
usage = """%prog [options]
Create a set of html pages (documentation) for a bitbake.conf....
@@ -428,7 +426,7 @@ Create a set of html pages (documentation) for a bitbake.conf....
parser.add_option( "-D", "--debug", help = "Increase the debug level",
action = "count", dest = "debug", default = 0 )
- parser.add_option( "-v","--verbose", help = "output more chit-char to the terminal",
+ parser.add_option( "-v", "--verbose", help = "output more chit-char to the terminal",
action = "store_true", dest = "verbose", default = False )
options, args = parser.parse_args( sys.argv )
@@ -443,7 +441,7 @@ def main():
The main Method
"""
- (config_file,output_dir) = parse_cmdline( sys.argv )
+ (config_file, output_dir) = parse_cmdline( sys.argv )
# right to let us load the file now
try: