mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 06:32:11 +02:00
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. (From OE-Core rev: d40779a7d3ce4f326c29ec7971731cab1f505a37) Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
a88505b450
commit
b00f73429a
@@ -335,13 +335,17 @@ 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')
|
||||
if not os.path.exists(outdir):
|
||||
os.makedirs(outdir)
|
||||
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()))
|
||||
|
||||
Reference in New Issue
Block a user