Patchwork [1/2] Allow passthrough of important placement variables when using devshell

login
register
mail settings
Submitter blloyd
Date Oct. 31, 2013, 8:02 a.m.
Message ID <eec32fc87fea48dfecfb8af9e26956efaab59558.1383206227.git.blloyd@familyhonor.net>
Download mbox | patch
Permalink /patch/60875/
State New
Headers show

Comments

blloyd - Oct. 31, 2013, 8:02 a.m.
The environment is very well sanitized when using the shell.  However, when using devshell developers are typically interested in sources and build artifacts.  The variables B S and D control this but are cleaned from the environment when a shell is started.  Add a new variable to allow additional variables to be kept for a developer shell and set it to "B S D" by default.  The implementation allows variables for developer convenience and verification while not changing shells used for compile tasks.

Signed-off-by: blloyd <blloyd@familyhonor.net>
---
 meta/classes/devshell.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
Richard Purdie - Nov. 1, 2013, 11:04 a.m.
On Thu, 2013-10-31 at 03:02 -0500, blloyd wrote:
> The environment is very well sanitized when using the shell.  However, when using devshell developers are typically interested in sources and build artifacts.  The variables B S and D control this but are cleaned from the environment when a shell is started.  Add a new variable to allow additional variables to be kept for a developer shell and set it to "B S D" by default.  The implementation allows variables for developer convenience and verification while not changing shells used for compile tasks.
> 
> Signed-off-by: blloyd <blloyd@familyhonor.net>
> ---
>  meta/classes/devshell.bbclass | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass
> index 92edb9e..cc1bb64 100644
> --- a/meta/classes/devshell.bbclass
> +++ b/meta/classes/devshell.bbclass
> @@ -2,7 +2,17 @@ inherit terminal
>  
>  DEVSHELL = "${SHELL}"
>  
> +OE_DEVSHELL_TERMINAL_ADDL_EXPORTS ?= "B S D"
> +OE_DEVSHELL_TERMINAL_ADDL_EXPORTS[type] = 'list'

Can we call this something like DEVSHELL_EXTRA_ENVVARS which is a little
simpler?

>  python do_devshell () {
> +    import oe.data
> +    import oe.terminal

Why do we need to import these?

> +    export_dev=d.getVar('OE_DEVSHELL_TERMINAL_ADDL_EXPORTS') 

We should probably use ", True" here and expand since that is the common
behaviour. I'd also prefer " = " for consistent spacing.

> +    export_term=d.getVar('OE_TERMINAL_EXPORTS')

ditto spacing and ", True".

> +    export_term = export_term + ' ' + export_dev
> +    d.setVar('OE_TERMINAL_EXPORTS', export_term)
> +
>      if d.getVarFlag("do_devshell", "manualfakeroot"):
>         d.prependVar("DEVSHELL", "pseudo ")
>         fakeenv = d.getVar("FAKEROOTENV", True).split()

Cheers,

Richard
Richard Purdie - Nov. 1, 2013, 11:04 a.m.
On Thu, 2013-10-31 at 03:02 -0500, blloyd wrote:
> The environment is very well sanitized when using the shell.  However, when using devshell developers are typically interested in sources and build artifacts.  The variables B S and D control this but are cleaned from the environment when a shell is started.  Add a new variable to allow additional variables to be kept for a developer shell and set it to "B S D" by default.  The implementation allows variables for developer convenience and verification while not changing shells used for compile tasks.
> 
> Signed-off-by: blloyd <blloyd@familyhonor.net>
> ---
>  meta/classes/devshell.bbclass | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Also, the summary of the commit message should start "devshell: " and
you should fold in the whitespace fix patch.

Cheers,

Richard

Patch

diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass
index 92edb9e..cc1bb64 100644
--- a/meta/classes/devshell.bbclass
+++ b/meta/classes/devshell.bbclass
@@ -2,7 +2,17 @@  inherit terminal
 
 DEVSHELL = "${SHELL}"
 
+OE_DEVSHELL_TERMINAL_ADDL_EXPORTS ?= "B S D"
+OE_DEVSHELL_TERMINAL_ADDL_EXPORTS[type] = 'list'
+
 python do_devshell () {
+    import oe.data
+    import oe.terminal
+    export_dev=d.getVar('OE_DEVSHELL_TERMINAL_ADDL_EXPORTS') 
+    export_term=d.getVar('OE_TERMINAL_EXPORTS')
+    export_term = export_term + ' ' + export_dev
+    d.setVar('OE_TERMINAL_EXPORTS', export_term)
+
     if d.getVarFlag("do_devshell", "manualfakeroot"):
        d.prependVar("DEVSHELL", "pseudo ")
        fakeenv = d.getVar("FAKEROOTENV", True).split()