summaryrefslogtreecommitdiffstats
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
parent21481bc17ad8ea2942a97e3473e429224e1631ff (diff)
downloadpoky-contrib-f79022dfff7374634cc8153aea61e6bf9c72b377.tar.gz
poky-contrib-f79022dfff7374634cc8153aea61e6bf9c72b377.tar.bz2
poky-contrib-f79022dfff7374634cc8153aea61e6bf9c72b377.zip
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>
-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 62d8599aebd..14f55e0f846 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
logger = logging.getLogger('devtool')
-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 _set_file_values(fn, values):
+ remaining = values.keys()
+
+ def varfunc(varname, origvalue, op, newlines):
+ newvalue = values.get(varname, origvalue)
+ remaining.remove(varname)
+ return (newvalue, '=', 0, True)
+
+ with open(fn, 'r') as f:
+ (updated, newlines) = bb.utils.edit_metadata(f, values, varfunc)
+
+ for item in remaining:
+ updated = True
+ newlines.append('%s = "%s"' % (item, values[item]))
+
+ if updated:
+ with open(fn, 'w') as f:
+ f.writelines(newlines)
+ return updated
+
def build(args, config, basepath, workspace):
"""Entry point for the devtool 'build' subcommand"""
@@ -42,22 +53,18 @@ def build(args, config, basepath, workspace):
build_task = config.get('Build', 'build_task', 'populate_sysroot')
- postfile_param = ""
- postfile = ""
+ bbappend = workspace[args.recipename]['bbappend']
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
+ _set_file_values(bbappend, {'PARALLEL_MAKE': ''})
try:
- exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s %s' % (build_task, postfile_param, args.recipename), watch=True)
+ exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, 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)
+ if args.disable_parallel_make:
+ _set_file_values(bbappend, {'PARALLEL_MAKE': None})
return 0