[OE-core] [PATCH 2/2] image.py: Avoid creating empty .env file in _write_wic_env

Ed Bartosh ed.bartosh at linux.intel.com
Mon Nov 23 17:28:54 UTC 2015


Looks good to me.

Acked-by: Ed Bartosh <ed.bartosh at linux.intel.com>

On Thu, Nov 19, 2015 at 11:21:16AM +0000, Mike Crowe wrote:
> Creating a file for every image containing a few variables isn't
> necessary if wic is not being used, so don't write the file if WICVARS
> is empty.
> 
> Signed-off-by: Mike Crowe <mac at mcrowe.com>
> ---
>  meta/lib/oe/image.py | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
> index 8c797ec..ceaade7 100644
> --- a/meta/lib/oe/image.py
> +++ b/meta/lib/oe/image.py
> @@ -336,6 +336,10 @@ class Image(ImageDepGraph):
>          Write environment variables used by wic
>          to tmp/sysroots/<machine>/imgdata/<image>.env
>          """
> +        wicvars = self.d.getVar('WICVARS', True)
> +        if not wicvars:
> +            return
> +
>          stdir = self.d.getVar('STAGING_DIR_TARGET', True)
>          outdir = os.path.join(stdir, 'imgdata')
>          try:
> @@ -350,7 +354,7 @@ class Image(ImageDepGraph):
>                  raise
>          basename = self.d.getVar('IMAGE_BASENAME', True)
>          with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
> -            for var in self.d.getVar('WICVARS', True).split():
> +            for var in wicvars.split():
>                  value = self.d.getVar(var, True)
>                  if value:
>                      envf.write('%s="%s"\n' % (var, value.strip()))
> -- 
> 2.1.4
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed



More information about the Openembedded-core mailing list