All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/5] classes/populate_sdk_ext: support setting vars from environment at build time
Date: Thu, 31 Mar 2016 21:53:31 +1300	[thread overview]
Message-ID: <989a467aa07088763d4df208cb59cd8cbcdfc9f5.1459414389.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1459414389.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1459414389.git.paul.eggleton@linux.intel.com>

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>
---
 meta/classes/populate_sdk_ext.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 0ea974d..5e2ebd7 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'
-- 
2.5.5



  reply	other threads:[~2016-03-31  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  8:53 [PATCH 0/5] Extensible SDK fixes Paul Eggleton
2016-03-31  8:53 ` Paul Eggleton [this message]
2016-03-31  8:53 ` [PATCH 2/5] oe-publish-sdk: prevent specifying a directory for the SDK argument Paul Eggleton
2016-03-31  8:53 ` [PATCH 3/5] oe-publish-sdk: exclude sstate-cache if publishing minimal SDK Paul Eggleton
2016-03-31  8:53 ` [PATCH 4/5] toolchain-shar-extract.sh: ensure all_proxy is allowed through Paul Eggleton
2016-03-31  8:53 ` [PATCH 5/5] devtool: modify: call shutdown on tinfoil when done Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=989a467aa07088763d4df208cb59cd8cbcdfc9f5.1459414389.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.