summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2021-11-17 16:35:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-01 16:19:00 +0000
commitd679c35e087499075a5b8c2222d8e7007fc3e75d (patch)
treedfa6f4e2b49d2a9a83d26ae9bac5afe917c28594 /meta/classes/insane.bbclass
parentaf90f9681bae3defe841ddcf80755960792faa88 (diff)
downloadopenembedded-core-d679c35e087499075a5b8c2222d8e7007fc3e75d.tar.gz
insane.bbclass: add a check that Upstream-Status patch tag is present and correctly formed
Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass24
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() {
bb.warn(msg)
msg = "Patch log indicates that patches do not apply cleanly."
oe.qa.handle_error("patch-fuzz", msg, d)
+
+ # Check if the patch contains a correctly formatted and spelled Upstream-Status
+ import re
+ from oe import patch
+
+ for url in patch.src_patches(d):
+ (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url)
+
+ # skip patches not in oe-core
+ if '/meta/' not in fullpath:
+ continue
+
+ content = open(fullpath, encoding='utf-8', errors='ignore').read()
+ kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE)
+ strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport)( .+)?$", re.MULTILINE)
+ match_kinda = kinda_status_re.search(content)
+ match_strict = strict_status_re.search(content)
+ guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status"
+
+ if not match_strict:
+ if match_kinda:
+ bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
+ else:
+ bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
}
python do_qa_configure() {