diff options
| author | Peter Kjellerstedt <pkj@axis.com> | 2024-09-26 14:25:06 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-10-29 05:51:03 -0700 |
| commit | 0c02f87d310895c79b5042efe5ade100581abb41 (patch) | |
| tree | 0c3be35ab2a58b5b2db1ef8dda8d34cab692a102 | |
| parent | 9daf5c5cf5abd92ece862682798c55e244e6c0be (diff) | |
| download | poky-0c02f87d310895c79b5042efe5ade100581abb41.tar.gz | |
image.bbclass: Drop support for ImageQAFailed exceptions in image_qa
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 ]
(From OE-Core rev: c00ad42b6a26ceb7a2878ed2c7f6c2821fe513cc)
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>
| -rw-r--r-- | meta/classes-recipe/image.bbclass | 15 | ||||
| -rw-r--r-- | meta/lib/oe/utils.py | 13 |
2 files changed, 4 insertions, 24 deletions
diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass index 834ae03f3c..00f1d58f23 100644 --- a/meta/classes-recipe/image.bbclass +++ b/meta/classes-recipe/image.bbclass | |||
| @@ -324,27 +324,20 @@ addtask do_image_complete_setscene | |||
| 324 | # IMAGE_QA_COMMANDS += " \ | 324 | # IMAGE_QA_COMMANDS += " \ |
| 325 | # image_check_everything_ok \ | 325 | # image_check_everything_ok \ |
| 326 | # " | 326 | # " |
| 327 | # | ||
| 327 | # This task runs all functions in IMAGE_QA_COMMANDS after the rootfs | 328 | # This task runs all functions in IMAGE_QA_COMMANDS after the rootfs |
| 328 | # construction has completed in order to validate the resulting image. | 329 | # construction has completed in order to validate the resulting image. |
| 329 | # | 330 | # |
| 330 | # The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs | 331 | # The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs |
| 331 | # directory, which if QA passes will be the basis for the images. | 332 | # directory, which if QA passes will be the basis for the images. |
| 332 | # | 333 | # |
| 333 | # The functions should use oe.utils.ImageQAFailed(description, name) to raise | 334 | # The functions are expected to call oe.qa.handle_error() to report any |
| 334 | # errors. The name must be listed in ERROR_QA or WARN_QA to prompt. | 335 | # problems. |
| 335 | fakeroot python do_image_qa () { | 336 | fakeroot python do_image_qa () { |
| 336 | from oe.utils import ImageQAFailed | ||
| 337 | |||
| 338 | qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split() | 337 | qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split() |
| 339 | 338 | ||
| 340 | for cmd in qa_cmds: | 339 | for cmd in qa_cmds: |
| 341 | try: | 340 | bb.build.exec_func(cmd, d) |
| 342 | bb.build.exec_func(cmd, d) | ||
| 343 | except oe.utils.ImageQAFailed as e: | ||
| 344 | qamsg = 'Image QA function %s failed: %s\n' % (e.name, e.description) | ||
| 345 | oe.qa.handle_error(e.name, qamsg, d) | ||
| 346 | except Exception as e: | ||
| 347 | qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (cmd, e) | ||
| 348 | 341 | ||
| 349 | oe.qa.exit_if_errors(d) | 342 | oe.qa.exit_if_errors(d) |
| 350 | } | 343 | } |
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 83f1440887..c9c7a47041 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
| @@ -482,19 +482,6 @@ def get_multilib_datastore(variant, d): | |||
| 482 | localdata.setVar("MLPREFIX", "") | 482 | localdata.setVar("MLPREFIX", "") |
| 483 | return localdata | 483 | return localdata |
| 484 | 484 | ||
| 485 | class ImageQAFailed(bb.BBHandledException): | ||
| 486 | def __init__(self, description, name=None, logfile=None): | ||
| 487 | self.description = description | ||
| 488 | self.name = name | ||
| 489 | self.logfile=logfile | ||
| 490 | |||
| 491 | def __str__(self): | ||
| 492 | msg = 'Function failed: %s' % self.name | ||
| 493 | if self.description: | ||
| 494 | msg = msg + ' (%s)' % self.description | ||
| 495 | |||
| 496 | return msg | ||
| 497 | |||
| 498 | def sh_quote(string): | 485 | def sh_quote(string): |
| 499 | import shlex | 486 | import shlex |
| 500 | return shlex.quote(string) | 487 | return shlex.quote(string) |
