* to be used by standalone script scripts/contrib/patchreview.py as well Signed-off-by: Martin Jansa <martin.ja...@gmail.com> --- meta/classes-global/insane.bbclass | 19 +++---------------- meta/lib/oe/qa.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 720b75c395..c8e4219389 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -1358,22 +1358,9 @@ python do_qa_patch() { if not allpatches: continue - 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|Inactive-Upstream)( .+)?$", re.MULTILINE) - guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" - - with open(fullpath, encoding='utf-8', errors='ignore') as f: - file_content = f.read() - match_kinda = kinda_status_re.search(file_content) - match_strict = strict_status_re.search(file_content) - - if not match_strict: - if match_kinda: - msg = "Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)) - oe.qa.handle_error(patchtype, msg, d) - else: - msg = "Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines) - oe.qa.handle_error(patchtype, msg, d) + msg = oe.qa.check_upstream_status(fullpath) + if msg: + oe.qa.handle_error(patchtype, msg, d) oe.qa.exit_if_errors(d) } diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index b4cbc50045..de980638c4 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -213,6 +213,23 @@ def exit_with_message_if_errors(message, d): def exit_if_errors(d): exit_with_message_if_errors("Fatal QA errors were found, failing task.", d) +def check_upstream_status(fullpath): + import re + 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|Inactive-Upstream)( .+)?$", re.MULTILINE) + guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" + + with open(fullpath, encoding='utf-8', errors='ignore') as f: + file_content = f.read() + match_kinda = kinda_status_re.search(file_content) + match_strict = strict_status_re.search(file_content) + + if not match_strict: + if match_kinda: + return "Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)) + else: + return "Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines) + if __name__ == "__main__": import sys -- 2.39.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#177206): https://lists.openembedded.org/g/openembedded-core/message/177206 Mute This Topic: https://lists.openembedded.org/mt/96987600/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-