summaryrefslogtreecommitdiffstats
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:25:05 +0100
commit0bf2e4b3edfc43e7a2e8d3387a9370d110533b7c (patch)
tree0e6eab306e42ad4d8f275aa62fdfe74e361c0355
parent61bb1759f7ecb8b404f7d97573c61aef31f2f109 (diff)
downloadopenembedded-core-contrib-0bf2e4b3edfc43e7a2e8d3387a9370d110533b7c.tar.gz
openembedded-core-contrib-0bf2e4b3edfc43e7a2e8d3387a9370d110533b7c.tar.bz2
openembedded-core-contrib-0bf2e4b3edfc43e7a2e8d3387a9370d110533b7c.zip
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] 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>
-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 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Devtool build plugin"""
+import os
+import bb
import logging
import argparse
-from devtool import exec_build_env_command
+import tempfile
+from devtool import exec_build_env_command, DevtoolError
logger = logging.getLogger('devtool')
@@ -26,18 +29,41 @@ def plugin_init(pluginlist):
"""Plugin initialization"""
pass
+def _create_conf_file(values, conf_file=None):
+ if not conf_file:
+ fd, conf_file = tempfile.mkstemp(suffix='.conf')
+ elif not os.path.exists(os.path.dirname(conf_file)):
+ logger.debug("Creating folder %s" % os.path.dirname(conf_file))
+ bb.utils.mkdirhier(os.path.dirname(conf_file))
+ with open(conf_file, 'w') as f:
+ for key, value in values.iteritems():
+ f.write('%s = "%s"\n' % (key, value))
+ return conf_file
+
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')
+
+ postfile_param = ""
+ postfile = ""
+ if args.disable_parallel_make:
+ logger.info("Disabling 'make' parallelism")
+ postfile = os.path.join(basepath, 'conf', 'disable_parallelism.conf')
+ _create_conf_file({'PARALLEL_MAKE':''}, postfile)
+ postfile_param = "-R %s" % postfile
try:
- exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
+ exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s %s' % (build_task, postfile_param, 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
+ finally:
+ if postfile:
+ logger.debug('Removing postfile')
+ os.remove(postfile)
return 0
@@ -47,4 +73,5 @@ def register_commands(subparsers, context):
description='Builds the specified recipe using bitbake',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser_build.add_argument('recipename', help='Recipe to build')
+ parser_build.add_argument('-s', '--disable-parallel-make', action="store_true", help='Disable make parallelism')
parser_build.set_defaults(func=build)