diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-11-17 16:35:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-01 16:23:45 +0000 |
commit | b825ea5ced69c5776732e63246de27d0e5026178 (patch) | |
tree | 388a6491562c769b37c050930d6cb426dd9a52bd | |
parent | fc5c6e373a49e354bcf2bd4bf57a39c8d9894583 (diff) | |
download | poky-b825ea5ced69c5776732e63246de27d0e5026178.tar.gz |
insane.bbclass: add a check that Upstream-Status patch tag is present and correctly formed
(From OE-Core rev: d679c35e087499075a5b8c2222d8e7007fc3e75d)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/insane.bbclass | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 27b1a00fb9..240f3aad62 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -1167,6 +1167,30 @@ python do_qa_patch() { | |||
1167 | bb.warn(msg) | 1167 | bb.warn(msg) |
1168 | msg = "Patch log indicates that patches do not apply cleanly." | 1168 | msg = "Patch log indicates that patches do not apply cleanly." |
1169 | oe.qa.handle_error("patch-fuzz", msg, d) | 1169 | oe.qa.handle_error("patch-fuzz", msg, d) |
1170 | |||
1171 | # Check if the patch contains a correctly formatted and spelled Upstream-Status | ||
1172 | import re | ||
1173 | from oe import patch | ||
1174 | |||
1175 | for url in patch.src_patches(d): | ||
1176 | (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url) | ||
1177 | |||
1178 | # skip patches not in oe-core | ||
1179 | if '/meta/' not in fullpath: | ||
1180 | continue | ||
1181 | |||
1182 | content = open(fullpath, encoding='utf-8', errors='ignore').read() | ||
1183 | kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) | ||
1184 | strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport)( .+)?$", re.MULTILINE) | ||
1185 | match_kinda = kinda_status_re.search(content) | ||
1186 | match_strict = strict_status_re.search(content) | ||
1187 | guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" | ||
1188 | |||
1189 | if not match_strict: | ||
1190 | if match_kinda: | ||
1191 | bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0))) | ||
1192 | else: | ||
1193 | bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines)) | ||
1170 | } | 1194 | } |
1171 | 1195 | ||
1172 | python do_qa_configure() { | 1196 | python do_qa_configure() { |