summaryrefslogtreecommitdiffstats
path: root/meta/classes/terminal.bbclass
AgeCommit message (Collapse)Author
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-13terminal.bbclass: force bash for devshellJoe Slater
Since shell_trap_code in build.py sets /bin/sh as the interpreter we will die a silent death if our environment contains things like "export -f bodilyfunction" and /bin/sh is really /bin/dash. Fixes this for the case of devshell. Signed-off-by: Joe Slater <joe.slater@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-04-03terminal.bbclass: Generate do_terminal as bitbake wouldNathan Rossi
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-28terminal.bbclass: use var-SHELL as the shebang of wrapper scriptHongxu Jia
The devshell.bbclass set var-SHELL to var-DEVSHELL, and terminal.bbclass initial var-SHELL with `bash'. Keep sync with it, use var-SHELL rather than hardcoded `/bin/sh' as the shebang of wrapper script. On Ubuntu host, default shell is dash (/bin/sh -> dash), even though we assign var-SHELL with `/bin/bash', the wrapper script is still dashism. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-13terminal: Use original PATH for terminalsRichard Purdie
Now that we filter out PATH to only the utilities we rely upon, the devshel terminal was broken since it can no longer find the terminals. Even if we fix that, the user couldn't access any of their commands within devshell which somewhat defeats its purpose. Add the original PATH back to the environment to restore that behaviour since this is more in line with user expectations and it wouldn't be possible (or desireable) to whitelist all the commands a user might want to use from the shell. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-23terminal.bbclass: export configure varsRobert Yang
So that we can easily reproduce configure by: $ $CACHED_CONFIGUREVARS ./configure $CONFIGUREOPTS $EXTRA_OECONF [YOCTO #9423] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16meta: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-23devshell: list commands when throwing NoSupportedTerminalsStephano Cetola
When attempting to run devshell, if no terminal is available, the error being thrown was not very specific. This adds a list of commands that failed, informing the user of what they can install to fix the error. [ YOCTO #10472] Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-02classes/lib: Convert to use python3 octal syntaxRichard Purdie
The syntax for octal values changed in python3, adapt to it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21terminal.bbclass: import oe.terminal for oe.terminal.prioritized()Robert Yang
Fixed: INHERIT += "typecheck" $ bitbake -p ERROR: Failure expanding expression auto none ${@" ".join(o.name for o in oe.terminal.prioritized())} which triggered exception AttributeError: 'module' object has no attribute 'terminal' Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-24classes: Ensure pass setVar/setVarFlag strings, not integersRichard Purdie
This doesn't cause any issues right now but it make sense to standardise on consistently using strings in the data store. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com>
2014-01-10terminal.bbclass: do not export PS1Anders Darander
With a complex PS1 setup, PS1 might not have all characters correctly escaped when terminal.bbclass writes the export. This caused the run.do_terminal.PID to terminate, making it impossible to use the devshell. As the spawned shell will parse e.g. .bashrc (or whatever rc-file is being used), PS1 will be reset in the devshell. Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-20terminal: Exclude BB_ORIGENV from the signaturesRichard Purdie
devshell was printing a traceback when exiting due to the use of dump_sigs() being called on the task. This is turn was since this function referenced BB_ORIGENV. We might as well globally exclude this for now since its a data store object and cannot be pickled, not would it make sense to do so. [YOCTO #5683] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-01meta: Don't use deprecated bitbake APIRichard Purdie
These have been deprecated for a long time, convert the remaining references to the correct modules and prepare for removal of the compatibility support from bitbake. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-18terminal.bbclass: Fix BB_RUNFMT processingMark Hatle
BB_RUNFMT can include task and taskfunc, as well as func and pid. Add the two missing items toe the runfmt processing. Also BB_RUNFMT can include arbitrary directory structure. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-02terminal: Run command using a wrapper scriptTyler Hall
Some terminals may not pass the environment into the child process. This is true when using "tmux split-window." If tmux is already running, it will start the command with the tmux session environment, ignoring the environment where the command was issued. This could possibly be worked around when launching tmux by injecting variables into the user's session environment or adding the variables to the "update-environment" tmux setting. However, both methods would permanently alter the user's session, which is undesirable. By using a wrapper script, we have full control over the final environment. Replace the env dictionary with an empty data smart that will contain the exported variables and a wrapper function that execs the original command. Signed-off-by: Tyler Hall <tylerwhall@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-02-19devshell.bbclass: Allow running devshell and fakeroot togetherRichard Purdie
Currently its hard to run a devshell complete with fakeroot context. This patch allows the fakeroot flag on the task to do this, as with any other task. Since we may need to start X terminal applications, we need to only start the fakeroot session on the final command, hence the hoops this code jumps through. As always with fakeroot, you can break out and run a command without the fake permissions with syntax like "PSEUDO_UNLOAD=1 <command>" [YOCTO #3374] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06terminal.bbclass: Use BB_ORIGENV to restore user environmental variablesRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-02terminal: Ensure existing environment exports are preserved in devshellRichard Purdie
After recent changes to terminal.bbclass, variables like PATH were no longer preserved within the devshell. This change ensures they are inherited into the environment of devshell and PATH for example has the correct values. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-01terminal.bbclass: Ensure parent environment is setRichard Purdie
If this isn't done, various terminals fail to launch correctly with "No such file or directory" errors. This adds back the environment manipulation removed in the addition of "custom" terminal command support but shouldn't regress that additional functionality Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-24terminal: Add support for running custom terminals.Morten Minde Neergaard
Example config: OE_TERMINAL = "custom" OE_TERMINAL_CUSTOMCMD = "mysuperterm" Signed-off-by: Morten Minde Neergaard <mneergaa@cisco.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-09-24terminal: pass data store all the way through to terminal classJason Wessel
Passing the data store will be needed for firing a custom event for the screen class. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-06terminal.bbclass, oe-buildenv-internal: pass SCREENDIR environment variableJason Wessel
Some versions of the screen utility provided from the host OS vendor write the socket directory to $HOME/.screen. When using a shared home directory across many servers, one sets the SCREENDIR environment variable to avoid collisions in the shared home directory. This results in problems launching a devshell where it is not entirely obvious what happened because the SCREENDIR environment variable got stripped from the environment prior to setting up the screen in detached mode. Example: % bitbake -c devshell busybox # ...Please connect in another terminal with "screen -r devshell" % screen -r devshell There is no screen to be resumed matching devshell. The temporary work around was to do something like: sh -c "unset SCREENDIR; screen -r devshell" This patch adds SCREENDIR to the white list to ensure screen works properly on systems where a developer needs to use the SCREENDIR with shared home directories. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-09terminal.bbclass: Improve environment handlingRichard Purdie
Currently the environment handling for terminals is inconsistent. There are two fixes here: a) Ensure the environment is setup before all oe.terminal call b) Actually set the environment before the spawn calls since we need variables like DISPLAY when the commands are being executed, not just within the terminal environment. If this doesn't happen, DISPLAY can end up not set with the errors that brings with it when trying to run X commands. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-24terminal: fix issue with unset exportable env varsChris Larson
This should resolve the devshell issue people are seeing. Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-10Rework how the devshell functionsChris Larson
In the new implementation, each known terminal is defined as a class in oe.terminal, as a subclass of bb.process.Popen. terminal.bbclass wraps this functionality, providing the metadata pieces. It obeys the OE_TERMINAL variable, which is a 'choice' typed variable. This variable may be 'auto', 'none', or any of the names of the defined terminals. When using 'auto', or requesting an unsupported terminal, we attempt to spawn them in priority order until we get one that's available on this system (and in the case of the X terminals, has DISPLAY defined). The 'none' value is used when we're doing things like automated builds, and want to ensure that no terminal is *ever* spawned, under any circumstances. Current available terminals: gnome konsole xterm rxvt screen Signed-off-by: Chris Larson <chris_larson@mentor.com>