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:27:51 +0100 |
| commit | 1a721815ed9925895525712df15cfb8693d273db (patch) | |
| tree | 75097197162c33fe0b04e5479d169acae4dc914c /scripts/lib | |
| parent | 8be95c5fbe6ad970943edabe288fd47d1dcac288 (diff) | |
| download | poky-1a721815ed9925895525712df15cfb8693d273db.tar.gz | |
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.
(From OE-Core rev: 61bb1759f7ecb8b404f7d97573c61aef31f2f109)
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')
| -rw-r--r-- | scripts/lib/devtool/build.py | 50 | ||||
| -rw-r--r-- | scripts/lib/devtool/standard.py | 22 |
2 files changed, 50 insertions, 22 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) | ||
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 4d51a458fe..cbc023247e 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -857,22 +857,6 @@ def reset(args, config, basepath, workspace): | |||
| 857 | return 0 | 857 | return 0 |
| 858 | 858 | ||
| 859 | 859 | ||
| 860 | def build(args, config, basepath, workspace): | ||
| 861 | """Entry point for the devtool 'build' subcommand""" | ||
| 862 | import bb | ||
| 863 | if not args.recipename in workspace: | ||
| 864 | raise DevtoolError("no recipe named %s in your workspace" % | ||
| 865 | args.recipename) | ||
| 866 | build_task = config.get('Build', 'build_task', 'populate_sysroot') | ||
| 867 | try: | ||
| 868 | exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) | ||
| 869 | except bb.process.ExecutionError as e: | ||
| 870 | # We've already seen the output since watch=True, so just ensure we return something to the user | ||
| 871 | return e.exitcode | ||
| 872 | |||
| 873 | return 0 | ||
| 874 | |||
| 875 | |||
| 876 | def register_commands(subparsers, context): | 860 | def register_commands(subparsers, context): |
| 877 | """Register devtool subcommands from this plugin""" | 861 | """Register devtool subcommands from this plugin""" |
| 878 | parser_add = subparsers.add_parser('add', help='Add a new recipe', | 862 | parser_add = subparsers.add_parser('add', help='Add a new recipe', |
| @@ -921,12 +905,6 @@ def register_commands(subparsers, context): | |||
| 921 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | 905 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 922 | parser_status.set_defaults(func=status) | 906 | parser_status.set_defaults(func=status) |
| 923 | 907 | ||
| 924 | parser_build = subparsers.add_parser('build', help='Build a recipe', | ||
| 925 | description='Builds the specified recipe using bitbake', | ||
| 926 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
| 927 | parser_build.add_argument('recipename', help='Recipe to build') | ||
| 928 | parser_build.set_defaults(func=build) | ||
| 929 | |||
| 930 | parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace', | 908 | parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace', |
| 931 | description='Removes the specified recipe from your workspace (resetting its state)', | 909 | description='Removes the specified recipe from your workspace (resetting its state)', |
| 932 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | 910 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
