Skip to contentSkip to conversation

add force bash option on build and preamble

PATCH In review Stephano Cetola 2 participants 2 messages Jul 10, 2017 – Jul 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add force bash option on build and preamble

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.

---
 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(-)
buildset-config.controller/nightly-refkit.conf +2 -1
index 1d2487da6..cbc8508d7 100644
@@ -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',
lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py +3 -0
index 60ce07ff7..0406fd2e9 100644
@@ -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):
lib/python2.7/site-packages/autobuilder/buildsteps/RunPreamble.py +3 -0
index e9de3c76c..23c4ace2b 100644
@@ -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)
Signature · 1 line
2.13.2
#1 lore raw
Quoted 8 lines · Stephano Cetola

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.

Thanks for the fix! I split the patch into two before merging, one for the buildstep logic change and a follow-on to update the buildset- config.controller. Hope you don't mind.

Joshua

Quoted 93 lines

---
 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(-)
buildset-config.controller/nightly-refkit.conf +0 -0
index 1d2487da6..cbc8508d7 100644
@@ -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,

buildset-config.controller/nightly-refkit.conf +0 -0
@@ -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',

(quoted diff) +0 -0

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

buildset-config.controller/nightly-refkit.conf +0 -0
@@ -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=""

buildset-config.controller/nightly-refkit.conf +0 -0
@@ -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):

(quoted diff) +0 -0

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

buildset-config.controller/nightly-refkit.conf +0 -0
@@ -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

buildset-config.controller/nightly-refkit.conf +0 -0
@@ -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