mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
lib/oe/qa,insane: Move extra error handling functions to library
Extract package_qa_write_error, package_qa_handle_error and package_qa_add_message functions from insane.bbclass to lib/oe/qa.py and drop the package_qa_ prefixes. Update various bbclasses to use the new functions. No import is required since base.bbclass puts oe.qa in OE_IMPORTS. Stop requiring callers to manually track whether a fatal error has been encountered via a "sane" flag. Instead replace the QA_SANE variable with QA_ERRORS_FOUND and call oe.qa.exit_if_errors or oe.qa.exit_with_message_if_errors at the end of each task. Inspired by discussion resulting from https://lists.openembedded.org/g/openembedded-core/message/156793 and https://lists.openembedded.org/g/openembedded-core/message/156900 (From OE-Core rev: f0ad152ef4cc15c042bc9eeefb6af096d054b220) Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
25675706b6
commit
51b1611e20
@@ -41,8 +41,6 @@
|
||||
inherit packagedata
|
||||
inherit chrpath
|
||||
inherit package_pkgdata
|
||||
|
||||
# Need the package_qa_handle_error() in insane.bbclass
|
||||
inherit insane
|
||||
|
||||
PKGD = "${WORKDIR}/package"
|
||||
@@ -865,7 +863,7 @@ python fixup_perms () {
|
||||
self._setdir(lsplit[0], lsplit[1], lsplit[2], lsplit[3], lsplit[4], lsplit[5], lsplit[6], lsplit[7])
|
||||
else:
|
||||
msg = "Fixup Perms: invalid config line %s" % line
|
||||
package_qa_handle_error("perm-config", msg, d)
|
||||
oe.qa.handle_error("perm-config", msg, d)
|
||||
self.path = None
|
||||
self.link = None
|
||||
|
||||
@@ -1005,7 +1003,7 @@ python fixup_perms () {
|
||||
continue
|
||||
if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"):
|
||||
msg = "Fixup perms: %s invalid line: %s" % (conf, line)
|
||||
package_qa_handle_error("perm-line", msg, d)
|
||||
oe.qa.handle_error("perm-line", msg, d)
|
||||
continue
|
||||
entry = fs_perms_entry(d.expand(line))
|
||||
if entry and entry.path:
|
||||
@@ -1042,7 +1040,7 @@ python fixup_perms () {
|
||||
ptarget = os.path.join(os.path.dirname(dir), link)
|
||||
if os.path.exists(target):
|
||||
msg = "Fixup Perms: Unable to correct directory link, target already exists: %s -> %s" % (dir, ptarget)
|
||||
package_qa_handle_error("perm-link", msg, d)
|
||||
oe.qa.handle_error("perm-link", msg, d)
|
||||
continue
|
||||
|
||||
# Create path to move directory to, move it, and then setup the symlink
|
||||
@@ -1202,7 +1200,7 @@ python split_and_strip_files () {
|
||||
bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn))
|
||||
else:
|
||||
msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn)
|
||||
package_qa_handle_error("already-stripped", msg, d)
|
||||
oe.qa.handle_error("already-stripped", msg, d)
|
||||
continue
|
||||
|
||||
# At this point we have an unstripped elf file. We need to:
|
||||
@@ -1362,7 +1360,7 @@ python populate_packages () {
|
||||
for i, pkg in enumerate(packages):
|
||||
if pkg in package_dict:
|
||||
msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg
|
||||
package_qa_handle_error("packages-list", msg, d)
|
||||
oe.qa.handle_error("packages-list", msg, d)
|
||||
# Ensure the source package gets the chance to pick up the source files
|
||||
# before the debug package by ordering it first in PACKAGES. Whether it
|
||||
# actually picks up any source files is controlled by
|
||||
@@ -1399,7 +1397,7 @@ python populate_packages () {
|
||||
filesvar = d.getVar('FILES:%s' % pkg) or ""
|
||||
if "//" in filesvar:
|
||||
msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg
|
||||
package_qa_handle_error("files-invalid", msg, d)
|
||||
oe.qa.handle_error("files-invalid", msg, d)
|
||||
filesvar.replace("//", "/")
|
||||
|
||||
origfiles = filesvar.split()
|
||||
@@ -1468,7 +1466,7 @@ python populate_packages () {
|
||||
licenses = d.getVar('LICENSE_EXCLUSION-' + pkg)
|
||||
if licenses:
|
||||
msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses)
|
||||
package_qa_handle_error("incompatible-license", msg, d)
|
||||
oe.qa.handle_error("incompatible-license", msg, d)
|
||||
else:
|
||||
package_list.append(pkg)
|
||||
d.setVar('PACKAGES', ' '.join(package_list))
|
||||
@@ -1492,7 +1490,7 @@ python populate_packages () {
|
||||
msg = msg + "\n " + f
|
||||
msg = msg + "\nPlease set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.\n"
|
||||
msg = msg + "%s: %d installed and not shipped files." % (pn, len(unshipped))
|
||||
package_qa_handle_error("installed-vs-shipped", msg, d)
|
||||
oe.qa.handle_error("installed-vs-shipped", msg, d)
|
||||
}
|
||||
populate_packages[dirs] = "${D}"
|
||||
|
||||
@@ -1838,7 +1836,7 @@ python package_do_shlibs() {
|
||||
ver = d.getVar('PKGV')
|
||||
if not ver:
|
||||
msg = "PKGV not defined"
|
||||
package_qa_handle_error("pkgv-undefined", msg, d)
|
||||
oe.qa.handle_error("pkgv-undefined", msg, d)
|
||||
return
|
||||
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
@@ -2402,7 +2400,7 @@ python do_package () {
|
||||
|
||||
if not workdir or not outdir or not dest or not dvar or not pn:
|
||||
msg = "WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package"
|
||||
package_qa_handle_error("var-undefined", msg, d)
|
||||
oe.qa.handle_error("var-undefined", msg, d)
|
||||
return
|
||||
|
||||
bb.build.exec_func("package_convert_pr_autoinc", d)
|
||||
@@ -2455,9 +2453,7 @@ python do_package () {
|
||||
for f in (d.getVar('PACKAGEFUNCS') or '').split():
|
||||
bb.build.exec_func(f, d)
|
||||
|
||||
qa_sane = d.getVar("QA_SANE")
|
||||
if not qa_sane:
|
||||
bb.fatal("Fatal QA errors found, failing task.")
|
||||
oe.qa.exit_if_errors(d)
|
||||
}
|
||||
|
||||
do_package[dirs] = "${SHLIBSWORKDIR} ${PKGDESTWORK} ${D}"
|
||||
|
||||
Reference in New Issue
Block a user