diff options
Diffstat (limited to 'bitbake/lib/bb/main.py')
-rwxr-xr-x | bitbake/lib/bb/main.py | 407 |
1 files changed, 220 insertions, 187 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index 06bad495ac..bca8ebfa09 100755 --- a/bitbake/lib/bb/main.py +++ b/bitbake/lib/bb/main.py | |||
@@ -12,11 +12,12 @@ | |||
12 | import os | 12 | import os |
13 | import sys | 13 | import sys |
14 | import logging | 14 | import logging |
15 | import optparse | 15 | import argparse |
16 | import warnings | 16 | import warnings |
17 | import fcntl | 17 | import fcntl |
18 | import time | 18 | import time |
19 | import traceback | 19 | import traceback |
20 | import datetime | ||
20 | 21 | ||
21 | import bb | 22 | import bb |
22 | from bb import event | 23 | from bb import event |
@@ -43,18 +44,18 @@ def present_options(optionlist): | |||
43 | else: | 44 | else: |
44 | return optionlist[0] | 45 | return optionlist[0] |
45 | 46 | ||
46 | class BitbakeHelpFormatter(optparse.IndentedHelpFormatter): | 47 | class BitbakeHelpFormatter(argparse.HelpFormatter): |
47 | def format_option(self, option): | 48 | def _get_help_string(self, action): |
48 | # We need to do this here rather than in the text we supply to | 49 | # We need to do this here rather than in the text we supply to |
49 | # add_option() because we don't want to call list_extension_modules() | 50 | # add_option() because we don't want to call list_extension_modules() |
50 | # on every execution (since it imports all of the modules) | 51 | # on every execution (since it imports all of the modules) |
51 | # Note also that we modify option.help rather than the returned text | 52 | # Note also that we modify option.help rather than the returned text |
52 | # - this is so that we don't have to re-format the text ourselves | 53 | # - this is so that we don't have to re-format the text ourselves |
53 | if option.dest == 'ui': | 54 | if action.dest == 'ui': |
54 | valid_uis = list_extension_modules(bb.ui, 'main') | 55 | valid_uis = list_extension_modules(bb.ui, 'main') |
55 | option.help = option.help.replace('@CHOICES@', present_options(valid_uis)) | 56 | return action.help.replace('@CHOICES@', present_options(valid_uis)) |
56 | 57 | ||
57 | return optparse.IndentedHelpFormatter.format_option(self, option) | 58 | return action.help |
58 | 59 | ||
59 | def list_extension_modules(pkg, checkattr): | 60 | def list_extension_modules(pkg, checkattr): |
60 | """ | 61 | """ |
@@ -112,189 +113,209 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): | |||
112 | warnlog.warning(s) | 113 | warnlog.warning(s) |
113 | 114 | ||
114 | warnings.showwarning = _showwarning | 115 | warnings.showwarning = _showwarning |
115 | warnings.filterwarnings("ignore") | ||
116 | warnings.filterwarnings("default", module="(<string>$|(oe|bb)\.)") | ||
117 | warnings.filterwarnings("ignore", category=PendingDeprecationWarning) | ||
118 | warnings.filterwarnings("ignore", category=ImportWarning) | ||
119 | warnings.filterwarnings("ignore", category=DeprecationWarning, module="<string>$") | ||
120 | warnings.filterwarnings("ignore", message="With-statements now directly support multiple context managers") | ||
121 | |||
122 | 116 | ||
123 | def create_bitbake_parser(): | 117 | def create_bitbake_parser(): |
124 | parser = optparse.OptionParser( | 118 | parser = argparse.ArgumentParser( |
125 | formatter=BitbakeHelpFormatter(), | 119 | description="""\ |
126 | version="BitBake Build Tool Core version %s" % bb.__version__, | 120 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which |
127 | usage="""%prog [options] [recipename/target recipe:do_task ...] | 121 | will provide the layer, BBFILES and other configuration information. |
128 | 122 | """, | |
129 | Executes the specified task (default is 'build') for a given set of target recipes (.bb files). | 123 | formatter_class=BitbakeHelpFormatter, |
130 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which | 124 | allow_abbrev=False, |
131 | will provide the layer, BBFILES and other configuration information.""") | 125 | add_help=False, # help is manually added below in a specific argument group |
132 | 126 | ) | |
133 | parser.add_option("-b", "--buildfile", action="store", dest="buildfile", default=None, | 127 | |
134 | help="Execute tasks from a specific .bb recipe directly. WARNING: Does " | 128 | general_group = parser.add_argument_group('General options') |
135 | "not handle any dependencies from other recipes.") | 129 | task_group = parser.add_argument_group('Task control options') |
136 | 130 | exec_group = parser.add_argument_group('Execution control options') | |
137 | parser.add_option("-k", "--continue", action="store_false", dest="abort", default=True, | 131 | logging_group = parser.add_argument_group('Logging/output control options') |
138 | help="Continue as much as possible after an error. While the target that " | 132 | server_group = parser.add_argument_group('Server options') |
139 | "failed and anything depending on it cannot be built, as much as " | 133 | config_group = parser.add_argument_group('Configuration options') |
140 | "possible will be built before stopping.") | 134 | |
141 | 135 | general_group.add_argument("targets", nargs="*", metavar="recipename/target", | |
142 | parser.add_option("-f", "--force", action="store_true", dest="force", default=False, | 136 | help="Execute the specified task (default is 'build') for these target " |
143 | help="Force the specified targets/task to run (invalidating any " | 137 | "recipes (.bb files).") |
144 | "existing stamp file).") | 138 | |
145 | 139 | general_group.add_argument("-s", "--show-versions", action="store_true", | |
146 | parser.add_option("-c", "--cmd", action="store", dest="cmd", | 140 | help="Show current and preferred versions of all recipes.") |
147 | help="Specify the task to execute. The exact options available " | 141 | |
148 | "depend on the metadata. Some examples might be 'compile'" | 142 | general_group.add_argument("-e", "--environment", action="store_true", |
149 | " or 'populate_sysroot' or 'listtasks' may give a list of " | 143 | dest="show_environment", |
150 | "the tasks available.") | 144 | help="Show the global or per-recipe environment complete with information" |
151 | 145 | " about where variables were set/changed.") | |
152 | parser.add_option("-C", "--clear-stamp", action="store", dest="invalidate_stamp", | 146 | |
153 | help="Invalidate the stamp for the specified task such as 'compile' " | 147 | general_group.add_argument("-g", "--graphviz", action="store_true", dest="dot_graph", |
154 | "and then run the default task for the specified target(s).") | 148 | help="Save dependency tree information for the specified " |
155 | 149 | "targets in the dot syntax.") | |
156 | parser.add_option("-r", "--read", action="append", dest="prefile", default=[], | ||
157 | help="Read the specified file before bitbake.conf.") | ||
158 | |||
159 | parser.add_option("-R", "--postread", action="append", dest="postfile", default=[], | ||
160 | help="Read the specified file after bitbake.conf.") | ||
161 | |||
162 | parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, | ||
163 | help="Enable tracing of shell tasks (with 'set -x'). " | ||
164 | "Also print bb.note(...) messages to stdout (in " | ||
165 | "addition to writing them to ${T}/log.do_<task>).") | ||
166 | |||
167 | parser.add_option("-D", "--debug", action="count", dest="debug", default=0, | ||
168 | help="Increase the debug level. You can specify this " | ||
169 | "more than once. -D sets the debug level to 1, " | ||
170 | "where only bb.debug(1, ...) messages are printed " | ||
171 | "to stdout; -DD sets the debug level to 2, where " | ||
172 | "both bb.debug(1, ...) and bb.debug(2, ...) " | ||
173 | "messages are printed; etc. Without -D, no debug " | ||
174 | "messages are printed. Note that -D only affects " | ||
175 | "output to stdout. All debug messages are written " | ||
176 | "to ${T}/log.do_taskname, regardless of the debug " | ||
177 | "level.") | ||
178 | |||
179 | parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0, | ||
180 | help="Output less log message data to the terminal. You can specify this more than once.") | ||
181 | |||
182 | parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, | ||
183 | help="Don't execute, just go through the motions.") | ||
184 | |||
185 | parser.add_option("-S", "--dump-signatures", action="append", dest="dump_signatures", | ||
186 | default=[], metavar="SIGNATURE_HANDLER", | ||
187 | help="Dump out the signature construction information, with no task " | ||
188 | "execution. The SIGNATURE_HANDLER parameter is passed to the " | ||
189 | "handler. Two common values are none and printdiff but the handler " | ||
190 | "may define more/less. none means only dump the signature, printdiff" | ||
191 | " means compare the dumped signature with the cached one.") | ||
192 | |||
193 | parser.add_option("-p", "--parse-only", action="store_true", | ||
194 | dest="parse_only", default=False, | ||
195 | help="Quit after parsing the BB recipes.") | ||
196 | |||
197 | parser.add_option("-s", "--show-versions", action="store_true", | ||
198 | dest="show_versions", default=False, | ||
199 | help="Show current and preferred versions of all recipes.") | ||
200 | |||
201 | parser.add_option("-e", "--environment", action="store_true", | ||
202 | dest="show_environment", default=False, | ||
203 | help="Show the global or per-recipe environment complete with information" | ||
204 | " about where variables were set/changed.") | ||
205 | |||
206 | parser.add_option("-g", "--graphviz", action="store_true", dest="dot_graph", default=False, | ||
207 | help="Save dependency tree information for the specified " | ||
208 | "targets in the dot syntax.") | ||
209 | |||
210 | parser.add_option("-I", "--ignore-deps", action="append", | ||
211 | dest="extra_assume_provided", default=[], | ||
212 | help="Assume these dependencies don't exist and are already provided " | ||
213 | "(equivalent to ASSUME_PROVIDED). Useful to make dependency " | ||
214 | "graphs more appealing") | ||
215 | |||
216 | parser.add_option("-l", "--log-domains", action="append", dest="debug_domains", default=[], | ||
217 | help="Show debug logging for the specified logging domains") | ||
218 | |||
219 | parser.add_option("-P", "--profile", action="store_true", dest="profile", default=False, | ||
220 | help="Profile the command and save reports.") | ||
221 | 150 | ||
222 | # @CHOICES@ is substituted out by BitbakeHelpFormatter above | 151 | # @CHOICES@ is substituted out by BitbakeHelpFormatter above |
223 | parser.add_option("-u", "--ui", action="store", dest="ui", | 152 | general_group.add_argument("-u", "--ui", |
224 | default=os.environ.get('BITBAKE_UI', 'knotty'), | 153 | default=os.environ.get('BITBAKE_UI', 'knotty'), |
225 | help="The user interface to use (@CHOICES@ - default %default).") | 154 | help="The user interface to use (@CHOICES@ - default %(default)s).") |
226 | 155 | ||
227 | parser.add_option("", "--token", action="store", dest="xmlrpctoken", | 156 | general_group.add_argument("--version", action="store_true", |
228 | default=os.environ.get("BBTOKEN"), | 157 | help="Show programs version and exit.") |
229 | help="Specify the connection token to be used when connecting " | 158 | |
230 | "to a remote server.") | 159 | general_group.add_argument('-h', '--help', action='help', |
231 | 160 | help='Show this help message and exit.') | |
232 | parser.add_option("", "--revisions-changed", action="store_true", | 161 | |
233 | dest="revisions_changed", default=False, | 162 | |
234 | help="Set the exit code depending on whether upstream floating " | 163 | task_group.add_argument("-f", "--force", action="store_true", |
235 | "revisions have changed or not.") | 164 | help="Force the specified targets/task to run (invalidating any " |
236 | 165 | "existing stamp file).") | |
237 | parser.add_option("", "--server-only", action="store_true", | 166 | |
238 | dest="server_only", default=False, | 167 | task_group.add_argument("-c", "--cmd", |
239 | help="Run bitbake without a UI, only starting a server " | 168 | help="Specify the task to execute. The exact options available " |
240 | "(cooker) process.") | 169 | "depend on the metadata. Some examples might be 'compile'" |
241 | 170 | " or 'populate_sysroot' or 'listtasks' may give a list of " | |
242 | parser.add_option("-B", "--bind", action="store", dest="bind", default=False, | 171 | "the tasks available.") |
243 | help="The name/address for the bitbake xmlrpc server to bind to.") | 172 | |
244 | 173 | task_group.add_argument("-C", "--clear-stamp", dest="invalidate_stamp", | |
245 | parser.add_option("-T", "--idle-timeout", type=float, dest="server_timeout", | 174 | help="Invalidate the stamp for the specified task such as 'compile' " |
246 | default=os.getenv("BB_SERVER_TIMEOUT"), | 175 | "and then run the default task for the specified target(s).") |
247 | help="Set timeout to unload bitbake server due to inactivity, " | 176 | |
248 | "set to -1 means no unload, " | 177 | task_group.add_argument("--runall", action="append", default=[], |
249 | "default: Environment variable BB_SERVER_TIMEOUT.") | 178 | help="Run the specified task for any recipe in the taskgraph of the " |
250 | 179 | "specified target (even if it wouldn't otherwise have run).") | |
251 | parser.add_option("", "--no-setscene", action="store_true", | 180 | |
252 | dest="nosetscene", default=False, | 181 | task_group.add_argument("--runonly", action="append", |
253 | help="Do not run any setscene tasks. sstate will be ignored and " | 182 | help="Run only the specified task within the taskgraph of the " |
254 | "everything needed, built.") | 183 | "specified targets (and any task dependencies those tasks may have).") |
255 | 184 | ||
256 | parser.add_option("", "--skip-setscene", action="store_true", | 185 | task_group.add_argument("--no-setscene", action="store_true", |
257 | dest="skipsetscene", default=False, | 186 | dest="nosetscene", |
258 | help="Skip setscene tasks if they would be executed. Tasks previously " | 187 | help="Do not run any setscene tasks. sstate will be ignored and " |
259 | "restored from sstate will be kept, unlike --no-setscene") | 188 | "everything needed, built.") |
260 | 189 | ||
261 | parser.add_option("", "--setscene-only", action="store_true", | 190 | task_group.add_argument("--skip-setscene", action="store_true", |
262 | dest="setsceneonly", default=False, | 191 | dest="skipsetscene", |
263 | help="Only run setscene tasks, don't run any real tasks.") | 192 | help="Skip setscene tasks if they would be executed. Tasks previously " |
264 | 193 | "restored from sstate will be kept, unlike --no-setscene.") | |
265 | parser.add_option("", "--remote-server", action="store", dest="remote_server", | 194 | |
266 | default=os.environ.get("BBSERVER"), | 195 | task_group.add_argument("--setscene-only", action="store_true", |
267 | help="Connect to the specified server.") | 196 | dest="setsceneonly", |
268 | 197 | help="Only run setscene tasks, don't run any real tasks.") | |
269 | parser.add_option("-m", "--kill-server", action="store_true", | 198 | |
270 | dest="kill_server", default=False, | 199 | |
271 | help="Terminate any running bitbake server.") | 200 | exec_group.add_argument("-n", "--dry-run", action="store_true", |
272 | 201 | help="Don't execute, just go through the motions.") | |
273 | parser.add_option("", "--observe-only", action="store_true", | 202 | |
274 | dest="observe_only", default=False, | 203 | exec_group.add_argument("-p", "--parse-only", action="store_true", |
275 | help="Connect to a server as an observing-only client.") | 204 | help="Quit after parsing the BB recipes.") |
276 | 205 | ||
277 | parser.add_option("", "--status-only", action="store_true", | 206 | exec_group.add_argument("-k", "--continue", action="store_false", dest="halt", |
278 | dest="status_only", default=False, | 207 | help="Continue as much as possible after an error. While the target that " |
279 | help="Check the status of the remote bitbake server.") | 208 | "failed and anything depending on it cannot be built, as much as " |
280 | 209 | "possible will be built before stopping.") | |
281 | parser.add_option("-w", "--write-log", action="store", dest="writeeventlog", | 210 | |
282 | default=os.environ.get("BBEVENTLOG"), | 211 | exec_group.add_argument("-P", "--profile", action="store_true", |
283 | help="Writes the event log of the build to a bitbake event json file. " | 212 | help="Profile the command and save reports.") |
284 | "Use '' (empty string) to assign the name automatically.") | 213 | |
285 | 214 | exec_group.add_argument("-S", "--dump-signatures", action="append", | |
286 | parser.add_option("", "--runall", action="append", dest="runall", | 215 | default=[], metavar="SIGNATURE_HANDLER", |
287 | help="Run the specified task for any recipe in the taskgraph of the specified target (even if it wouldn't otherwise have run).") | 216 | help="Dump out the signature construction information, with no task " |
288 | 217 | "execution. The SIGNATURE_HANDLER parameter is passed to the " | |
289 | parser.add_option("", "--runonly", action="append", dest="runonly", | 218 | "handler. Two common values are none and printdiff but the handler " |
290 | help="Run only the specified task within the taskgraph of the specified targets (and any task dependencies those tasks may have).") | 219 | "may define more/less. none means only dump the signature, printdiff" |
220 | " means recursively compare the dumped signature with the most recent" | ||
221 | " one in a local build or sstate cache (can be used to find out why tasks re-run" | ||
222 | " when that is not expected)") | ||
223 | |||
224 | exec_group.add_argument("--revisions-changed", action="store_true", | ||
225 | help="Set the exit code depending on whether upstream floating " | ||
226 | "revisions have changed or not.") | ||
227 | |||
228 | exec_group.add_argument("-b", "--buildfile", | ||
229 | help="Execute tasks from a specific .bb recipe directly. WARNING: Does " | ||
230 | "not handle any dependencies from other recipes.") | ||
231 | |||
232 | logging_group.add_argument("-D", "--debug", action="count", default=0, | ||
233 | help="Increase the debug level. You can specify this " | ||
234 | "more than once. -D sets the debug level to 1, " | ||
235 | "where only bb.debug(1, ...) messages are printed " | ||
236 | "to stdout; -DD sets the debug level to 2, where " | ||
237 | "both bb.debug(1, ...) and bb.debug(2, ...) " | ||
238 | "messages are printed; etc. Without -D, no debug " | ||
239 | "messages are printed. Note that -D only affects " | ||
240 | "output to stdout. All debug messages are written " | ||
241 | "to ${T}/log.do_taskname, regardless of the debug " | ||
242 | "level.") | ||
243 | |||
244 | logging_group.add_argument("-l", "--log-domains", action="append", dest="debug_domains", | ||
245 | default=[], | ||
246 | help="Show debug logging for the specified logging domains.") | ||
247 | |||
248 | logging_group.add_argument("-v", "--verbose", action="store_true", | ||
249 | help="Enable tracing of shell tasks (with 'set -x'). " | ||
250 | "Also print bb.note(...) messages to stdout (in " | ||
251 | "addition to writing them to ${T}/log.do_<task>).") | ||
252 | |||
253 | logging_group.add_argument("-q", "--quiet", action="count", default=0, | ||
254 | help="Output less log message data to the terminal. You can specify this " | ||
255 | "more than once.") | ||
256 | |||
257 | logging_group.add_argument("-w", "--write-log", dest="writeeventlog", | ||
258 | default=os.environ.get("BBEVENTLOG"), | ||
259 | help="Writes the event log of the build to a bitbake event json file. " | ||
260 | "Use '' (empty string) to assign the name automatically.") | ||
261 | |||
262 | |||
263 | server_group.add_argument("-B", "--bind", default=False, | ||
264 | help="The name/address for the bitbake xmlrpc server to bind to.") | ||
265 | |||
266 | server_group.add_argument("-T", "--idle-timeout", type=float, dest="server_timeout", | ||
267 | default=os.getenv("BB_SERVER_TIMEOUT"), | ||
268 | help="Set timeout to unload bitbake server due to inactivity, " | ||
269 | "set to -1 means no unload, " | ||
270 | "default: Environment variable BB_SERVER_TIMEOUT.") | ||
271 | |||
272 | server_group.add_argument("--remote-server", | ||
273 | default=os.environ.get("BBSERVER"), | ||
274 | help="Connect to the specified server.") | ||
275 | |||
276 | server_group.add_argument("-m", "--kill-server", action="store_true", | ||
277 | help="Terminate any running bitbake server.") | ||
278 | |||
279 | server_group.add_argument("--token", dest="xmlrpctoken", | ||
280 | default=os.environ.get("BBTOKEN"), | ||
281 | help="Specify the connection token to be used when connecting " | ||
282 | "to a remote server.") | ||
283 | |||
284 | server_group.add_argument("--observe-only", action="store_true", | ||
285 | help="Connect to a server as an observing-only client.") | ||
286 | |||
287 | server_group.add_argument("--status-only", action="store_true", | ||
288 | help="Check the status of the remote bitbake server.") | ||
289 | |||
290 | server_group.add_argument("--server-only", action="store_true", | ||
291 | help="Run bitbake without a UI, only starting a server " | ||
292 | "(cooker) process.") | ||
293 | |||
294 | |||
295 | config_group.add_argument("-r", "--read", action="append", dest="prefile", default=[], | ||
296 | help="Read the specified file before bitbake.conf.") | ||
297 | |||
298 | config_group.add_argument("-R", "--postread", action="append", dest="postfile", default=[], | ||
299 | help="Read the specified file after bitbake.conf.") | ||
300 | |||
301 | |||
302 | config_group.add_argument("-I", "--ignore-deps", action="append", | ||
303 | dest="extra_assume_provided", default=[], | ||
304 | help="Assume these dependencies don't exist and are already provided " | ||
305 | "(equivalent to ASSUME_PROVIDED). Useful to make dependency " | ||
306 | "graphs more appealing.") | ||
307 | |||
291 | return parser | 308 | return parser |
292 | 309 | ||
293 | 310 | ||
294 | class BitBakeConfigParameters(cookerdata.ConfigParameters): | 311 | class BitBakeConfigParameters(cookerdata.ConfigParameters): |
295 | def parseCommandLine(self, argv=sys.argv): | 312 | def parseCommandLine(self, argv=sys.argv): |
296 | parser = create_bitbake_parser() | 313 | parser = create_bitbake_parser() |
297 | options, targets = parser.parse_args(argv) | 314 | options = parser.parse_intermixed_args(argv[1:]) |
315 | |||
316 | if options.version: | ||
317 | print("BitBake Build Tool Core version %s" % bb.__version__) | ||
318 | sys.exit(0) | ||
298 | 319 | ||
299 | if options.quiet and options.verbose: | 320 | if options.quiet and options.verbose: |
300 | parser.error("options --quiet and --verbose are mutually exclusive") | 321 | parser.error("options --quiet and --verbose are mutually exclusive") |
@@ -326,7 +347,7 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): | |||
326 | else: | 347 | else: |
327 | options.xmlrpcinterface = (None, 0) | 348 | options.xmlrpcinterface = (None, 0) |
328 | 349 | ||
329 | return options, targets[1:] | 350 | return options, options.targets |
330 | 351 | ||
331 | 352 | ||
332 | def bitbake_main(configParams, configuration): | 353 | def bitbake_main(configParams, configuration): |
@@ -391,6 +412,9 @@ def bitbake_main(configParams, configuration): | |||
391 | 412 | ||
392 | return 1 | 413 | return 1 |
393 | 414 | ||
415 | def timestamp(): | ||
416 | return datetime.datetime.now().strftime('%H:%M:%S.%f') | ||
417 | |||
394 | def setup_bitbake(configParams, extrafeatures=None): | 418 | def setup_bitbake(configParams, extrafeatures=None): |
395 | # Ensure logging messages get sent to the UI as events | 419 | # Ensure logging messages get sent to the UI as events |
396 | handler = bb.event.LogHandler() | 420 | handler = bb.event.LogHandler() |
@@ -398,6 +422,11 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
398 | # In status only mode there are no logs and no UI | 422 | # In status only mode there are no logs and no UI |
399 | logger.addHandler(handler) | 423 | logger.addHandler(handler) |
400 | 424 | ||
425 | if configParams.dump_signatures: | ||
426 | if extrafeatures is None: | ||
427 | extrafeatures = [] | ||
428 | extrafeatures.append(bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO) | ||
429 | |||
401 | if configParams.server_only: | 430 | if configParams.server_only: |
402 | featureset = [] | 431 | featureset = [] |
403 | ui_module = None | 432 | ui_module = None |
@@ -425,7 +454,7 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
425 | retries = 8 | 454 | retries = 8 |
426 | while retries: | 455 | while retries: |
427 | try: | 456 | try: |
428 | topdir, lock = lockBitbake() | 457 | topdir, lock, lockfile = lockBitbake() |
429 | sockname = topdir + "/bitbake.sock" | 458 | sockname = topdir + "/bitbake.sock" |
430 | if lock: | 459 | if lock: |
431 | if configParams.status_only or configParams.kill_server: | 460 | if configParams.status_only or configParams.kill_server: |
@@ -436,18 +465,22 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
436 | logger.info("Starting bitbake server...") | 465 | logger.info("Starting bitbake server...") |
437 | # Clear the event queue since we already displayed messages | 466 | # Clear the event queue since we already displayed messages |
438 | bb.event.ui_queue = [] | 467 | bb.event.ui_queue = [] |
439 | server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface) | 468 | server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface, configParams.profile) |
440 | 469 | ||
441 | else: | 470 | else: |
442 | logger.info("Reconnecting to bitbake server...") | 471 | logger.info("Reconnecting to bitbake server...") |
443 | if not os.path.exists(sockname): | 472 | if not os.path.exists(sockname): |
444 | logger.info("Previous bitbake instance shutting down?, waiting to retry...") | 473 | logger.info("Previous bitbake instance shutting down?, waiting to retry... (%s)" % timestamp()) |
474 | procs = bb.server.process.get_lockfile_process_msg(lockfile) | ||
475 | if procs: | ||
476 | logger.info("Processes holding bitbake.lock (missing socket %s):\n%s" % (sockname, procs)) | ||
477 | logger.info("Directory listing: %s" % (str(os.listdir(topdir)))) | ||
445 | i = 0 | 478 | i = 0 |
446 | lock = None | 479 | lock = None |
447 | # Wait for 5s or until we can get the lock | 480 | # Wait for 5s or until we can get the lock |
448 | while not lock and i < 50: | 481 | while not lock and i < 50: |
449 | time.sleep(0.1) | 482 | time.sleep(0.1) |
450 | _, lock = lockBitbake() | 483 | _, lock, _ = lockBitbake() |
451 | i += 1 | 484 | i += 1 |
452 | if lock: | 485 | if lock: |
453 | bb.utils.unlockfile(lock) | 486 | bb.utils.unlockfile(lock) |
@@ -466,9 +499,9 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
466 | retries -= 1 | 499 | retries -= 1 |
467 | tryno = 8 - retries | 500 | tryno = 8 - retries |
468 | if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError, SystemExit)): | 501 | if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError, SystemExit)): |
469 | logger.info("Retrying server connection (#%d)..." % tryno) | 502 | logger.info("Retrying server connection (#%d)... (%s)" % (tryno, timestamp())) |
470 | else: | 503 | else: |
471 | logger.info("Retrying server connection (#%d)... (%s)" % (tryno, traceback.format_exc())) | 504 | logger.info("Retrying server connection (#%d)... (%s, %s)" % (tryno, traceback.format_exc(), timestamp())) |
472 | 505 | ||
473 | if not retries: | 506 | if not retries: |
474 | bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") | 507 | bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") |
@@ -497,5 +530,5 @@ def lockBitbake(): | |||
497 | bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?") | 530 | bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?") |
498 | raise BBMainFatal | 531 | raise BBMainFatal |
499 | lockfile = topdir + "/bitbake.lock" | 532 | lockfile = topdir + "/bitbake.lock" |
500 | return topdir, bb.utils.lockfile(lockfile, False, False) | 533 | return topdir, bb.utils.lockfile(lockfile, False, False), lockfile |
501 | 534 | ||