summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/terminal.py
AgeCommit message (Collapse)Author
2020-05-27terminal.py: do not stop searching for autoJoe Slater
If a terminal fails to spawn() we should continue looking. gnome-terminal, in particular can be present but not start. Signed-off-by: Joe Slater <joe.slater@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 6e4babdeee38d32002a4c9129e77466ae4156dd7) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2019-10-08lib/oe/terminal.py: fix gnome-terminal start behaviorTrevor Gamblin
[Bugzilla Bug 13201] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=13201 Newer versions of gnome-terminal (3.32.0 and up) are not starting as expected for commands e.g. "bitbake -c devshell zlib". This manifests as the instance appearing as a new tab rather than a new window. Fix this (and maintain new window preferred behavior) by changing the "-x" option to "--" as per the warning message, avoiding deprecated options: # Option “--command” is deprecated and might be removed in a later version of gnome-terminal. # Use “-- ” to terminate the options and put the command line to execute after it. Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-04terminal: Fix working directory in tmux terminalsJacob Kroon
Recent version of tmux seems to use PWD from the environment instead of the actual working directory. Help it use the correct path. Fixes setting the correct working directory when running devshell and menuconfig tasks. Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22terminal: Cope with unreleased versions of tmuxMike Crowe
When tmux is built from a non-release Git version, its version number is "next-X" where X appears to be the expected version number for the next release. For example, when built from the current state of master, running "tmux -V" yields: tmux next-2.9 Currently check_tmux_pane_size only checks for the version being less than 1.9, so it seems unfair to fail with an obscure Python error in this case. Let's just use the version number after the "next-" prefix if it is present. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-26logging: use warning instead warnChen Qi
The warn method is deprecated. We should use the documented warning instead. Quoting from the python's official doc: """ Note: There is an obsolete method warn which is functionally identical to warning. As warn is deprecated, please do not use it - use warning instead. """ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-07lib/oe/terminal.py: use an absolute path to execute oe-gnome-terminal-phonehomeMing Liu
A flaw was found on my Ubuntu 14.04.5 LTS, on which that gnome-terminal is the default terminal, when I run any of the tasks: bitbake busybox -c menuconfig/devshell/devpyshell bitbake virtual/kernel -c menuconfig/devshell/devpyshell I got a error as follows: "Failed to execute child process "oe-gnome-terminal-phonehome" (No such file or directory)" Seems the environment of the process calling Popen is not passed to the child process, this behaviour is a known issue in Python bug tracker: http://bugs.python.org/issue8557 It could be fixed by using an absolute path instead per test. Signed-off-by: Ming Liu <liu.ming50@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27terminal.py: add support for mate-terminal in check_terminal_version()Andre McCurdy
Not currently used, but include for completeness. Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27terminal.py: fix devshell with mate-terminalAndre McCurdy
Without the --disable-factory option, mate-terminal fails to start with the error: | There was an error creating the child process for this terminal | Failed to execute child process "oe-gnome-terminal-phonehome" (No such file or directory) The --disable-factory option was removed by: http://git.openembedded.org/openembedded-core/commit/?id=e8dca725ed8211a874472300a3ed50e494039ab9 apparently based on an assuption that mate-terminal continues to track gnome-terminal since forking from it. However, based on the mate-terminal man page in the upstream master branch, the option is still supported: https://github.com/mate-desktop/mate-terminal Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27terminal.py: avoid 100% cpu while waiting for phonehome pid fileAndre McCurdy
Some of the less common terminal types haven't been tested with the recent phonehome pid file changes and there may be error cases where the pid file is never created. Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08terminal: wait for terminal task to finish before proceddingLeonardo Sandoval
This commit generalizes the work done in [1] and [2], both fixing issues on several areas (the former with -c patch and gnome-terminal and the latter with -c menuconfig and several terminals, including gnome-terminal and tmux). The main idea is to get the PID from the new spawned terminal and loop there until finished. [1] 76e8ab47c9: terminal: Fix gnome-terminal to work with recent versions [2] 7d02ea283b: cml1.bbclass: wait until menuconfig terminal finishes Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-30terminal.py: Pass string instead of bytes to ExecutionError to avoid exceptionMartin Vuille
Based on run() in bitbake/lib/bb/process.py, ExecutionError() expects strings not bytes. Passing bytes results in a "TypeError: Can't convert 'bytes' object to str implicitly" exception. Fixes Bug 10729 Signed-off-by: Martin Vuille <jpmv27@yahoo.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-10-28terminal.py: Add compatiblity for konsole 16.08.1Davis, Michael
Konsole has dropped support for the nofork flag. It has been replaced with the seperate flag. Signed-off-by: Michael Davis <michael.davis@essvote.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-08-10terminal: Add sleep in pid-monitor loopJacob Kroon
Monitoring the process started by gnome-terminal was spinning in a busy-loop. Insert some sleeping so that we don't eat all the cpu. Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-08terminal: Drop gnome-terminal --disable-factory workaroundsRichard Purdie
With the new pid monitoring code we have for recent versions of gnome-terminal we can just drop the --disable-factory code now since the other solution handles this case as well. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08terminal: Fix gnome-terminal to work with recent versionsRichard Purdie
Currently gnome-terminal just returns straight away, opening a terminal in a new separate process we have no insight into. For patch resolution, this leads to spawning many different terminal windows, for pydevshell, it just flashes a window up and then closes. We need to block until the command completes but gnome-terminal gives us no way to do this. We therefore write the pid to a file using a "phonehome" wrapper script, then monitor the pid until it exits. [YOCTO #7254] (also fixing do_devpyshell) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-12lib/oe/terminal.py: decode bytes variable before rstrip/splitLeonardo Sandoval
On python 3, bytes variable types must be decoded if these are intended to be used as strings, otherwise we get the following error exception: TypeError: Type str doesn't support the buffer API Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-02classes/lib: Complete transition to python3Richard Purdie
This patch contains all the other misc pieces of the transition to python3 which didn't make sense to be broken into individual patches. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-13lib/oe/terminal: set workdir for konsole terminalPascal Bach
It seems that if the --workdir option is not set konsole does open in the users home directory. By setting --workdir . konsole opens in the recipes work directory. This is the same behavior as observed for other consoles. (Tested with Konsole 2.14.2 on Debian Jessie). Signed-off-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-01lib/oe/terminal: use C locale when determining versionDariusz Pelowski
Signed-off-by: Dariusz Pelowski <dariusz.pelowski@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-11-25terminal: Open a new window instead of split on older tmux versions (<1.9)Leonardo Sandoval
If an old version is detected (<1.9), create a new window instead of split: the reason is that there is no easy way to get the active pane height if no nested formats are supported. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-26terminal.py: Allow devshell/menuconfig on recent gnome-terminalLeonardo Sandoval
Recent versions of gnome-terminal does not support non-UTF8 charset: https://bugzilla.gnome.org/show_bug.cgi?id=732127 as a result, devshell and menuconfig tasks silently hang (error found on trace log of 'strace -f -v -s 8192 -e write=2 bitbake -c devshell quilt-native': "Non UTF-8 locale (ANSI_X3.4-1968) is not supported!"). As a workaround, clearing the LC_ALL environment variable so it uses the locale. Once fixed on the gnome-terminal project, this should be removed. Tested on gnome-terminal versions: GNOME Terminal 3.4.1.1 GNOME Terminal 3.14.2 (Default on Ubuntu 15.04) [YOCTO #7791] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-26lib/oe/terminal: fix konsole terminal support for KDE 4.xPaul Eggleton
It seems that the --nofork option genuinely stops konsole from going into the background now; I'm not sure when this changed but it does seem to be working so we can use it. (Tested with Konsole 2.10 and 2.14.2). Fixes [YOCTO #4934]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-26lib/oe/terminal: fix regressionsPaul Eggleton
Fix up some issues introduced by OE-Core commit 818c94f5b9882c2028ef9f056714a0a3c9045551: * If we want to support versions with more than two parts, versions with only one part, or versions with non-integer parts, then we have to stay with strings. We can use distutils.version.LooseVersion() to help with comparisons. * We don't want a warning when launching gnome-terminal 3.10+ and logger.warn() doesn't take a first integer parameter anyway (logger.debug() does). * Also clean up tabs. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24terminal.py: No --disable-factory for gnome-terminal >= 3.10Sven Ebenfeld
--disable-factory has been disabled in earlier versions of gnome-terminal but from version 3.10 it raises an error and quits. This makes devshell unusable with gnome-terminal >= 3.10. This patch checks for the version and removes --disable-factory if you have the terminal version 3.10 or higher. Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-07terminal.py: add tmux new window optionDan McGregor
Add a new terminal type that makes a new window in the running tmux session instead of splitting the window. 80x25 is not enough to run menuconfig inside a split window, so add the option to create a new window instead. Use the new window option by default when the split window would be less than 19 lines high. Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-03lib/oe/terminal: add support for Terminology terminal emulatorRodrigo Chiossi
Terminology is the default Enlightenment terminal emulator Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-03terminal.py: fixes launching multiple windows of gnome-terminalAlejandro Hernandez
When resolving a patch, a new process of gnome-terminal is created for every patch to be resolved, it "waits" for the previous one to end, instead of launching multiple windows at the same time. [YOCTO #7254] Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2014-04-23make menuconfig work for recent xfce environmentAndreas Müller
xfce terminal was renamed 'Terminal' -> 'xfce4-teminal' mainline end of 2012, so the distros supporting 'Terminal' will dissapear. The distros not mentionied in __init__ do (e.g fedora 19 - tested) fail - or will fail sooner or later. Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-02meta/lib/oe/terminal.py: Don't pass non-supported '--disable-factory' flag ↵Jacob Kroon
to gnome-terminal By default, all GNOME terminals share a single process, reducing memory usage. This can be disabled by starting gnome-terminal with the --disable-factory option However, gnome-terminal in Fedora 20 does no longer support the '--disable-factory' flag, so remove it. As the support for 'mate' terminals was added as a copy of the gnome code in 8cc078a9c679845464c59028f584d7aba098cc1f, remove the flag here aswell. Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-30lib/oe/terminal.py: add support for MATE desktop terminalsAndre McCurdy
A simple clone of the corresponding Gnome class. Without this, devshell fails completely on a default installation of MATE desktop Linux Mint 15. Signed-off-by: Andre McCurdy <andre.mccurdy@entropic.com> Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-02TmuxRunning: handle multi-word commandsTyler Hall
Just as in f8ed7446755eeb88191e16749350efa1e7e6197c, tmux wants a single argument for its command. This applies to the "split-window" command as well as "new." Note that this alone is not enough to fix the TmuxRunning devshell when using pseudo because tmux does not preserve the environment that pseudo requires. Signed-off-by: Tyler Hall <tylerwhall@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-06-11handle two-word commands with tmuxPeter Seebach
Trying to make a devshell using tmux can fail because "tmux new" expects a single command, not a series of arguments. It does, however, split strings in a suitable way. So you can quote the command. The failure mode is particularly arcane, in that you end up with a message like: ERROR: Unable to spawn terminal auto: \ Execution of 'pseudo /bin/bash' failed with exit code 1: usage: new-session [-d] [-n window-name] [-s session-name] \ [-t target-session] [command] which is confusing because there's no "new-session" anywhere in sight (that's actually "tmux new"), and because what failed to execute wasn't either pseudo or bash. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09meta/lib/oe: Replace StandardError with ExceptionRichard Purdie
StandardError is removed in python3, replace with Exception class instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-15oe.terminal: add tmux classesChristopher Larson
This adds two new Terminal classes. It's separated into two, so that opening a split inside a tmux window is preferred to the other terminal types, but opening a tmux session is prioritized only slightly higher than screen. - tmuxrunning: Open a new pane in the current running tmux window. Requires that the TMUX variable be added to the env whitelist to use it. - tmux: Open a new tmux session Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-04oe.terminal: add tmux classesChristopher Larson
This adds two new Terminal classes. It's separated into two, so that opening a split inside a tmux window is preferred to the other terminal types, but opening a tmux session is prioritized only slightly higher than screen. - tmuxrunning: Open a new pane in the current running tmux window. Requires that the TMUX variable be added to the env whitelist to use it. - tmux: Open a new tmux session Signed-off-by: Christopher Larson <chris_larson@mentor.com> 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: Send LogExecTTY event to spawn screenJason Wessel
Bitbake has the ability to request to run a command and if it is not possible fall back to emitting a log message. This can be used to start a screen client automatically on the controling tty if the UI has an interactive tty. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-08-25terminal.py: use unique ids for screen sessionsJason Wessel
When running multiple sets of builds on the same system, it is hard to distinguish which build belongs to which screen session and you can end up resuming the wrong session. The simple solution is to just append the process id to the screen session invocation to make each unique. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-07-19Remove a number of unneeded import os/bb callsRichard Purdie
The bb and os modules are always imported so having these extra import calls are a waste of space/execution time. They also set a bad example for people copy and pasting code so clean them up. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-18terminal.py: Fix Xfce on ubuntu/debian; some cleanupJeffrey C Honig
* Xfce class was setting and passing wrong variable for ubuntu/debian. * Xfce class was using -e instead of -x for passing command. The former creates a shell escape nightmare * Clean up local and instance/class variables with same name but different usage. * Remove side-effect and directly return formatted command for clarity. Signed-off-by: Jeffrey C Honig <jeffrey.honig@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2011-11-01lib/oe/terminal: add support for XFCE's terminal emulatorJoshua Lock
That's Terminal on Fedora and xfce4-terminal on Ubuntu/Debian... This could get interesting! Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-18lib/oe/terminal.py: declare konsole from KDE 4.x as unsupportedPaul Eggleton
Konsole 2.x (from KDE 4.x) does not work as devshell - it does not pass the environment or current working directory through among other issues, so do a version check and disable it if it is found (skipping to the next available terminal application.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2011-08-10oe.terminal: improve how we spawn screenChris Larson
- Name the screen session 'devshell', to avoid confusion if running bitbake itself under a screen session. - Display a warning message when spawning screen, so it's clear to the user that screen has been run (otherwise do_devshell just appears to hang). Signed-off-by: Chris Larson <chris_larson@mentor.com>
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>