Commit Graph

22 Commits

Author SHA1 Message Date
Richard Purdie 8406db9e11 terminal: Use original PATH for terminals
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.

(From OE-Core rev: 67d7ea2db8bce766daf3419feae3cd8045af5114)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-13 09:42:09 +00:00
Robert Yang 1aed4140bf terminal.bbclass: export configure vars
So that we can easily reproduce configure by:

$ $CACHED_CONFIGUREVARS ./configure $CONFIGUREOPTS $EXTRA_OECONF

[YOCTO #9423]

(From OE-Core rev: a851f57de63fe527e04f2296245e9720c40f9c2e)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-23 12:49:49 -08:00
Joshua Lock c4e2c59088 meta: remove True option to getVar calls
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\)

(From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:23 +00:00
Stephano Cetola 93e8db2224 devshell: list commands when throwing NoSupportedTerminals
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]

(From OE-Core rev: c077f4aab2fc956408d4ad45c4e2e2ea6e480624)

Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 11:10:13 +00:00
Richard Purdie 297438e965 classes/lib: Convert to use python3 octal syntax
The syntax for octal values changed in python3, adapt to it.

(From OE-Core rev: 737a095fcde773a36e0fee1f27b74aaa88062386)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:00 +01:00
Robert Yang aeb8964b01 terminal.bbclass: import oe.terminal for oe.terminal.prioritized()
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'

(From OE-Core rev: 74bc2a65ec18c749d9343d9a33eccae93726846c)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21 09:32:41 +00:00
Richard Purdie fecb07755c classes: Ensure pass setVar/setVarFlag strings, not integers
This doesn't cause any issues right now but it make sense to standardise
on consistently using strings in the data store.

(From OE-Core rev: 99203fbe5ad470ef65cff93cec9d7f332883b5ee)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-24 15:50:26 +00:00
Anders Darander 8172f24b62 terminal.bbclass: do not export PS1
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.

(From OE-Core rev: a5e6926cd409140d16391c72316da00ffbfe5429)

Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-10 15:16:52 +00:00
Richard Purdie 394691762a terminal: Exclude BB_ORIGENV from the signatures
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]

(From OE-Core rev: 84b549afb46fce7b5cdaa977286aeb2e90d3bfdb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-20 17:18:16 +00:00
Richard Purdie 554c892ccf meta: Don't use deprecated bitbake API
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.

(From OE-Core rev: 6a39835af2b2b3c7797fe05479341d71a3f3aaf6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-01 15:51:42 +01:00
Mark Hatle 3cef1294f2 terminal.bbclass: Fix BB_RUNFMT processing
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.

(From OE-Core rev: 95f6e9a3d8fa24acc3bab392719e2d92be25d806)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-18 21:23:42 +01:00
Tyler Hall c9c70d6241 terminal: Run command using a wrapper script
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.

(From OE-Core rev: 3bb96671e987ce8110ce98b9f6d9efc093f8d20e)

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-02 22:23:51 +01:00
Richard Purdie 1dc9e9c3c5 devshell.bbclass: Allow running devshell and fakeroot together
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]

(From OE-Core rev: 0a2662a48eaf0487db043c348e2834bb9cdd0466)

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-19 08:47:36 -08:00
Richard Purdie fef84540e3 terminal.bbclass: Use BB_ORIGENV to restore user environmental variables
(From OE-Core rev: 131643695d7ba9d0c32bf8e192e7e3942f50f318)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06 23:41:20 +00:00
Richard Purdie ad9ad06056 terminal: Ensure existing environment exports are preserved in devshell
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.

(From OE-Core rev: f2dfc50bdf403719d40d04488245fd37655b5480)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-02 11:27:54 +00:00
Richard Purdie 05a1f4a5a3 terminal.bbclass: Ensure parent environment is set
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

(From OE-Core rev: 424d2339b462081010af6e7525a71f64d97ff05e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-01 11:49:25 +00:00
Morten Minde Neergaard c45a7d127e terminal: Add support for running custom terminals.
Example config:
OE_TERMINAL = "custom"
OE_TERMINAL_CUSTOMCMD = "mysuperterm"

(From OE-Core rev: c76da87511d2668479745c2f18b8a9b8116c7489)

Signed-off-by: Morten Minde Neergaard <mneergaa@cisco.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-24 12:50:46 +01:00
Jason Wessel 6e0713a3e7 terminal: pass data store all the way through to terminal class
Passing the data store will be needed for firing a custom event
for the screen class.

(From OE-Core rev: 5ccff8d44626bfd3d1af2a7f81f0567997277809)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-24 15:35:30 +01:00
Jason Wessel 23d149856d terminal.bbclass, oe-buildenv-internal: pass SCREENDIR environment variable
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.

(From OE-Core rev: 5568a8f5a1c65bae021b2e36d735d3153acc6d72)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-06 09:55:46 +01:00
Richard Purdie c6caa2e077 terminal.bbclass: Improve environment handling
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.

(From OE-Core rev: 6b680c8da02017bdb17a4826f1819fe0e5f68652)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-09 18:39:26 +01:00
Chris Larson a097c26ca0 terminal: fix issue with unset exportable env vars
This should resolve the devshell issue people are seeing.

(From OE-Core rev: 332f2a9febfc3697ed4a20fca3016e0399ae90eb)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-24 19:23:42 -07:00
Chris Larson 057cc1e816 Rework how the devshell functions
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

(From OE-Core rev: 69f77f80965fa06a057837f8f49eda06855c4086)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-10 13:33:07 +01:00