summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/build.py
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-09-08 11:39:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:51 +0100
commit1a721815ed9925895525712df15cfb8693d273db (patch)
tree75097197162c33fe0b04e5479d169acae4dc914c /scripts/lib/devtool/build.py
parent8be95c5fbe6ad970943edabe288fd47d1dcac288 (diff)
downloadpoky-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/devtool/build.py')
-rw-r--r--scripts/lib/devtool/build.py50
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
19import logging
20import argparse
21from devtool import exec_build_env_command
22
23logger = logging.getLogger('devtool')
24
25def plugin_init(pluginlist):
26 """Plugin initialization"""
27 pass
28
29def 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
44def 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)