aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-31 21:53:31 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-31 13:18:12 +0100
commit2bfed75c48a6f6596ded9cb64cb96f00510f914e (patch)
tree9dbcb4f0db9a2813dc81372cb28c19eb7ada948a
parent6069175e9bb97ace100bb5e99b6104d33163a3a2 (diff)
downloadopenembedded-core-contrib-2bfed75c48a6f6596ded9cb64cb96f00510f914e.tar.gz
classes/populate_sdk_ext: support setting vars from environment at build time
When running bitbake you may pass in values of variables from the external environment (making use of BB_ENV_EXTRAWHITE), and you may choose to do this when building the extensible SDK, for example: MACHINE=qemuarm bitbake -c populate_sdk_ext core-image-minimal You would naturally expect those settings to be reflected in the extensible SDK itself; however they were not, since we were only considering local.conf and auto.conf. Check the variables mentioned in BB_ENV_EXTRAWHITE to see if any are different than the values set in local.conf/auto.conf and add lines setting them in the SDK's local.conf if so. Fixes [YOCTO #9339]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/populate_sdk_ext.bbclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 0ea974d4ff..5e2ebd7969 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -164,6 +164,9 @@ python copy_buildsystem () {
f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
f.write(' "\n')
+ env_whitelist = (d.getVar('BB_ENV_EXTRAWHITE', True) or '').split()
+ env_whitelist_values = {}
+
# Create local.conf
builddir = d.getVar('TOPDIR', True)
if derivative:
@@ -176,6 +179,8 @@ python copy_buildsystem () {
newlines.append('# Removed original setting of %s\n' % varname)
return None, op, 0, True
else:
+ if varname in env_whitelist:
+ env_whitelist_values[varname] = origvalue
return origvalue, op, 0, True
varlist = ['[^#=+ ]*']
with open(builddir + '/conf/local.conf', 'r') as f:
@@ -241,6 +246,21 @@ python copy_buildsystem () {
if line.strip() and not line.startswith('#'):
f.write(line)
+ # Ensure any variables set from the external environment (by way of
+ # BB_ENV_EXTRAWHITE) are set in the SDK's configuration
+ extralines = []
+ for name, value in env_whitelist_values.iteritems():
+ actualvalue = d.getVar(name, True) or ''
+ if value != actualvalue:
+ extralines.append('%s = "%s"\n' % (name, actualvalue))
+ if extralines:
+ with open(baseoutpath + '/conf/local.conf', 'a') as f:
+ f.write('\n')
+ f.write('# Extra settings from environment:\n')
+ for line in extralines:
+ f.write(line)
+ f.write('\n')
+
# Filter the locked signatures file to just the sstate tasks we are interested in
excluded_targets = d.getVar('SDK_TARGETS', True)
sigfile = d.getVar('WORKDIR', True) + '/locked-sigs.inc'