[yocto] [yocto-autobuilder][PATCH] add force bash option on build and preamble

Stephano Cetola stephano.cetola at linux.intel.com
Mon Jul 10 14:04:46 PDT 2017


Certain distros (Ubuntu) use a less desirable shell for /bin/sh
(dash). In some edge cases, if we source oe-init-build-env from
outside the OEROOT folder, the script will fail (as stated in the
oe-init-build-env script). By adding a variable to force bash as the
shell, we can call "bash -c" to ensure that a compatible shell is
used.

Currently, refkit is the only build that suffers from this edge case.

Signed-off-by: Stephano Cetola <stephano.cetola at linux.intel.com>
---
 buildset-config.controller/nightly-refkit.conf                    | 3 ++-
 lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py | 3 +++
 lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/buildset-config.controller/nightly-refkit.conf b/buildset-config.controller/nightly-refkit.conf
index 1d2487da6..cbc8508d7 100644
--- a/buildset-config.controller/nightly-refkit.conf
+++ b/buildset-config.controller/nightly-refkit.conf
@@ -11,7 +11,7 @@ repos: [{'poky':
              'submodules': True}}]
 steps: [{'SetDest':{}},
         {'CheckOutLayers': {'submodules': True}},
-        {'RunPreamble': {'altcmd': 'refkit/oe-init-build-env'}},
+        {'RunPreamble': {'forcebash': True, 'altcmd': 'refkit/oe-init-build-env'}},
         {'GetDistroVersion' : {'distro': 'refkit'}},
         {'CreateAutoConf': {'machine': 'intel-corei7-64', 'packages': 'ipk',
                             'distro': 'refkit', 'buildhistory' : False,
@@ -44,6 +44,7 @@ steps: [{'SetDest':{}},
         {'ScrapeTargets': {'source': 'refkit/meta-refkit/conf/distro/include/refkit-ci.inc',
                            'targetsvar': 'REFKIT_CI_BUILD_TARGETS'}},
         {'BuildImages': {'images': '#SCRAPEDTARGETS',
+                         'forcebash': True,
                          'oeinit': 'refkit/oe-init-build-env',
                          'overrideenv': ['BITBAKEDIR=#YPDIR/bitbake', 'OEROOT=#YPDIR/meta']}},
         {'ScrapeTargets': {'source': 'refkit/meta-refkit/conf/distro/include/refkit-ci.inc',
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
index 60ce07ff7..0406fd2e9 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
@@ -23,6 +23,7 @@ class BuildImages(BitbakeShellCommand):
     haltOnFailure = False
     flunkOnFailure = True
     name = "BuildImages"
+    forcebash = False
     def __init__(self, factory, argdict=None, **kwargs):
         self.layerversion_yoctobsp=0
         self.machine=""
@@ -163,6 +164,8 @@ class BuildImages(BitbakeShellCommand):
                 if self.minnowExists is None or self.minnowExists == "True":
                     self.command = env + ". ./" + self.oeinit + "; bitbake " + bitbakeflags + self.images
                     self.description = ["Building " + str(self.images)]
+        if self.forcebash:
+            self.command = ['bash', '-c', self.command]
         ShellCommand.start(self)
 
     def describe(self, done=False):
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py
index e9de3c76c..23c4ace2b 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py
@@ -16,6 +16,7 @@ class RunPreamble(ShellCommand):
     haltOnFailure = False
     flunkOnFailure = True
     name = "RunPreamble"
+    forcebash = False
 
     def __init__(self, factory, argdict=None, **kwargs):
         self.factory = factory
@@ -27,4 +28,6 @@ class RunPreamble(ShellCommand):
             self.command = ". ./oe-init-build-env"
         else:
             self.command = ". ./" + self.altcmd
+        if self.forcebash:
+            self.command = ['bash', '-c', self.command]
         ShellCommand.__init__(self, **kwargs)
-- 
2.13.2




More information about the yocto mailing list