summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake97
-rwxr-xr-xbitbake/bin/bitdoc2
2 files changed, 75 insertions, 24 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 842ba0441e..23c9d73ee4 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -22,12 +22,18 @@
22# with this program; if not, write to the Free Software Foundation, Inc., 22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
25import sys, os, getopt, re, time, optparse 25import sys, os, getopt, re, time, optparse, xmlrpclib
26sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) 26sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
27import bb 27import bb
28from bb import cooker 28from bb import cooker
29from bb import ui
29 30
30__version__ = "1.8.13" 31
32__version__ = "1.9.0"
33
34if sys.hexversion < 0x020500F0:
35 print "Sorry, python 2.5 or later is required for this version of bitbake"
36 sys.exit(1)
31 37
32#============================================================================# 38#============================================================================#
33# BBOptions 39# BBOptions
@@ -41,11 +47,28 @@ class BBConfiguration( object ):
41 setattr( self, key, val ) 47 setattr( self, key, val )
42 48
43 49
50def print_exception(exc, value, tb):
51 """
52 Print the exception to stderr, only showing the traceback if bitbake
53 debugging is enabled.
54 """
55 if not bb.msg.debug_level['default']:
56 tb = None
57
58 sys.__excepthook__(exc, value, tb)
59
60
44#============================================================================# 61#============================================================================#
45# main 62# main
46#============================================================================# 63#============================================================================#
47 64
48def main(): 65def main():
66 return_value = 0
67 pythonver = sys.version_info
68 if pythonver[0] < 2 or (pythonver[0] == 2 and pythonver[1] < 5):
69 print "Sorry, bitbake needs python 2.5 or later."
70 sys.exit(1)
71
49 parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ), 72 parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ),
50 usage = """%prog [options] [package ...] 73 usage = """%prog [options] [package ...]
51 74
@@ -99,8 +122,8 @@ Default BBFILES are the .bb files in the current directory.""" )
99 parser.add_option( "-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax", 122 parser.add_option( "-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
100 action = "store_true", dest = "dot_graph", default = False ) 123 action = "store_true", dest = "dot_graph", default = False )
101 124
102 parser.add_option( "-I", "--ignore-deps", help = """Stop processing at the given list of dependencies when generating dependency graphs. This can help to make the graph more appealing""", 125 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""",
103 action = "append", dest = "ignored_dot_deps", default = [] ) 126 action = "append", dest = "extra_assume_provided", default = [] )
104 127
105 parser.add_option( "-l", "--log-domains", help = """Show debug logging for the specified logging domains""", 128 parser.add_option( "-l", "--log-domains", help = """Show debug logging for the specified logging domains""",
106 action = "append", dest = "debug_domains", default = [] ) 129 action = "append", dest = "debug_domains", default = [] )
@@ -108,6 +131,9 @@ Default BBFILES are the .bb files in the current directory.""" )
108 parser.add_option( "-P", "--profile", help = "profile the command and print a report", 131 parser.add_option( "-P", "--profile", help = "profile the command and print a report",
109 action = "store_true", dest = "profile", default = False ) 132 action = "store_true", dest = "profile", default = False )
110 133
134 parser.add_option( "-u", "--ui", help = "userinterface to use",
135 action = "store", dest = "ui")
136
111 parser.add_option( "", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not", 137 parser.add_option( "", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
112 action = "store_true", dest = "revisions_changed", default = False ) 138 action = "store_true", dest = "revisions_changed", default = False )
113 139
@@ -117,30 +143,53 @@ Default BBFILES are the .bb files in the current directory.""" )
117 configuration.pkgs_to_build = [] 143 configuration.pkgs_to_build = []
118 configuration.pkgs_to_build.extend(args[1:]) 144 configuration.pkgs_to_build.extend(args[1:])
119 145
120 cooker = bb.cooker.BBCooker(configuration) 146 #server = bb.server.xmlrpc
147 server = bb.server.none
148
149 # Save a logfile for cooker into the current working directory. When the
150 # server is daemonized this logfile will be truncated.
151 cooker_logfile = os.path.join (os.getcwd(), "cooker.log")
152
153 cooker = bb.cooker.BBCooker(configuration, server)
121 154
122 # Clear away any spurious environment variables. But don't wipe the 155 # Clear away any spurious environment variables. But don't wipe the
123 # environment totally. 156 # environment totally. This is necessary to ensure the correct operation
157 # of the UIs (e.g. for DISPLAY, etc.)
124 bb.utils.clean_environment() 158 bb.utils.clean_environment()
125 159
126 cooker.parseConfiguration() 160 cooker.parseCommandLine()
127 161
128 if configuration.profile: 162 serverinfo = server.BitbakeServerInfo(cooker.server)
129 try: 163
130 import cProfile as profile 164 server.BitBakeServerFork(serverinfo, cooker.serve, cooker_logfile)
131 except: 165 del cooker
132 import profile 166
133 167 sys.excepthook = print_exception
134 profile.runctx("cooker.cook()", globals(), locals(), "profile.log") 168
135 import pstats 169 # Setup a connection to the server (cooker)
136 p = pstats.Stats('profile.log') 170 serverConnection = server.BitBakeServerConnection(serverinfo)
137 p.sort_stats('time') 171
138 p.print_stats() 172 # Launch the UI
139 p.print_callers() 173 if configuration.ui:
140 p.sort_stats('cumulative') 174 ui = configuration.ui
141 p.print_stats()
142 else: 175 else:
143 cooker.cook() 176 ui = "knotty"
177
178 try:
179 # Dynamically load the UI based on the ui name. Although we
180 # suggest a fixed set this allows you to have flexibility in which
181 # ones are available.
182 exec "from bb.ui import " + ui
183 exec "return_value = " + ui + ".init(serverConnection.connection, serverConnection.events)"
184 except ImportError:
185 print "FATAL: Invalid user interface '%s' specified. " % ui
186 print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
187 except Exception, e:
188 print "FATAL: Unable to start to '%s' UI: %s." % (configuration.ui, e.message)
189 finally:
190 serverConnection.terminate()
191 return return_value
144 192
145if __name__ == "__main__": 193if __name__ == "__main__":
146 main() 194 ret = main()
195 sys.exit(ret)
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 3bcc9b344b..4940f660a6 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -453,6 +453,8 @@ def main():
453 except bb.parse.ParseError: 453 except bb.parse.ParseError:
454 bb.fatal( "Unable to parse %s" % config_file ) 454 bb.fatal( "Unable to parse %s" % config_file )
455 455
456 if isinstance(documentation, dict):
457 documentation = documentation[""]
456 458
457 # Assuming we've the file loaded now, we will initialize the 'tree' 459 # Assuming we've the file loaded now, we will initialize the 'tree'
458 doc = Documentation() 460 doc = Documentation()