summaryrefslogtreecommitdiffstats
path: root/bitbake-dev/bin/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-09-30 15:08:33 +0000
committerRichard Purdie <richard@openedhand.com>2008-09-30 15:08:33 +0000
commitc30eddb243e7e65f67f656e62848a033cf6f2e5c (patch)
tree110dd95788b76f55d31cb8d30aac2de8400b6f4a /bitbake-dev/bin/bitbake
parent5ef0510474004eeb2ae8a99b64e2febb1920e077 (diff)
downloadpoky-c30eddb243e7e65f67f656e62848a033cf6f2e5c.tar.gz
Add bitbake-dev to allow ease of testing and development of bitbake trunk
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5337 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake-dev/bin/bitbake')
-rwxr-xr-xbitbake-dev/bin/bitbake204
1 files changed, 204 insertions, 0 deletions
diff --git a/bitbake-dev/bin/bitbake b/bitbake-dev/bin/bitbake
new file mode 100755
index 0000000000..067cc274f9
--- /dev/null
+++ b/bitbake-dev/bin/bitbake
@@ -0,0 +1,204 @@
1#!/usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4#
5# Copyright (C) 2003, 2004 Chris Larson
6# Copyright (C) 2003, 2004 Phil Blundell
7# Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer
8# Copyright (C) 2005 Holger Hans Peter Freyther
9# Copyright (C) 2005 ROAD GmbH
10# Copyright (C) 2006 Richard Purdie
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License version 2 as
14# published by the Free Software Foundation.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License along
22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
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'))
27import bb
28from bb import cooker
29from bb import daemonize
30from bb import ui
31from bb.ui import uievent
32
33__version__ = "1.9.0"
34
35#============================================================================#
36# BBOptions
37#============================================================================#
38class BBConfiguration( object ):
39 """
40 Manages build options and configurations for one run
41 """
42 def __init__( self, options ):
43 for key, val in options.__dict__.items():
44 setattr( self, key, val )
45
46
47#============================================================================#
48# main
49#============================================================================#
50
51def main():
52 return_value = 0
53 pythonver = sys.version_info
54 if pythonver[0] < 2 or (pythonver[0] == 2 and pythonver[1] < 5):
55 print "Sorry, bitbake needs python 2.5 or later."
56 sys.exit(1)
57
58 parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ),
59 usage = """%prog [options] [package ...]
60
61Executes the specified task (default is 'build') for a given set of BitBake files.
62It expects that BBFILES is defined, which is a space separated list of files to
63be executed. BBFILES does support wildcards.
64Default BBFILES are the .bb files in the current directory.""" )
65
66 parser.add_option( "-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
67 action = "store", dest = "buildfile", default = None )
68
69 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.",
70 action = "store_false", dest = "abort", default = True )
71
72 parser.add_option( "-f", "--force", help = "force run of specified cmd, regardless of stamp status",
73 action = "store_true", dest = "force", default = False )
74
75 parser.add_option( "-i", "--interactive", help = "drop into the interactive mode also called the BitBake shell.",
76 action = "store_true", dest = "interactive", default = False )
77
78 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",
79 action = "store", dest = "cmd" )
80
81 parser.add_option( "-r", "--read", help = "read the specified file before bitbake.conf",
82 action = "append", dest = "file", default = [] )
83
84 parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal",
85 action = "store_true", dest = "verbose", default = False )
86
87 parser.add_option( "-D", "--debug", help = "Increase the debug level. You can specify this more than once.",
88 action = "count", dest="debug", default = 0)
89
90 parser.add_option( "-n", "--dry-run", help = "don't execute, just go through the motions",
91 action = "store_true", dest = "dry_run", default = False )
92
93 parser.add_option( "-p", "--parse-only", help = "quit after parsing the BB files (developers only)",
94 action = "store_true", dest = "parse_only", default = False )
95
96 parser.add_option( "-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
97 action = "store_true", dest = "disable_psyco", default = False )
98
99 parser.add_option( "-s", "--show-versions", help = "show current and preferred versions of all packages",
100 action = "store_true", dest = "show_versions", default = False )
101
102 parser.add_option( "-e", "--environment", help = "show the global or per-package environment (this is what used to be bbread)",
103 action = "store_true", dest = "show_environment", default = False )
104
105 parser.add_option( "-g", "--graphviz", help = "emit the dependency trees of the specified packages in the dot syntax",
106 action = "store_true", dest = "dot_graph", default = False )
107
108 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""",
109 action = "append", dest = "extra_assume_provided", default = [] )
110
111 parser.add_option( "-l", "--log-domains", help = """Show debug logging for the specified logging domains""",
112 action = "append", dest = "debug_domains", default = [] )
113
114 parser.add_option( "-P", "--profile", help = "profile the command and print a report",
115 action = "store_true", dest = "profile", default = False )
116
117 parser.add_option( "-u", "--ui", help = "userinterface to use",
118 action = "store", dest = "ui")
119
120 options, args = parser.parse_args(sys.argv)
121
122 configuration = BBConfiguration(options)
123 configuration.pkgs_to_build = []
124 configuration.pkgs_to_build.extend(args[1:])
125
126
127 # Work out which UI(s) to use
128 curseUI = False
129 depexplorerUI = False
130 if configuration.ui:
131 if configuration.ui == "ncurses":
132 curseUI = True
133 elif configuration.ui == "knotty" or configuration.ui == "tty" or configuration.ui == "file":
134 curseUI = False
135 elif configuration.ui == "depexp":
136 depexplorerUI = True
137 else:
138 print "FATAL: Invalid user interface '%s' specified.\nValid interfaces are 'ncurses', 'depexp' or the default, 'knotty'." % configuration.ui
139 sys.exit(1)
140
141
142 cooker = bb.cooker.BBCooker(configuration)
143 host = cooker.server.host
144 port = cooker.server.port
145
146 # Save a logfile for cooker somewhere
147 t = bb.data.getVar('TMPDIR', cooker.configuration.data, True)
148 if not t:
149 bb.msg.fatal(bb.msg.domain.Build, "TMPDIR not set")
150 t = os.path.join(t, "cooker")
151 bb.mkdirhier(t)
152 cooker_logfile = "%s/log.cooker.%s" % (t, str(os.getpid()))
153
154 daemonize.createDaemon(cooker.serve, cooker_logfile)
155 del cooker
156
157 # Setup a connection to the server (cooker)
158 server = xmlrpclib.Server("http://%s:%s" % (host, port), allow_none=True)
159 # Setup an event receiving queue
160 eventHandler = uievent.BBUIEventQueue(server)
161
162 # Launch the UI
163 try:
164 # Disable UIs that need a terminal
165 if not os.isatty(sys.stdout.fileno()):
166 curseUI = False
167
168 if curseUI:
169 try:
170 import curses
171 except ImportError, details:
172 curseUI = False
173
174 if curseUI:
175 from bb.ui import ncurses
176 ncurses.init(server, eventHandler)
177 elif depexplorerUI:
178 from bb.ui import depexplorer
179 depexplorer.init(server, eventHandler)
180 else:
181 from bb.ui import knotty
182 return_value = knotty.init(server, eventHandler)
183
184 finally:
185 # Don't wait for server indefinitely
186 import socket
187 socket.setdefaulttimeout(2)
188 try:
189 eventHandler.system_quit()
190 except:
191 pass
192 try:
193 server.terminateServer()
194 except:
195 pass
196 return return_value
197
198if __name__ == "__main__":
199 print """WARNING, WARNING, WARNING
200This is a Bitbake from the Unstable/Development 1.9 Branch. This software is a work in progress and should only be used by Bitbake developers/testers"""
201
202 ret = main()
203 sys.exit(ret)
204