summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2022-05-26 12:02:36 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-28 18:38:02 +0100
commit2dda445879b682e9f4b303f3683683378f86e72d (patch)
tree20de1b2bdcced40e85981848c37e9f12599c6408 /meta/classes/insane.bbclass
parentfaefe4f7c65665b2b7715bb01261a920ce46238c (diff)
downloadpoky-2dda445879b682e9f4b303f3683683378f86e72d.tar.gz
insane.bbclass: make sure to close .patch files
* fixes: DEBUG: Executing python function do_qa_patch /OE/build/oe-core/openembedded-core/meta/classes/insane.bbclass:1189: ResourceWarning: unclosed file <_io.TextIOWrapper name='/OE/build/oe-core/openembedded-core/meta/recipes-bsp/keymaps/files/GPLv2.patch' mode='r' encoding='utf-8'> content = open(fullpath, encoding='utf-8', errors='ignore').read() ResourceWarning: Enable tracemalloc to get the object allocation traceback DEBUG: Python function do_qa_patch finished (From OE-Core rev: 61be3668d866834adfff688620aee7e29f6d8c44) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass18
1 files changed, 10 insertions, 8 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 0bc6492c83..9ca84bace9 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1201,18 +1201,20 @@ python do_qa_patch() {
1201 if '/meta/' not in fullpath: 1201 if '/meta/' not in fullpath:
1202 continue 1202 continue
1203 1203
1204 content = open(fullpath, encoding='utf-8', errors='ignore').read()
1205 kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) 1204 kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE)
1206 strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE) 1205 strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE)
1207 match_kinda = kinda_status_re.search(content)
1208 match_strict = strict_status_re.search(content)
1209 guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" 1206 guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status"
1210 1207
1211 if not match_strict: 1208 with open(fullpath, encoding='utf-8', errors='ignore') as f:
1212 if match_kinda: 1209 file_content = f.read()
1213 bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0))) 1210 match_kinda = kinda_status_re.search(file_content)
1214 else: 1211 match_strict = strict_status_re.search(file_content)
1215 bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines)) 1212
1213 if not match_strict:
1214 if match_kinda:
1215 bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
1216 else:
1217 bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
1216} 1218}
1217 1219
1218python do_qa_configure() { 1220python do_qa_configure() {