Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 2/2] image.py: Avoid creating empty .env file in _write_wic_env
@ 2015-11-19 11:21 Mike Crowe
  2015-11-23 17:28 ` Ed Bartosh
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Crowe @ 2015-11-19 11:21 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Crowe

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@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] image.py: Avoid creating empty .env file in _write_wic_env
  2015-11-19 11:21 [PATCH 2/2] image.py: Avoid creating empty .env file in _write_wic_env Mike Crowe
@ 2015-11-23 17:28 ` Ed Bartosh
  0 siblings, 0 replies; 2+ messages in thread
From: Ed Bartosh @ 2015-11-23 17:28 UTC (permalink / raw)
  To: Mike Crowe; +Cc: openembedded-core

Looks good to me.

Acked-by: Ed Bartosh <ed.bartosh@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@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@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-23 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 11:21 [PATCH 2/2] image.py: Avoid creating empty .env file in _write_wic_env Mike Crowe
2015-11-23 17:28 ` Ed Bartosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox