From: Martin Jansa <[email protected]>

* 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

Signed-off-by: Martin Jansa <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
(cherry picked from commit 61be3668d866834adfff688620aee7e29f6d8c44)
Signed-off-by: Steve Sakoman <[email protected]>
---
 meta/classes/insane.bbclass | 18 ++++++++++--------
 1 file 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() {
        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|Inactive-Upstream)( 
.+)?$", 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))
+       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:
+                   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() {
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#166495): 
https://lists.openembedded.org/g/openembedded-core/message/166495
Mute This Topic: https://lists.openembedded.org/mt/91503823/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to