diff options
author | 2016-07-26 22:30:16 +0100 | |
---|---|---|
committer | 2016-07-26 22:30:16 +0100 | |
commit | b1ed8bf09ea74860cbce457f5d5e33532eda255c (patch) | |
tree | 34405dcac66e4b9e7ad8d81fa8f566c22d19b7e2 | |
parent | d1b542a06cdf925ea0ee84e3c32595814fbb8e59 (diff) | |
download | meta-swupd-b1ed8bf09ea74860cbce457f5d5e33532eda255c.tar.gz meta-swupd-b1ed8bf09ea74860cbce457f5d5e33532eda255c.tar.bz2 meta-swupd-b1ed8bf09ea74860cbce457f5d5e33532eda255c.zip |
swupd-image: switch to OE-Core's image QA mechanism
Drop and the swupd_sanity_check_image task and related
SWUPD_IMAGE_SANITY_CHECKS variable in favour of the recently added
OE-Core image QA mechanism.
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
-rw-r--r-- | classes/swupd-image.bbclass | 39 | ||||
-rw-r--r-- | docs/Guide.md | 4 |
2 files changed, 9 insertions, 34 deletions
diff --git a/classes/swupd-image.bbclass b/classes/swupd-image.bbclass index 76c043c..08ab3f5 100644 --- a/classes/swupd-image.bbclass +++ b/classes/swupd-image.bbclass @@ -518,41 +518,14 @@ swupd_patch_os_release () { swupd_patch_os_release[vardepsexclude] = "OS_VERSION" ROOTFS_POSTPROCESS_COMMAND += "swupd_patch_os_release; " -SWUPD_IMAGE_SANITY_CHECKS ??= "" -# Add image-level QA/sanity checks to SWUPD_IMAGE_SANITY_CHECKS -# -# SWUPD_IMAGE_SANITY_CHECKS += " \ -# swupd_check_dangling_symlinks \ -# " - -# This task runs all functions in SWUPD_IMAGE_SANITY_CHECKS after the image -# construction has completed in order to validate the resulting image. -# Image sanity checks should raise a NotImplementedError when they fail, -# passing any failure messages to the Exception. For example: -# -# python swupd_image_check_always_fails () { -# raise NotImplementedError('This check always fails') -# } -python do_swupd_sanity_check_image () { - funcs = (d.getVar('SWUPD_IMAGE_SANITY_CHECKS', True) or '').split() - qasane = True - - for func in funcs: - try: - bb.build.exec_func(func, d, pythonexception=True) - except NotImplementedError as e: - qasane = False - bb.error(str(e)) - - if not qasane: - bb.fatal('QA errors found whilst checking swupd image sanity.') -} -addtask swupd_sanity_check_image after do_image_complete before do_build - # Check whether the constructed image contains any dangling symlinks, these # are likely to indicate deeper issues. # NOTE: you'll almost certainly want to override these for your distro. # /run, /var/volatile and /dev only get mounted at runtime. +# Enable this check by adding it to IMAGE_QA_COMMANDS +# IMAGE_QA_COMMANDS += " \ +# swupd_check_dangling_symlinks \ +# " SWUPD_IMAGE_SYMLINK_WHITELIST ??= " \ /run/lock \ /var/volatile/tmp \ @@ -563,6 +536,8 @@ SWUPD_IMAGE_SYMLINK_WHITELIST ??= " \ " python swupd_check_dangling_symlinks() { + from oe.utils import ImageQAFailed + rootfs = d.getVar("IMAGE_ROOTFS", True) def resolve_links(target, root): @@ -600,5 +575,5 @@ python swupd_check_dangling_symlinks() { message = message + '\nIf these symlinks not pointing to a valid destination is not an issue \ i.e. the link is to a file which only exists at runtime, such as files in /proc, add them to \ SWUPD_IMAGE_SYMLINK_WHITELIST to resolve this error.' - raise NotImplementedError(message) + raise ImageQAFailed(message, swupd_check_dangling_symlinks) } diff --git a/docs/Guide.md b/docs/Guide.md index 6e74a0c..cfd13a1 100644 --- a/docs/Guide.md +++ b/docs/Guide.md @@ -127,9 +127,9 @@ included in the os-core bundle. To help detect the dangling symlink scenario the `swupd-image` class includes a mechanism to check for such dangling symlinks in a constructed image, enable it by adding the `swupd_check_dangling_symlinks` sanity check to -`SWUPD_IMAGE_SANITY_CHECKS` i.e.: +`IMAGE_QA_COMMANDS` i.e.: ``` -SWUPD_IMAGE_SANITY_CHECKS += " \ +IMAGE_QA_COMMANDS += " \ swupd_check_dangling_symlinks \ " ``` |