diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2023-02-15 18:20:40 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-19 07:47:53 +0000 |
commit | 149ea9db9645e29e29914ff7fab6c67237f7debc (patch) | |
tree | 85395535f5c427b1a5bc5f4903dd353399e08f0f /meta/lib/oe/qa.py | |
parent | add828fa4feafba18930b53ff2deca62d7a02ffd (diff) | |
download | poky-149ea9db9645e29e29914ff7fab6c67237f7debc.tar.gz |
insane.bbclass: move Upstream-Status logic to oe.qa
* to be used by standalone script scripts/contrib/patchreview.py
as well
(From OE-Core rev: c326efeec8f576200728a44c694becdeab4fe2db)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r-- | meta/lib/oe/qa.py | 17 |
1 files changed, 17 insertions, 0 deletions
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): | |||
213 | def exit_if_errors(d): | 213 | def exit_if_errors(d): |
214 | exit_with_message_if_errors("Fatal QA errors were found, failing task.", d) | 214 | exit_with_message_if_errors("Fatal QA errors were found, failing task.", d) |
215 | 215 | ||
216 | def check_upstream_status(fullpath): | ||
217 | import re | ||
218 | kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) | ||
219 | strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE) | ||
220 | guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" | ||
221 | |||
222 | with open(fullpath, encoding='utf-8', errors='ignore') as f: | ||
223 | file_content = f.read() | ||
224 | match_kinda = kinda_status_re.search(file_content) | ||
225 | match_strict = strict_status_re.search(file_content) | ||
226 | |||
227 | if not match_strict: | ||
228 | if match_kinda: | ||
229 | return "Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)) | ||
230 | else: | ||
231 | return "Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines) | ||
232 | |||
216 | if __name__ == "__main__": | 233 | if __name__ == "__main__": |
217 | import sys | 234 | import sys |
218 | 235 | ||