diff options
Diffstat (limited to 'scripts/lib/devtool/build.py')
| -rw-r--r-- | scripts/lib/devtool/build.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py new file mode 100644 index 0000000000..0f848e20e9 --- /dev/null +++ b/scripts/lib/devtool/build.py | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | # Development tool - build command plugin | ||
| 2 | # | ||
| 3 | # Copyright (C) 2014-2015 Intel Corporation | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License version 2 as | ||
| 7 | # published by the Free Software Foundation. | ||
| 8 | # | ||
| 9 | # This program is distributed in the hope that it will be useful, | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | # GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along | ||
| 15 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | """Devtool build plugin""" | ||
| 18 | |||
| 19 | import logging | ||
| 20 | import argparse | ||
| 21 | from devtool import exec_build_env_command | ||
| 22 | |||
| 23 | logger = logging.getLogger('devtool') | ||
| 24 | |||
| 25 | def plugin_init(pluginlist): | ||
| 26 | """Plugin initialization""" | ||
| 27 | pass | ||
| 28 | |||
| 29 | def build(args, config, basepath, workspace): | ||
| 30 | """Entry point for the devtool 'build' subcommand""" | ||
| 31 | import bb | ||
| 32 | if not args.recipename in workspace: | ||
| 33 | raise DevtoolError("no recipe named %s in your workspace" % | ||
| 34 | args.recipename) | ||
| 35 | build_task = config.get('Build', 'build_task', 'populate_sysroot') | ||
| 36 | try: | ||
| 37 | exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) | ||
| 38 | except bb.process.ExecutionError as e: | ||
| 39 | # We've already seen the output since watch=True, so just ensure we return something to the user | ||
| 40 | return e.exitcode | ||
| 41 | |||
| 42 | return 0 | ||
| 43 | |||
| 44 | def register_commands(subparsers, context): | ||
| 45 | """Register devtool subcommands from this plugin""" | ||
| 46 | parser_build = subparsers.add_parser('build', help='Build a recipe', | ||
| 47 | description='Builds the specified recipe using bitbake', | ||
| 48 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
| 49 | parser_build.add_argument('recipename', help='Recipe to build') | ||
| 50 | parser_build.set_defaults(func=build) | ||
