diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-18 13:08:58 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-21 07:46:38 +0000 |
| commit | 3c3fd6a65e8103f74ae382d196d486b31a168b39 (patch) | |
| tree | b7f26a66766cdb137b924d0facd73a88051c3538 | |
| parent | f962c586fcdc3a4283f87b13c207053736fbce4c (diff) | |
| download | poky-3c3fd6a65e8103f74ae382d196d486b31a168b39.tar.gz | |
insane: Improve patch warning/error handling
Currently, whilst patch errors or warnings are shown, the errors don't stop builds.
The configuration isn't very configurable from WARN_QA and ERROR_QA either.
This patch:
* Uses the standard mechanisms to handle the patch fuzz warnings/errors
* Makes Upstream-Status checking configurable from WARN/ERROR_QA
* Allows that checking to be used with non-core layers
* Makes patch-fuzz an error by default
(From OE-Core rev: 76a685bfcf927593eac67157762a53259089ea8a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes-global/insane.bbclass | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index ada8a7ef4e..c48a2e39f9 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | WARN_QA ?= " libdir xorg-driver-abi buildpaths \ | 29 | WARN_QA ?= " libdir xorg-driver-abi buildpaths \ |
| 30 | textrel incompatible-license files-invalid \ | 30 | textrel incompatible-license files-invalid \ |
| 31 | infodir build-deps src-uri-bad symlink-to-sysroot multilib \ | 31 | infodir build-deps src-uri-bad symlink-to-sysroot multilib \ |
| 32 | invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ | 32 | invalid-packageconfig host-user-contaminated uppercase-pn \ |
| 33 | mime mime-xdg unlisted-pkg-lics unhandled-features-check \ | 33 | mime mime-xdg unlisted-pkg-lics unhandled-features-check \ |
| 34 | missing-update-alternatives native-last missing-ptest \ | 34 | missing-update-alternatives native-last missing-ptest \ |
| 35 | license-exists license-no-generic license-syntax license-format \ | 35 | license-exists license-no-generic license-syntax license-format \ |
| @@ -44,6 +44,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | |||
| 44 | already-stripped installed-vs-shipped ldflags compile-host-path \ | 44 | already-stripped installed-vs-shipped ldflags compile-host-path \ |
| 45 | install-host-path pn-overrides unknown-configure-option \ | 45 | install-host-path pn-overrides unknown-configure-option \ |
| 46 | useless-rpaths rpaths staticdev empty-dirs \ | 46 | useless-rpaths rpaths staticdev empty-dirs \ |
| 47 | patch-fuzz patch-status-core\ | ||
| 47 | " | 48 | " |
| 48 | # Add usrmerge QA check based on distro feature | 49 | # Add usrmerge QA check based on distro feature |
| 49 | ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" | 50 | ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" |
| @@ -1334,24 +1335,27 @@ python do_qa_patch() { | |||
| 1334 | msg += " devtool modify %s\n" % d.getVar('PN') | 1335 | msg += " devtool modify %s\n" % d.getVar('PN') |
| 1335 | msg += " devtool finish --force-patch-refresh %s <layer_path>\n\n" % d.getVar('PN') | 1336 | msg += " devtool finish --force-patch-refresh %s <layer_path>\n\n" % d.getVar('PN') |
| 1336 | msg += "Don't forget to review changes done by devtool!\n" | 1337 | msg += "Don't forget to review changes done by devtool!\n" |
| 1337 | if bb.utils.filter('ERROR_QA', 'patch-fuzz', d): | 1338 | msg += "\nPatch log indicates that patches do not apply cleanly." |
| 1338 | bb.error(msg) | ||
| 1339 | elif bb.utils.filter('WARN_QA', 'patch-fuzz', d): | ||
| 1340 | bb.warn(msg) | ||
| 1341 | msg = "Patch log indicates that patches do not apply cleanly." | ||
| 1342 | oe.qa.handle_error("patch-fuzz", msg, d) | 1339 | oe.qa.handle_error("patch-fuzz", msg, d) |
| 1343 | 1340 | ||
| 1344 | # Check if the patch contains a correctly formatted and spelled Upstream-Status | 1341 | # Check if the patch contains a correctly formatted and spelled Upstream-Status |
| 1345 | import re | 1342 | import re |
| 1346 | from oe import patch | 1343 | from oe import patch |
| 1347 | 1344 | ||
| 1345 | allpatches = False | ||
| 1346 | if bb.utils.filter('ERROR_QA', 'patch-status-noncore', d) or bb.utils.filter('WARN_QA', 'patch-status-noncore', d): | ||
| 1347 | allpatches = True | ||
| 1348 | |||
| 1348 | coremeta_path = os.path.join(d.getVar('COREBASE'), 'meta', '') | 1349 | coremeta_path = os.path.join(d.getVar('COREBASE'), 'meta', '') |
| 1349 | for url in patch.src_patches(d): | 1350 | for url in patch.src_patches(d): |
| 1350 | (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url) | 1351 | (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url) |
| 1351 | 1352 | ||
| 1352 | # skip patches not in oe-core | 1353 | # skip patches not in oe-core |
| 1354 | patchtype = "patch-status-core" | ||
| 1353 | if not os.path.abspath(fullpath).startswith(coremeta_path): | 1355 | if not os.path.abspath(fullpath).startswith(coremeta_path): |
| 1354 | continue | 1356 | patchtype = "patch-status-noncore" |
| 1357 | if not allpatches: | ||
| 1358 | continue | ||
| 1355 | 1359 | ||
| 1356 | kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) | 1360 | kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) |
| 1357 | strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE) | 1361 | strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE) |
| @@ -1364,9 +1368,13 @@ python do_qa_patch() { | |||
| 1364 | 1368 | ||
| 1365 | if not match_strict: | 1369 | if not match_strict: |
| 1366 | if match_kinda: | 1370 | if match_kinda: |
| 1367 | bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0))) | 1371 | msg = "Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)) |
| 1372 | oe.qa.handle_error(patchtype, msg, d) | ||
| 1368 | else: | 1373 | else: |
| 1369 | bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines)) | 1374 | msg = "Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines) |
| 1375 | oe.qa.handle_error(patchtype, msg, d) | ||
| 1376 | |||
| 1377 | oe.qa.exit_if_errors(d) | ||
| 1370 | } | 1378 | } |
| 1371 | 1379 | ||
| 1372 | python do_qa_configure() { | 1380 | python do_qa_configure() { |
