diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-16 10:32:44 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-19 17:24:46 +0000 |
commit | fb1654fee44fec04b0f833d375bfdd0f0ed12414 (patch) | |
tree | 2ae7776b914e0d864f91ab4860ea6215062eb7d6 | |
parent | 1da8f52b67ac6ce5819e30530385e5628f11b85f (diff) | |
download | poky-fb1654fee44fec04b0f833d375bfdd0f0ed12414.tar.gz |
image: Fix wic environment issues
The wic environment function needs to run after the rootfs size is
setup. We move this code to a specific task, and depend on that task
from the wic images and other places its needed.
This fixes:
======================================================================
FAIL: test_image_env (oeqa.selftest.wic.Wic)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/utils/decorators.py", line 106, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/wic.py", line 218, in test_image_env
self.assertTrue(var in content, "%s is not in .env file" % var)
AssertionError: False is not true : ROOTFS_SIZE is not in .env file
(From OE-Core rev: 606f9e2d7d8d389c8d4f5c3090139d3bb780e09c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta-selftest/recipes-test/images/wic-image-minimal.bb | 2 | ||||
-rw-r--r-- | meta/classes/image.bbclass | 8 | ||||
-rw-r--r-- | meta/classes/image_types.bbclass | 1 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/wic.py | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/meta-selftest/recipes-test/images/wic-image-minimal.bb b/meta-selftest/recipes-test/images/wic-image-minimal.bb index 89451bd200..95c7a9b89a 100644 --- a/meta-selftest/recipes-test/images/wic-image-minimal.bb +++ b/meta-selftest/recipes-test/images/wic-image-minimal.bb | |||
@@ -11,7 +11,7 @@ DEPENDS = "syslinux syslinux-native parted-native dosfstools-native mtools-nativ | |||
11 | 11 | ||
12 | # core-image-minimal is referenced in .wks, so we need its rootfs | 12 | # core-image-minimal is referenced in .wks, so we need its rootfs |
13 | # to be ready before our rootfs | 13 | # to be ready before our rootfs |
14 | do_rootfs[depends] += "core-image-minimal:do_rootfs" | 14 | do_rootfs[depends] += "core-image-minimal:do_rootfs_wicenv" |
15 | 15 | ||
16 | IMAGE_ROOTFS_EXTRA_SPACE = "2000" | 16 | IMAGE_ROOTFS_EXTRA_SPACE = "2000" |
17 | 17 | ||
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index cc8a23c526..13b77c9638 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -242,8 +242,6 @@ fakeroot python do_image () { | |||
242 | pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND", True) | 242 | pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND", True) |
243 | 243 | ||
244 | execute_pre_post_process(d, pre_process_cmds) | 244 | execute_pre_post_process(d, pre_process_cmds) |
245 | |||
246 | write_wic_env(d) | ||
247 | } | 245 | } |
248 | do_image[dirs] = "${TOPDIR}" | 246 | do_image[dirs] = "${TOPDIR}" |
249 | do_image[umask] = "022" | 247 | do_image[umask] = "022" |
@@ -264,7 +262,7 @@ addtask do_image_complete after do_image before do_build | |||
264 | # Write environment variables used by wic | 262 | # Write environment variables used by wic |
265 | # to tmp/sysroots/<machine>/imgdata/<image>.env | 263 | # to tmp/sysroots/<machine>/imgdata/<image>.env |
266 | # | 264 | # |
267 | def write_wic_env(d): | 265 | python do_rootfs_wicenv () { |
268 | wicvars = d.getVar('WICVARS', True) | 266 | wicvars = d.getVar('WICVARS', True) |
269 | if not wicvars: | 267 | if not wicvars: |
270 | return | 268 | return |
@@ -278,6 +276,10 @@ def write_wic_env(d): | |||
278 | value = d.getVar(var, True) | 276 | value = d.getVar(var, True) |
279 | if value: | 277 | if value: |
280 | envf.write('%s="%s"\n' % (var, value.strip())) | 278 | envf.write('%s="%s"\n' % (var, value.strip())) |
279 | } | ||
280 | addtask do_rootfs_wicenv after do_rootfs before do_image_wic | ||
281 | do_rootfs_wicenv[vardeps] += "${WICVARS}" | ||
282 | do_rootfs_wicenv[prefuncs] = 'set_image_size' | ||
281 | 283 | ||
282 | def setup_debugfs_variables(d): | 284 | def setup_debugfs_variables(d): |
283 | d.appendVar('IMAGE_ROOTFS', '-dbg') | 285 | d.appendVar('IMAGE_ROOTFS', '-dbg') |
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 0bf48c0202..b9599d8bed 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -201,7 +201,6 @@ IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES" | |||
201 | # Rebuild when the wks file or vars in WICVARS change | 201 | # Rebuild when the wks file or vars in WICVARS change |
202 | USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${COMPRESSIONTYPES}'.split()), '1', '', d)}" | 202 | USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${COMPRESSIONTYPES}'.split()), '1', '', d)}" |
203 | do_image_wic[file-checksums] += "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}" | 203 | do_image_wic[file-checksums] += "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}" |
204 | do_image_wic[vardeps] += "${@bb.utils.contains("USING_WIC", "1", "${WICVARS}", "", d)}" | ||
205 | 204 | ||
206 | EXTRA_IMAGECMD = "" | 205 | EXTRA_IMAGECMD = "" |
207 | 206 | ||
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 55f6f82ab9..df826ed84b 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py | |||
@@ -50,7 +50,7 @@ class Wic(oeSelfTest): | |||
50 | if not Wic.image_is_ready: | 50 | if not Wic.image_is_ready: |
51 | bitbake('syslinux syslinux-native parted-native gptfdisk-native ' | 51 | bitbake('syslinux syslinux-native parted-native gptfdisk-native ' |
52 | 'dosfstools-native mtools-native') | 52 | 'dosfstools-native mtools-native') |
53 | bitbake('core-image-minimal') | 53 | bitbake('core-image-minimal:do_image_complete core-image-minimal:do_rootfs_wicenv') |
54 | Wic.image_is_ready = True | 54 | Wic.image_is_ready = True |
55 | 55 | ||
56 | rmtree(self.resultdir, ignore_errors=True) | 56 | rmtree(self.resultdir, ignore_errors=True) |