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

Mike Crowe mac at mcrowe.com
Thu Nov 19 11:21:16 UTC 2015


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




More information about the Openembedded-core mailing list