diff options
author | Mike Crowe <mac@mcrowe.com> | 2015-11-19 11:21:16 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-01 21:32:02 +0000 |
commit | b00f73429a025da09fba3285a7006db83e74c727 (patch) | |
tree | 8f4c0357e1b4a88ffa31d0ec2d7bf444bc4145a8 /meta/lib/oe | |
parent | a88505b450bcd9a45e47ffa4655857cd29cb2416 (diff) | |
download | poky-b00f73429a025da09fba3285a7006db83e74c727.tar.gz |
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>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/image.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py index 9580562580..f0843de928 100644 --- a/meta/lib/oe/image.py +++ b/meta/lib/oe/image.py | |||
@@ -335,13 +335,17 @@ class Image(ImageDepGraph): | |||
335 | Write environment variables used by wic | 335 | Write environment variables used by wic |
336 | to tmp/sysroots/<machine>/imgdata/<image>.env | 336 | to tmp/sysroots/<machine>/imgdata/<image>.env |
337 | """ | 337 | """ |
338 | wicvars = self.d.getVar('WICVARS', True) | ||
339 | if not wicvars: | ||
340 | return | ||
341 | |||
338 | stdir = self.d.getVar('STAGING_DIR_TARGET', True) | 342 | stdir = self.d.getVar('STAGING_DIR_TARGET', True) |
339 | outdir = os.path.join(stdir, 'imgdata') | 343 | outdir = os.path.join(stdir, 'imgdata') |
340 | if not os.path.exists(outdir): | 344 | if not os.path.exists(outdir): |
341 | os.makedirs(outdir) | 345 | os.makedirs(outdir) |
342 | basename = self.d.getVar('IMAGE_BASENAME', True) | 346 | basename = self.d.getVar('IMAGE_BASENAME', True) |
343 | with open(os.path.join(outdir, basename) + '.env', 'w') as envf: | 347 | with open(os.path.join(outdir, basename) + '.env', 'w') as envf: |
344 | for var in self.d.getVar('WICVARS', True).split(): | 348 | for var in wicvars.split(): |
345 | value = self.d.getVar(var, True) | 349 | value = self.d.getVar(var, True) |
346 | if value: | 350 | if value: |
347 | envf.write('%s="%s"\n' % (var, value.strip())) | 351 | envf.write('%s="%s"\n' % (var, value.strip())) |