summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-09-08 11:39:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:52 +0100
commit0d0e50810a793f517b253e329339ba40d4bedd36 (patch)
tree6d4f15f49cdf50796d2d957e7c303cce32996698 /scripts
parent1a721815ed9925895525712df15cfb8693d273db (diff)
downloadpoky-0d0e50810a793f517b253e329339ba40d4bedd36.tar.gz
devtool: Allow disabling make parallelism on build command
Through -s/--disable-parallel-make, the user can turn off parallelism on the make tool. This can be useful when debuging race condition issues. In order to set PARALLEL_MAKE = "" a post-config file created and then passed into the build. [YOCTO #7589] (From OE-Core rev: 0bf2e4b3edfc43e7a2e8d3387a9370d110533b7c) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/build.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py
index 0f848e20e9..335aff5491 100644
--- a/scripts/lib/devtool/build.py
+++ b/scripts/lib/devtool/build.py
@@ -16,9 +16,12 @@
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17"""Devtool build plugin""" 17"""Devtool build plugin"""
18 18
19import os
20import bb
19import logging 21import logging
20import argparse 22import argparse
21from devtool import exec_build_env_command 23import tempfile
24from devtool import exec_build_env_command, DevtoolError
22 25
23logger = logging.getLogger('devtool') 26logger = logging.getLogger('devtool')
24 27
@@ -26,18 +29,41 @@ def plugin_init(pluginlist):
26 """Plugin initialization""" 29 """Plugin initialization"""
27 pass 30 pass
28 31
32def _create_conf_file(values, conf_file=None):
33 if not conf_file:
34 fd, conf_file = tempfile.mkstemp(suffix='.conf')
35 elif not os.path.exists(os.path.dirname(conf_file)):
36 logger.debug("Creating folder %s" % os.path.dirname(conf_file))
37 bb.utils.mkdirhier(os.path.dirname(conf_file))
38 with open(conf_file, 'w') as f:
39 for key, value in values.iteritems():
40 f.write('%s = "%s"\n' % (key, value))
41 return conf_file
42
29def build(args, config, basepath, workspace): 43def build(args, config, basepath, workspace):
30 """Entry point for the devtool 'build' subcommand""" 44 """Entry point for the devtool 'build' subcommand"""
31 import bb
32 if not args.recipename in workspace: 45 if not args.recipename in workspace:
33 raise DevtoolError("no recipe named %s in your workspace" % 46 raise DevtoolError("no recipe named %s in your workspace" %
34 args.recipename) 47 args.recipename)
48
35 build_task = config.get('Build', 'build_task', 'populate_sysroot') 49 build_task = config.get('Build', 'build_task', 'populate_sysroot')
50
51 postfile_param = ""
52 postfile = ""
53 if args.disable_parallel_make:
54 logger.info("Disabling 'make' parallelism")
55 postfile = os.path.join(basepath, 'conf', 'disable_parallelism.conf')
56 _create_conf_file({'PARALLEL_MAKE':''}, postfile)
57 postfile_param = "-R %s" % postfile
36 try: 58 try:
37 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) 59 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s %s' % (build_task, postfile_param, args.recipename), watch=True)
38 except bb.process.ExecutionError as e: 60 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 61 # We've already seen the output since watch=True, so just ensure we return something to the user
40 return e.exitcode 62 return e.exitcode
63 finally:
64 if postfile:
65 logger.debug('Removing postfile')
66 os.remove(postfile)
41 67
42 return 0 68 return 0
43 69
@@ -47,4 +73,5 @@ def register_commands(subparsers, context):
47 description='Builds the specified recipe using bitbake', 73 description='Builds the specified recipe using bitbake',
48 formatter_class=argparse.ArgumentDefaultsHelpFormatter) 74 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
49 parser_build.add_argument('recipename', help='Recipe to build') 75 parser_build.add_argument('recipename', help='Recipe to build')
76 parser_build.add_argument('-s', '--disable-parallel-make', action="store_true", help='Disable make parallelism')
50 parser_build.set_defaults(func=build) 77 parser_build.set_defaults(func=build)