All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Sakoman <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][kirkstone 18/26] insane.bbclass: make sure to close .patch files
Date: Thu,  2 Jun 2022 06:51:50 -1000	[thread overview]
Message-ID: <d96022a38908fbcf0583ed3388d5667bff38087b.1654188574.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1654188574.git.steve@sakoman.com>

From: Martin Jansa <Martin.Jansa@gmail.com>

* 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 <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 61be3668d866834adfff688620aee7e29f6d8c44)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 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



  parent reply	other threads:[~2022-06-02 16:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 16:51 [OE-core][kirkstone 00/26] Patch review Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 01/26] vim: Upgrade 8.2.4912 -> 8.2.5034 to fix 9 CVEs Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 02/26] tiff: Add jbig PACKAGECONFIG and clarify CVE-2022-1210 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 03/26] libxslt: Mark CVE-2022-29824 as not applying Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 04/26] cve-check.bbclass: Added do_populate_sdk[recrdeptask] Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 05/26] cve-check: Add helper for symlink handling Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 06/26] cve-check: Only include installed packages for rootfs manifest Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 07/26] cve-extra-exclusions: Add kernel CVEs Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 08/26] cve-check: Allow warnings to be disabled Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 09/26] linux-yocto/5.15: update to v5.15.37 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 10/26] linux-yocto/5.10: update to v5.10.113 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 11/26] linux-yocto/5.15: update to v5.15.38 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 12/26] linux-yocto/5.10: update to v5.10.114 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 13/26] libpcre2: upgrade 10.39 -> 10.40 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 14/26] ncurses: update to patchlevel 20220423 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 15/26] mesa.inc: package 00-radv-defaults.conf Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 16/26] staging.bbclass: process direct dependencies in deterministic order Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 17/26] libseccomp: Add missing files for ptests Steve Sakoman
2022-06-02 16:51 ` Steve Sakoman [this message]
2022-06-02 16:51 ` [OE-core][kirkstone 19/26] pciutils: avoid lspci conflict with busybox Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 20/26] ovmf: Fix native build with gcc-12 Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 21/26] rust-common: Fix sstate signatures between arm hf and non-hf Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 22/26] rust-common: Ensure sstate signatures have correct dependencues for do_rust_gen_targets Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 23/26] rust-common: Fix for target definitions returning 'NoneType' for arm Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 24/26] rust-common: Drop LLVM_TARGET and simplify Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 25/26] rust-common: Fix native signature dependency issues Steve Sakoman
2022-06-02 16:51 ` [OE-core][kirkstone 26/26] gcc: Upgrade to 11.3 release Steve Sakoman
2022-06-10  8:39 ` [kirkstone 00/26] Patch review Sundeep KOKKONDA
2022-06-10  9:12   ` [OE-core] " Martin Jansa
2022-06-10  9:13     ` Martin Jansa
2022-06-10 14:19     ` Steve Sakoman
2022-06-16  2:19       ` Sundeep KOKKONDA
2022-06-16 14:19         ` [OE-core] " Randy MacLeod
2022-06-20  3:09           ` Sundeep KOKKONDA
2022-06-27 12:12             ` Randy MacLeod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d96022a38908fbcf0583ed3388d5667bff38087b.1654188574.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.