From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: steve@sakoman.com, openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][scarthgap 17/18] image_qa: fix error handling
Date: Tue, 15 Oct 2024 23:41:50 +0100 [thread overview]
Message-ID: <a8af25be04be39c3f91344858ed95a6ebc936f48.camel@linuxfoundation.org> (raw)
In-Reply-To: <8fe7aef17eefa70e3f7c07077b8c695e5c00ed5e.1729018153.git.steve@sakoman.com>
On Tue, 2024-10-15 at 11:50 -0700, Steve Sakoman via lists.openembedded.org wrote:
> From: Louis Rannou <louis.rannou@non.se.com>
>
> Make ImageQAFailed inherit BBHandledException so exceptions raised in tests are
> catched when the actual test function is executed by bb.utils.better_exec.
>
> Change the do_image_qa tasks so errors are handled with oe.qa.handle_error. Add
> some comment to explain this requires to list the test in ERROR_QA or WARN_QA.
>
> [YOCTO #14807]
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=14807
>
> Signed-off-by: Louis Rannou <louis.rannou@non.se.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit 905e224849fbbed1719e0add231b00e2d570b3b4)
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
> meta/classes-recipe/image.bbclass | 11 ++++++-----
> meta/lib/oe/utils.py | 2 +-
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
> index 28be6c6362..a682b5f3b2 100644
> --- a/meta/classes-recipe/image.bbclass
> +++ b/meta/classes-recipe/image.bbclass
> @@ -308,23 +308,24 @@ addtask do_image_complete_setscene
> #
> # The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs
> # directory, which if QA passes will be the basis for the images.
> +#
> +# The functions should use oe.utils.ImageQAFailed(description, name) to raise
> +# errors. The name must be listed in ERROR_QA or WARN_QA to prompt.
> fakeroot python do_image_qa () {
> from oe.utils import ImageQAFailed
>
> qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
> - qamsg = ""
>
> for cmd in qa_cmds:
> try:
> bb.build.exec_func(cmd, d)
> except oe.utils.ImageQAFailed as e:
> - qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
> + qamsg = 'Image QA function %s failed: %s\n' % (e.name, e.description)
> + oe.qa.handle_error(e.name, qamsg, d)
> except Exception as e:
> qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (cmd, e)
>
> - if qamsg:
> - imgname = d.getVar('IMAGE_NAME')
> - bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
> + oe.qa.exit_if_errors(d)
> }
> addtask do_image_qa after do_rootfs before do_image
>
> diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
> index 14a7d07ef0..83f1440887 100644
> --- a/meta/lib/oe/utils.py
> +++ b/meta/lib/oe/utils.py
> @@ -482,7 +482,7 @@ def get_multilib_datastore(variant, d):
> localdata.setVar("MLPREFIX", "")
> return localdata
>
> -class ImageQAFailed(Exception):
> +class ImageQAFailed(bb.BBHandledException):
> def __init__(self, description, name=None, logfile=None):
> self.description = description
> self.name = name
>
This caused further issues if I remember correctly.
https://git.yoctoproject.org/poky/commit/?id=b0eb2b9b3660dfda1c4c43cfcca6a2c4a84d6dc8
for example.
Cheers,
Richard
next prev parent reply other threads:[~2024-10-15 22:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 18:50 [OE-core][scarthgap 00/18] Patch review Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 01/18] rust: ignore CVE-2024-43402 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 02/18] cups: Backport fix for CVE-2024-47175 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 03/18] libarchive: fix CVE-2024-48957 & CVE-2024-48958 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 04/18] linux-firmware: upgrade 20240312 -> 20240909 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 05/18] ruby: upgrade 3.2.2 -> 3.3.5 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 06/18] ptest-runner: Update 2.4.4 -> 2.4.5 Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 07/18] sysvinit: take release tarballs from github Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 08/18] libpcre2: Update base uri PhilipHazel -> PCRE2Project Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 09/18] license: Fix directory layout issues Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 10/18] virglrenderer: Add patch to fix -int-conversion build issue Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 11/18] lib/oe/package-manager: skip processing installed-pkgs with empty globs Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 12/18] makedevs: Fix matching uid/gid Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 13/18] runqemu: Fix detection of -serial parameter Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 14/18] uboot-sign: fix counters in do_uboot_assemble_fitimage Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 15/18] recipes-bsp: usbutils: Fix usb-devices command using busybox Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 16/18] libsdl2: Fix non-deterministic configure option for libsamplerate Steve Sakoman
2024-10-15 18:50 ` [OE-core][scarthgap 17/18] image_qa: fix error handling Steve Sakoman
2024-10-15 22:41 ` Richard Purdie [this message]
2024-10-16 13:26 ` Steve Sakoman
2024-10-18 19:56 ` Peter Kjellerstedt
2024-10-18 20:19 ` Steve Sakoman
2024-10-18 21:56 ` Peter Kjellerstedt
2024-10-15 18:50 ` [OE-core][scarthgap 18/18] meta-ide-support: Mark recipe as MACHINE-specific Steve Sakoman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a8af25be04be39c3f91344858ed95a6ebc936f48.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
--cc=steve@sakoman.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox