All of lore.kernel.org
 help / color / mirror / Atom feed
* [yocto-autobuilder][PATCH] add force bash option on build and preamble
@ 2017-07-10 21:04 Stephano Cetola
  2017-07-11 11:02 ` Joshua Lock
  0 siblings, 1 reply; 2+ messages in thread
From: Stephano Cetola @ 2017-07-10 21:04 UTC (permalink / raw)
  To: yocto

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@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [yocto-autobuilder][PATCH] add force bash option on build and preamble
  2017-07-10 21:04 [yocto-autobuilder][PATCH] add force bash option on build and preamble Stephano Cetola
@ 2017-07-11 11:02 ` Joshua Lock
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Lock @ 2017-07-11 11:02 UTC (permalink / raw)
  To: Stephano Cetola, yocto

On Mon, 2017-07-10 at 14:04 -0700, Stephano Cetola wrote:
> 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

> Signed-off-by: Stephano Cetola <stephano.cetola@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
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-11 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10 21:04 [yocto-autobuilder][PATCH] add force bash option on build and preamble Stephano Cetola
2017-07-11 11:02 ` Joshua Lock

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.