diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2015-09-08 11:39:10 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-09 14:25:05 +0100 |
commit | 61bb1759f7ecb8b404f7d97573c61aef31f2f109 (patch) | |
tree | 196799ad01830c992556ee4db0e0f17b109230c8 /scripts/lib/devtool/build.py | |
parent | 4020f5d91b3e4d011150d5081d36215f8eab732e (diff) | |
download | openembedded-core-61bb1759f7ecb8b404f7d97573c61aef31f2f109.tar.gz openembedded-core-61bb1759f7ecb8b404f7d97573c61aef31f2f109.tar.bz2 openembedded-core-61bb1759f7ecb8b404f7d97573c61aef31f2f109.zip |
devtool: Create a single file for the build devtool feature
The intention is to have a single file for each devtool feature
so devtool can grow in a modular way. In this direction, this patch creates
build.py, moving all related build features from standard.py to build.py.
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 @@ +# Development tool - build command plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool build plugin""" + +import logging +import argparse +from devtool import exec_build_env_command + +logger = logging.getLogger('devtool') + +def plugin_init(pluginlist): + """Plugin initialization""" + pass + +def build(args, config, basepath, workspace): + """Entry point for the devtool 'build' subcommand""" + import bb + if not args.recipename in workspace: + raise DevtoolError("no recipe named %s in your workspace" % + args.recipename) + build_task = config.get('Build', 'build_task', 'populate_sysroot') + try: + exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) + except bb.process.ExecutionError as e: + # We've already seen the output since watch=True, so just ensure we return something to the user + return e.exitcode + + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + parser_build = subparsers.add_parser('build', help='Build a recipe', + description='Builds the specified recipe using bitbake', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_build.add_argument('recipename', help='Recipe to build') + parser_build.set_defaults(func=build) |