[oe-commits] Ed Bartosh : image.py: write bitbake variables to .env file
git at git.openembedded.org
git at git.openembedded.org
Mon Aug 31 11:44:13 UTC 2015
Module: openembedded-core.git
Branch: master-next
Commit: 861ce6c5d4836df1a783be3b01d2de56117c9863
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=861ce6c5d4836df1a783be3b01d2de56117c9863
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date: Mon Aug 31 00:14:23 2015 +0300
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'.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/image_types.bbclass | 4 ++++
meta/lib/oe/image.py | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 05c45f8..ecb066b 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -248,3 +248,7 @@ IMAGE_EXTENSION_live = "hddimg iso"
# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc.
IMAGE_TYPES_MASKED ?= ""
+
+# The WICVARS variable is used to define list of bitbake variables used in wic code
+# variables from this list is written to <image>.env file
+WICVARS ?= "BBLAYERS DEPLOY_DIR_IMAGE HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS"
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index a2f94a1..95c62dc 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -326,6 +326,22 @@ class Image(ImageDepGraph):
return image_cmd_groups
+ def _write_env(self):
+ """
+ Write environment variables used by wic
+ to tmp/sysroots/<machine>/imgdata/<image>.env
+ """
+ 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():
+ value = self.d.getVar(var, True)
+ if value:
+ envf.write('%s="%s"\n' % (var, value.strip()))
+
def create(self):
bb.note("###### Generate images #######")
pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True)
@@ -337,6 +353,8 @@ class Image(ImageDepGraph):
image_cmd_groups = self._get_imagecmds()
+ self._write_env()
+
for image_cmds in image_cmd_groups:
# create the images in parallel
nproc = multiprocessing.cpu_count()
More information about the Openembedded-commits
mailing list