]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
image.bbclass: Drop support for ImageQAFailed exceptions in image_qa
authorPeter Kjellerstedt <pkj@axis.com>
Thu, 26 Sep 2024 12:25:06 +0000 (14:25 +0200)
committerSteve Sakoman <steve@sakoman.com>
Wed, 23 Oct 2024 02:02:14 +0000 (19:02 -0700)
After commit 905e224849fbbed1719e0add231b00e2d570b3b4 (image_qa: fix
error handling), any unexpected exceptions in do_image_qa() would result
in a variable being set, but never used, effectively hiding the error.

Since image_qa now calls oe.qa.exit_if_errors(), remove the support for
oe.utils.ImageQAFailed and instead rely on the called functions to call
oe.qa.handle_error() themselves. This matches what do_package_qa() does.

Also update the description of do_image_qa() to explain that the called
functions are expected to call oe.qa.handle_error() themselves.

[ YOCTO #15601 ]

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0c3e111c965af2bc56533633c376b70b7fa5e1de)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/classes-recipe/image.bbclass
meta/lib/oe/utils.py

index 834ae03f3cdc9713c5c226dc8a4fd2ff60c1bd9d..00f1d58f23777d40da47d4932140be4779a62ec1 100644 (file)
@@ -324,27 +324,20 @@ addtask do_image_complete_setscene
 # IMAGE_QA_COMMANDS += " \
 #     image_check_everything_ok \
 # "
+#
 # This task runs all functions in IMAGE_QA_COMMANDS after the rootfs
 # construction has completed in order to validate the resulting image.
 #
 # 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.
+# The functions are expected to call oe.qa.handle_error() to report any
+# problems.
 fakeroot python do_image_qa () {
-    from oe.utils import ImageQAFailed
-
     qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
 
     for cmd in qa_cmds:
-        try:
-            bb.build.exec_func(cmd, d)
-        except oe.utils.ImageQAFailed as e:
-            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)
+        bb.build.exec_func(cmd, d)
 
     oe.qa.exit_if_errors(d)
 }
index 83f144088757d87d235c6a9673285e949592f1e5..c9c7a470416fa4c0641274ea74f0fab88497db38 100644 (file)
@@ -482,19 +482,6 @@ def get_multilib_datastore(variant, d):
         localdata.setVar("MLPREFIX", "")
     return localdata
 
-class ImageQAFailed(bb.BBHandledException):
-    def __init__(self, description, name=None, logfile=None):
-        self.description = description
-        self.name = name
-        self.logfile=logfile
-
-    def __str__(self):
-        msg = 'Function failed: %s' % self.name
-        if self.description:
-            msg = msg + ' (%s)' % self.description
-
-        return msg
-
 def sh_quote(string):
     import shlex
     return shlex.quote(string)