diff options
Diffstat (limited to 'bitbake/lib/bb/main.py')
| -rwxr-xr-x | bitbake/lib/bb/main.py | 409 |
1 files changed, 222 insertions, 187 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index 06bad495ac..597cb27846 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,211 @@ 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="append", |
| 283 | help="Writes the event log of the build to a bitbake event json file. " | 212 | default=[], |
| 284 | "Use '' (empty string) to assign the name automatically.") | 213 | help="Profile the command and save reports. Specify 'main', 'idle' or 'parsing' " |
| 285 | 214 | "to indicate which bitbake code to profile.") | |
| 286 | parser.add_option("", "--runall", action="append", dest="runall", | 215 | |
| 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 | exec_group.add_argument("-S", "--dump-signatures", action="append", |
| 288 | 217 | default=[], metavar="SIGNATURE_HANDLER", | |
| 289 | parser.add_option("", "--runonly", action="append", dest="runonly", | 218 | help="Dump out the signature construction information, with no task " |
| 290 | help="Run only the specified task within the taskgraph of the specified targets (and any task dependencies those tasks may have).") | 219 | "execution. The SIGNATURE_HANDLER parameter is passed to the " |
| 220 | "handler. Two common values are none and printdiff but the handler " | ||
| 221 | "may define more/less. none means only dump the signature, printdiff" | ||
| 222 | " means recursively compare the dumped signature with the most recent" | ||
| 223 | " one in a local build or sstate cache (can be used to find out why tasks re-run" | ||
| 224 | " when that is not expected)") | ||
| 225 | |||
| 226 | exec_group.add_argument("--revisions-changed", action="store_true", | ||
| 227 | help="Set the exit code depending on whether upstream floating " | ||
| 228 | "revisions have changed or not.") | ||
| 229 | |||
| 230 | exec_group.add_argument("-b", "--buildfile", | ||
| 231 | help="Execute tasks from a specific .bb recipe directly. WARNING: Does " | ||
| 232 | "not handle any dependencies from other recipes.") | ||
| 233 | |||
| 234 | logging_group.add_argument("-D", "--debug", action="count", default=0, | ||
| 235 | help="Increase the debug level. You can specify this " | ||
| 236 | "more than once. -D sets the debug level to 1, " | ||
| 237 | "where only bb.debug(1, ...) messages are printed " | ||
| 238 | "to stdout; -DD sets the debug level to 2, where " | ||
| 239 | "both bb.debug(1, ...) and bb.debug(2, ...) " | ||
| 240 | "messages are printed; etc. Without -D, no debug " | ||
| 241 | "messages are printed. Note that -D only affects " | ||
| 242 | "output to stdout. All debug messages are written " | ||
| 243 | "to ${T}/log.do_taskname, regardless of the debug " | ||
| 244 | "level.") | ||
| 245 | |||
| 246 | logging_group.add_argument("-l", "--log-domains", action="append", dest="debug_domains", | ||
| 247 | default=[], | ||
| 248 | help="Show debug logging for the specified logging domains.") | ||
| 249 | |||
| 250 | logging_group.add_argument("-v", "--verbose", action="store_true", | ||
| 251 | help="Enable tracing of shell tasks (with 'set -x'). " | ||
| 252 | "Also print bb.note(...) messages to stdout (in " | ||
| 253 | "addition to writing them to ${T}/log.do_<task>).") | ||
| 254 | |||
| 255 | logging_group.add_argument("-q", "--quiet", action="count", default=0, | ||
| 256 | help="Output less log message data to the terminal. You can specify this " | ||
| 257 | "more than once.") | ||
| 258 | |||
| 259 | logging_group.add_argument("-w", "--write-log", dest="writeeventlog", | ||
| 260 | default=os.environ.get("BBEVENTLOG"), | ||
| 261 | help="Writes the event log of the build to a bitbake event json file. " | ||
| 262 | "Use '' (empty string) to assign the name automatically.") | ||
| 263 | |||
| 264 | |||
| 265 | server_group.add_argument("-B", "--bind", default=False, | ||
| 266 | help="The name/address for the bitbake xmlrpc server to bind to.") | ||
| 267 | |||
| 268 | server_group.add_argument("-T", "--idle-timeout", type=float, dest="server_timeout", | ||
| 269 | default=os.getenv("BB_SERVER_TIMEOUT"), | ||
| 270 | help="Set timeout to unload bitbake server due to inactivity, " | ||
| 271 | "set to -1 means no unload, " | ||
| 272 | "default: Environment variable BB_SERVER_TIMEOUT.") | ||
| 273 | |||
| 274 | server_group.add_argument("--remote-server", | ||
| 275 | default=os.environ.get("BBSERVER"), | ||
| 276 | help="Connect to the specified server.") | ||
| 277 | |||
| 278 | server_group.add_argument("-m", "--kill-server", action="store_true", | ||
| 279 | help="Terminate any running bitbake server.") | ||
| 280 | |||
| 281 | server_group.add_argument("--token", dest="xmlrpctoken", | ||
| 282 | default=os.environ.get("BBTOKEN"), | ||
| 283 | help="Specify the connection token to be used when connecting " | ||
| 284 | "to a remote server.") | ||
| 285 | |||
| 286 | server_group.add_argument("--observe-only", action="store_true", | ||
| 287 | help="Connect to a server as an observing-only client.") | ||
| 288 | |||
| 289 | server_group.add_argument("--status-only", action="store_true", | ||
| 290 | help="Check the status of the remote bitbake server.") | ||
| 291 | |||
| 292 | server_group.add_argument("--server-only", action="store_true", | ||
| 293 | help="Run bitbake without a UI, only starting a server " | ||
| 294 | "(cooker) process.") | ||
| 295 | |||
| 296 | |||
| 297 | config_group.add_argument("-r", "--read", action="append", dest="prefile", default=[], | ||
| 298 | help="Read the specified file before bitbake.conf.") | ||
| 299 | |||
| 300 | config_group.add_argument("-R", "--postread", action="append", dest="postfile", default=[], | ||
| 301 | help="Read the specified file after bitbake.conf.") | ||
| 302 | |||
| 303 | |||
| 304 | config_group.add_argument("-I", "--ignore-deps", action="append", | ||
| 305 | dest="extra_assume_provided", default=[], | ||
| 306 | help="Assume these dependencies don't exist and are already provided " | ||
| 307 | "(equivalent to ASSUME_PROVIDED). Useful to make dependency " | ||
| 308 | "graphs more appealing.") | ||
| 309 | |||
| 291 | return parser | 310 | return parser |
| 292 | 311 | ||
| 293 | 312 | ||
| 294 | class BitBakeConfigParameters(cookerdata.ConfigParameters): | 313 | class BitBakeConfigParameters(cookerdata.ConfigParameters): |
| 295 | def parseCommandLine(self, argv=sys.argv): | 314 | def parseCommandLine(self, argv=sys.argv): |
| 296 | parser = create_bitbake_parser() | 315 | parser = create_bitbake_parser() |
| 297 | options, targets = parser.parse_args(argv) | 316 | options = parser.parse_intermixed_args(argv[1:]) |
| 317 | |||
| 318 | if options.version: | ||
| 319 | print("BitBake Build Tool Core version %s" % bb.__version__) | ||
| 320 | sys.exit(0) | ||
| 298 | 321 | ||
| 299 | if options.quiet and options.verbose: | 322 | if options.quiet and options.verbose: |
| 300 | parser.error("options --quiet and --verbose are mutually exclusive") | 323 | parser.error("options --quiet and --verbose are mutually exclusive") |
| @@ -326,7 +349,7 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): | |||
| 326 | else: | 349 | else: |
| 327 | options.xmlrpcinterface = (None, 0) | 350 | options.xmlrpcinterface = (None, 0) |
| 328 | 351 | ||
| 329 | return options, targets[1:] | 352 | return options, options.targets |
| 330 | 353 | ||
| 331 | 354 | ||
| 332 | def bitbake_main(configParams, configuration): | 355 | def bitbake_main(configParams, configuration): |
| @@ -391,6 +414,9 @@ def bitbake_main(configParams, configuration): | |||
| 391 | 414 | ||
| 392 | return 1 | 415 | return 1 |
| 393 | 416 | ||
| 417 | def timestamp(): | ||
| 418 | return datetime.datetime.now().strftime('%H:%M:%S.%f') | ||
| 419 | |||
| 394 | def setup_bitbake(configParams, extrafeatures=None): | 420 | def setup_bitbake(configParams, extrafeatures=None): |
| 395 | # Ensure logging messages get sent to the UI as events | 421 | # Ensure logging messages get sent to the UI as events |
| 396 | handler = bb.event.LogHandler() | 422 | handler = bb.event.LogHandler() |
| @@ -398,6 +424,11 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
| 398 | # In status only mode there are no logs and no UI | 424 | # In status only mode there are no logs and no UI |
| 399 | logger.addHandler(handler) | 425 | logger.addHandler(handler) |
| 400 | 426 | ||
| 427 | if configParams.dump_signatures: | ||
| 428 | if extrafeatures is None: | ||
| 429 | extrafeatures = [] | ||
| 430 | extrafeatures.append(bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO) | ||
| 431 | |||
| 401 | if configParams.server_only: | 432 | if configParams.server_only: |
| 402 | featureset = [] | 433 | featureset = [] |
| 403 | ui_module = None | 434 | ui_module = None |
| @@ -425,7 +456,7 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
| 425 | retries = 8 | 456 | retries = 8 |
| 426 | while retries: | 457 | while retries: |
| 427 | try: | 458 | try: |
| 428 | topdir, lock = lockBitbake() | 459 | topdir, lock, lockfile = lockBitbake() |
| 429 | sockname = topdir + "/bitbake.sock" | 460 | sockname = topdir + "/bitbake.sock" |
| 430 | if lock: | 461 | if lock: |
| 431 | if configParams.status_only or configParams.kill_server: | 462 | if configParams.status_only or configParams.kill_server: |
| @@ -436,18 +467,22 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
| 436 | logger.info("Starting bitbake server...") | 467 | logger.info("Starting bitbake server...") |
| 437 | # Clear the event queue since we already displayed messages | 468 | # Clear the event queue since we already displayed messages |
| 438 | bb.event.ui_queue = [] | 469 | bb.event.ui_queue = [] |
| 439 | server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface) | 470 | server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface, configParams.profile) |
| 440 | 471 | ||
| 441 | else: | 472 | else: |
| 442 | logger.info("Reconnecting to bitbake server...") | 473 | logger.info("Reconnecting to bitbake server...") |
| 443 | if not os.path.exists(sockname): | 474 | if not os.path.exists(sockname): |
| 444 | logger.info("Previous bitbake instance shutting down?, waiting to retry...") | 475 | logger.info("Previous bitbake instance shutting down?, waiting to retry... (%s)" % timestamp()) |
| 476 | procs = bb.server.process.get_lockfile_process_msg(lockfile) | ||
| 477 | if procs: | ||
| 478 | logger.info("Processes holding bitbake.lock (missing socket %s):\n%s" % (sockname, procs)) | ||
| 479 | logger.info("Directory listing: %s" % (str(os.listdir(topdir)))) | ||
| 445 | i = 0 | 480 | i = 0 |
| 446 | lock = None | 481 | lock = None |
| 447 | # Wait for 5s or until we can get the lock | 482 | # Wait for 5s or until we can get the lock |
| 448 | while not lock and i < 50: | 483 | while not lock and i < 50: |
| 449 | time.sleep(0.1) | 484 | time.sleep(0.1) |
| 450 | _, lock = lockBitbake() | 485 | _, lock, _ = lockBitbake() |
| 451 | i += 1 | 486 | i += 1 |
| 452 | if lock: | 487 | if lock: |
| 453 | bb.utils.unlockfile(lock) | 488 | bb.utils.unlockfile(lock) |
| @@ -466,9 +501,9 @@ def setup_bitbake(configParams, extrafeatures=None): | |||
| 466 | retries -= 1 | 501 | retries -= 1 |
| 467 | tryno = 8 - retries | 502 | tryno = 8 - retries |
| 468 | if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError, SystemExit)): | 503 | if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError, SystemExit)): |
| 469 | logger.info("Retrying server connection (#%d)..." % tryno) | 504 | logger.info("Retrying server connection (#%d)... (%s)" % (tryno, timestamp())) |
| 470 | else: | 505 | else: |
| 471 | logger.info("Retrying server connection (#%d)... (%s)" % (tryno, traceback.format_exc())) | 506 | logger.info("Retrying server connection (#%d)... (%s, %s)" % (tryno, traceback.format_exc(), timestamp())) |
| 472 | 507 | ||
| 473 | if not retries: | 508 | if not retries: |
| 474 | bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") | 509 | bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") |
| @@ -497,5 +532,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?") | 532 | 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 | 533 | raise BBMainFatal |
| 499 | lockfile = topdir + "/bitbake.lock" | 534 | lockfile = topdir + "/bitbake.lock" |
| 500 | return topdir, bb.utils.lockfile(lockfile, False, False) | 535 | return topdir, bb.utils.lockfile(lockfile, False, False), lockfile |
| 501 | 536 | ||
