image.py: Avoid creating empty .env file in _write_wic_env
PATCH 2/2 image.py: Avoid creating empty .env file in _write_wic_env
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 <[email protected]>
--- meta/lib/oe/image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/lib/oe/image.py +5 -1
@@ -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()))
Signature · 1 line
2.1.4
Looks good to me.
Acked-by Ed Bartosh <[email protected]>
Quoted 41 lines · 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 <[email protected]>--- meta/lib/oe/image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)meta/lib/oe/image.py +5
-1@@ -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()))Signature · 7 lines
2.1.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 3 lines
-- Regards, Ed