diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2015-09-08 11:39:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-09 14:27:52 +0100 |
commit | 0d0e50810a793f517b253e329339ba40d4bedd36 (patch) | |
tree | 6d4f15f49cdf50796d2d957e7c303cce32996698 /scripts | |
parent | 1a721815ed9925895525712df15cfb8693d273db (diff) | |
download | poky-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.py | 33 |
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 | ||
19 | import os | ||
20 | import bb | ||
19 | import logging | 21 | import logging |
20 | import argparse | 22 | import argparse |
21 | from devtool import exec_build_env_command | 23 | import tempfile |
24 | from devtool import exec_build_env_command, DevtoolError | ||
22 | 25 | ||
23 | logger = logging.getLogger('devtool') | 26 | logger = 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 | ||
32 | def _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 | |||
29 | def build(args, config, basepath, workspace): | 43 | def 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) |