All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] terminal.bbclass: Generate do_terminal as bitbake would
@ 2019-04-02  8:17 Nathan Rossi
  2019-04-02  8:17 ` [PATCH 2/2] cml1.bbclass: Use POSIX sh instead of var-SHELL Nathan Rossi
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Rossi @ 2019-04-02  8:17 UTC (permalink / raw)
  To: openembedded-core

This changes the runfile that is generated to have the same behaviour as
bitbake with regards to emitting the shebang and trap code. The existing
implementation used 'env' with the current var-SHELL. This means that if
the user has configured there system/environment with a alternate shell
(e.g. csh, zsh, fish, etc.) the do_terminal function would attempt to
execute with the wrong/incompatible shell and fail silently.

With this change devshell and other classes that rely on terminal can
now run when the var-SHELL is not set to a sh compatible shell. For
devshell, it will launch the devshell with the users configured shell.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
 meta/classes/terminal.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index 73e765d57a..6059ae95e0 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -14,6 +14,7 @@ def oe_terminal_prioritized():
     return " ".join(o.name for o in oe.terminal.prioritized())
 
 def emit_terminal_func(command, envdata, d):
+    import bb.build
     cmd_func = 'do_terminal'
 
     envdata.setVar(cmd_func, 'exec ' + command)
@@ -25,8 +26,7 @@ def emit_terminal_func(command, envdata, d):
     bb.utils.mkdirhier(os.path.dirname(runfile))
 
     with open(runfile, 'w') as script:
-        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
-        script.write('set -e\n')
+        script.write(bb.build.shell_trap_code())
         bb.data.emit_func(cmd_func, script, envdata)
         script.write(cmd_func)
         script.write("\n")
---
2.20.1


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

* [PATCH 2/2] cml1.bbclass: Use POSIX sh instead of var-SHELL
  2019-04-02  8:17 [PATCH 1/2] terminal.bbclass: Generate do_terminal as bitbake would Nathan Rossi
@ 2019-04-02  8:17 ` Nathan Rossi
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Rossi @ 2019-04-02  8:17 UTC (permalink / raw)
  To: openembedded-core

Use the default POSIX sh instead of relying of var-SHELL being set to a
compatible shell. Such that in cases where SHELL is set to a
incompatible shell (e.g. csh, zsh, fish, etc.) the terminal command does
not just silently fail.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
 meta/classes/cml1.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
index 7f6df4011b..98d24cec74 100644
--- a/meta/classes/cml1.bbclass
+++ b/meta/classes/cml1.bbclass
@@ -26,7 +26,7 @@ python do_menuconfig() {
     except OSError:
         mtime = 0
 
-    oe_terminal("${SHELL} -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
+    oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
                 d.getVar('PN') + ' Configuration', d)
 
     # FIXME this check can be removed when the minimum bitbake version has been bumped
---
2.20.1


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

end of thread, other threads:[~2019-04-02  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02  8:17 [PATCH 1/2] terminal.bbclass: Generate do_terminal as bitbake would Nathan Rossi
2019-04-02  8:17 ` [PATCH 2/2] cml1.bbclass: Use POSIX sh instead of var-SHELL Nathan Rossi

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.