diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-07 18:39:54 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-09 18:39:26 +0100 |
commit | c6caa2e0773b782c6d195c18f36534a2f99fb23a (patch) | |
tree | 9ed667e9ff9f8d9afe2a8def5ffd6033c0e49622 /meta | |
parent | fa071627adac4b493e524c536b47485e728766c1 (diff) | |
download | poky-c6caa2e0773b782c6d195c18f36534a2f99fb23a.tar.gz |
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>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/terminal.bbclass | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass index f29aeb0e12..ca28bd24f2 100644 --- a/meta/classes/terminal.bbclass +++ b/meta/classes/terminal.bbclass | |||
@@ -15,6 +15,11 @@ def oe_terminal(command, title, d): | |||
15 | import oe.data | 15 | import oe.data |
16 | import oe.terminal | 16 | import oe.terminal |
17 | 17 | ||
18 | for export in oe.data.typed_value('OE_TERMINAL_EXPORTS', d): | ||
19 | value = d.getVar(export, True) | ||
20 | if value is not None: | ||
21 | os.environ[export] = str(value) | ||
22 | |||
18 | terminal = oe.data.typed_value('OE_TERMINAL', d).lower() | 23 | terminal = oe.data.typed_value('OE_TERMINAL', d).lower() |
19 | if terminal == 'none': | 24 | if terminal == 'none': |
20 | bb.fatal('Devshell usage disabled with OE_TERMINAL') | 25 | bb.fatal('Devshell usage disabled with OE_TERMINAL') |
@@ -28,14 +33,8 @@ def oe_terminal(command, title, d): | |||
28 | except oe.terminal.ExecutionError as exc: | 33 | except oe.terminal.ExecutionError as exc: |
29 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) | 34 | bb.fatal('Unable to spawn terminal %s: %s' % (terminal, exc)) |
30 | 35 | ||
31 | env = dict(os.environ) | ||
32 | for export in oe.data.typed_value('OE_TERMINAL_EXPORTS', d): | ||
33 | value = d.getVar(export, True) | ||
34 | if value is not None: | ||
35 | env[export] = str(value) | ||
36 | |||
37 | try: | 36 | try: |
38 | oe.terminal.spawn_preferred(command, title, env) | 37 | oe.terminal.spawn_preferred(command, title) |
39 | except oe.terminal.NoSupportedTerminals: | 38 | except oe.terminal.NoSupportedTerminals: |
40 | bb.fatal('No valid terminal found, unable to open devshell') | 39 | bb.fatal('No valid terminal found, unable to open devshell') |
41 | except oe.terminal.ExecutionError as exc: | 40 | except oe.terminal.ExecutionError as exc: |