diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-08-31 00:14:23 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-30 23:26:24 +0100 |
| commit | 7770281354d0d21d14961b0b5ddb945afabadf3c (patch) | |
| tree | 0d999f8c7d41238cbf3a0df036066892d44b7066 /meta/lib | |
| parent | 8a5eb20a43d1465f401f7b739cc16c7b2e93a8af (diff) | |
| download | poky-7770281354d0d21d14961b0b5ddb945afabadf3c.tar.gz | |
image.py: write bitbake variables to .env file
Write set of bitbake variables used by wic into
build/tmp/sysroots/<machine>/imagedata/<image>.env
List of variables is defined in WICVARS variable in
meta/classes/image_types.bbclass.
This is needed for wic to be able to get bitbake variables without
running 'bitbake -e'.
(From OE-Core rev: 861ce6c5d4836df1a783be3b01d2de56117c9863)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/image.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py index a2f94a1cd4..95c62dca44 100644 --- a/meta/lib/oe/image.py +++ b/meta/lib/oe/image.py | |||
| @@ -326,6 +326,22 @@ class Image(ImageDepGraph): | |||
| 326 | 326 | ||
| 327 | return image_cmd_groups | 327 | return image_cmd_groups |
| 328 | 328 | ||
| 329 | def _write_env(self): | ||
| 330 | """ | ||
| 331 | Write environment variables used by wic | ||
| 332 | to tmp/sysroots/<machine>/imgdata/<image>.env | ||
| 333 | """ | ||
| 334 | stdir = self.d.getVar('STAGING_DIR_TARGET', True) | ||
| 335 | outdir = os.path.join(stdir, 'imgdata') | ||
| 336 | if not os.path.exists(outdir): | ||
| 337 | os.makedirs(outdir) | ||
| 338 | basename = self.d.getVar('IMAGE_BASENAME', True) | ||
| 339 | with open(os.path.join(outdir, basename) + '.env', 'w') as envf: | ||
| 340 | for var in self.d.getVar('WICVARS', True).split(): | ||
| 341 | value = self.d.getVar(var, True) | ||
| 342 | if value: | ||
| 343 | envf.write('%s="%s"\n' % (var, value.strip())) | ||
| 344 | |||
| 329 | def create(self): | 345 | def create(self): |
| 330 | bb.note("###### Generate images #######") | 346 | bb.note("###### Generate images #######") |
| 331 | pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True) | 347 | pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True) |
| @@ -337,6 +353,8 @@ class Image(ImageDepGraph): | |||
| 337 | 353 | ||
| 338 | image_cmd_groups = self._get_imagecmds() | 354 | image_cmd_groups = self._get_imagecmds() |
| 339 | 355 | ||
| 356 | self._write_env() | ||
| 357 | |||
| 340 | for image_cmds in image_cmd_groups: | 358 | for image_cmds in image_cmd_groups: |
| 341 | # create the images in parallel | 359 | # create the images in parallel |
| 342 | nproc = multiprocessing.cpu_count() | 360 | nproc = multiprocessing.cpu_count() |
