summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/build.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-11-23 07:39:14 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-01 21:32:04 +0000
commitf79022dfff7374634cc8153aea61e6bf9c72b377 (patch)
tree225ed17a4b2b8d07183e960f25b2db2d93990828 /scripts/lib/devtool/build.py
parent21481bc17ad8ea2942a97e3473e429224e1631ff (diff)
downloadpoky-f79022dfff7374634cc8153aea61e6bf9c72b377.tar.gz
devtool: build: use bbappend to set PARALLEL_MAKE
Use a bbappend file to set PARALLEL_MAKE instead of a postfile; this is a bit neater and only affects the specified recipe. (From OE-Core rev: b5bafc845892ac39f85f3642b120fb7b785a3d58) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@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.py45
1 files changed, 26 insertions, 19 deletions
diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py
index 62d8599aeb..14f55e0f84 100644
--- a/scripts/lib/devtool/build.py
+++ b/scripts/lib/devtool/build.py
@@ -25,16 +25,27 @@ from devtool import exec_build_env_command, check_workspace_recipe, DevtoolError
25 25
26logger = logging.getLogger('devtool') 26logger = logging.getLogger('devtool')
27 27
28def _create_conf_file(values, conf_file=None): 28
29 if not conf_file: 29def _set_file_values(fn, values):
30 fd, conf_file = tempfile.mkstemp(suffix='.conf') 30 remaining = values.keys()
31 elif not os.path.exists(os.path.dirname(conf_file)): 31
32 logger.debug("Creating folder %s" % os.path.dirname(conf_file)) 32 def varfunc(varname, origvalue, op, newlines):
33 bb.utils.mkdirhier(os.path.dirname(conf_file)) 33 newvalue = values.get(varname, origvalue)
34 with open(conf_file, 'w') as f: 34 remaining.remove(varname)
35 for key, value in values.iteritems(): 35 return (newvalue, '=', 0, True)
36 f.write('%s = "%s"\n' % (key, value)) 36
37 return conf_file 37 with open(fn, 'r') as f:
38 (updated, newlines) = bb.utils.edit_metadata(f, values, varfunc)
39
40 for item in remaining:
41 updated = True
42 newlines.append('%s = "%s"' % (item, values[item]))
43
44 if updated:
45 with open(fn, 'w') as f:
46 f.writelines(newlines)
47 return updated
48
38 49
39def build(args, config, basepath, workspace): 50def build(args, config, basepath, workspace):
40 """Entry point for the devtool 'build' subcommand""" 51 """Entry point for the devtool 'build' subcommand"""
@@ -42,22 +53,18 @@ def build(args, config, basepath, workspace):
42 53
43 build_task = config.get('Build', 'build_task', 'populate_sysroot') 54 build_task = config.get('Build', 'build_task', 'populate_sysroot')
44 55
45 postfile_param = "" 56 bbappend = workspace[args.recipename]['bbappend']
46 postfile = ""
47 if args.disable_parallel_make: 57 if args.disable_parallel_make:
48 logger.info("Disabling 'make' parallelism") 58 logger.info("Disabling 'make' parallelism")
49 postfile = os.path.join(basepath, 'conf', 'disable_parallelism.conf') 59 _set_file_values(bbappend, {'PARALLEL_MAKE': ''})
50 _create_conf_file({'PARALLEL_MAKE':''}, postfile)
51 postfile_param = "-R %s" % postfile
52 try: 60 try:
53 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s %s' % (build_task, postfile_param, args.recipename), watch=True) 61 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
54 except bb.process.ExecutionError as e: 62 except bb.process.ExecutionError as e:
55 # We've already seen the output since watch=True, so just ensure we return something to the user 63 # We've already seen the output since watch=True, so just ensure we return something to the user
56 return e.exitcode 64 return e.exitcode
57 finally: 65 finally:
58 if postfile: 66 if args.disable_parallel_make:
59 logger.debug('Removing postfile') 67 _set_file_values(bbappend, {'PARALLEL_MAKE': None})
60 os.remove(postfile)
61 68
62 return 0 69 return 0
63 70