diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-03-31 21:53:31 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-31 23:01:36 +0100 |
commit | 591b97c6bee1bf25ba44309923059c6aa9a624bd (patch) | |
tree | 6ffdbc3ec5f86012eb1add1a9d3e96271fba31bc /meta/classes | |
parent | c37d5426b1872d29347c1fecd9bda7b455fa15e0 (diff) | |
download | poky-591b97c6bee1bf25ba44309923059c6aa9a624bd.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].
(From OE-Core rev: 2bfed75c48a6f6596ded9cb64cb96f00510f914e)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/populate_sdk_ext.bbclass | 20 |
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 () { | |||
164 | f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n') | 164 | f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n') |
165 | f.write(' "\n') | 165 | f.write(' "\n') |
166 | 166 | ||
167 | env_whitelist = (d.getVar('BB_ENV_EXTRAWHITE', True) or '').split() | ||
168 | env_whitelist_values = {} | ||
169 | |||
167 | # Create local.conf | 170 | # Create local.conf |
168 | builddir = d.getVar('TOPDIR', True) | 171 | builddir = d.getVar('TOPDIR', True) |
169 | if derivative: | 172 | if derivative: |
@@ -176,6 +179,8 @@ python copy_buildsystem () { | |||
176 | newlines.append('# Removed original setting of %s\n' % varname) | 179 | newlines.append('# Removed original setting of %s\n' % varname) |
177 | return None, op, 0, True | 180 | return None, op, 0, True |
178 | else: | 181 | else: |
182 | if varname in env_whitelist: | ||
183 | env_whitelist_values[varname] = origvalue | ||
179 | return origvalue, op, 0, True | 184 | return origvalue, op, 0, True |
180 | varlist = ['[^#=+ ]*'] | 185 | varlist = ['[^#=+ ]*'] |
181 | with open(builddir + '/conf/local.conf', 'r') as f: | 186 | with open(builddir + '/conf/local.conf', 'r') as f: |
@@ -241,6 +246,21 @@ python copy_buildsystem () { | |||
241 | if line.strip() and not line.startswith('#'): | 246 | if line.strip() and not line.startswith('#'): |
242 | f.write(line) | 247 | f.write(line) |
243 | 248 | ||
249 | # Ensure any variables set from the external environment (by way of | ||
250 | # BB_ENV_EXTRAWHITE) are set in the SDK's configuration | ||
251 | extralines = [] | ||
252 | for name, value in env_whitelist_values.iteritems(): | ||
253 | actualvalue = d.getVar(name, True) or '' | ||
254 | if value != actualvalue: | ||
255 | extralines.append('%s = "%s"\n' % (name, actualvalue)) | ||
256 | if extralines: | ||
257 | with open(baseoutpath + '/conf/local.conf', 'a') as f: | ||
258 | f.write('\n') | ||
259 | f.write('# Extra settings from environment:\n') | ||
260 | for line in extralines: | ||
261 | f.write(line) | ||
262 | f.write('\n') | ||
263 | |||
244 | # Filter the locked signatures file to just the sstate tasks we are interested in | 264 | # Filter the locked signatures file to just the sstate tasks we are interested in |
245 | excluded_targets = d.getVar('SDK_TARGETS', True) | 265 | excluded_targets = d.getVar('SDK_TARGETS', True) |
246 | sigfile = d.getVar('WORKDIR', True) + '/locked-sigs.inc' | 266 | sigfile = d.getVar('WORKDIR', True) + '/locked-sigs.inc' |