From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: James Knight <james.d.knight@live.com>
Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/4] utils/check-package: cleanup line reading
Date: Sat, 26 Aug 2023 22:09:09 +0200 [thread overview]
Message-ID: <20230826220909.54b81153@windsurf> (raw)
In-Reply-To: <SN4P221MB0682A6E723BF55D3807B1BBBA0689@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM>
Hello James,
On Sat, 29 Apr 2023 14:12:02 -0400
James Knight <james.d.knight@live.com> wrote:
> Cleanup the implementation for reading lines by having files processed
> in context managers and utilizing the iterable file object for line
> reading (instead of needing to call `readlines()`).
>
> Signed-off-by: James Knight <james.d.knight@live.com>
> ---
> utils/check-package | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/utils/check-package b/utils/check-package
> index 83b9750f5a9c181dc96dcba508682776a600aac5..db3a00b524bc2c2aa663d3621c94fb11a6db7cb3 100755
> --- a/utils/check-package
> +++ b/utils/check-package
> @@ -229,16 +229,18 @@ def check_file_using_lib(fname):
> nwarnings += warn
>
> lastline = ""
> - for lineno, text in enumerate(open(fname, "r", errors="surrogateescape").readlines()):
> - nlines += 1
> - for name, cf in objects:
> - if cf.disable.search(lastline):
> - continue
> - warn, fail = print_warnings(cf.check_line(lineno + 1, text), name in xfail)
> - if fail > 0:
> - failed.add(name)
> - nwarnings += warn
> - lastline = text
> + with open(fname, "r", errors="surrogateescape") as f:
> + for lineno, text in enumerate(f):
> + nlines += 1
> + for name, cf in objects:
> + if cf.disable.search(lastline):
> + continue
> + line_sts = cf.check_line(fstate, lineno + 1, text)
This variable "fstate" doesn't exist as of PATCH 1/4. I wanted to apply
only this patch for now, as I'm not sure about PATCH 2/4 to PATCH 4/4,
but PATCH 1/4 on its own doesn't work. Could you have a look?
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-08-26 20:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230429181205.3620-1-james.d.knight@live.com>
2023-04-29 18:12 ` [Buildroot] [PATCH 1/4] utils/check-package: cleanup line reading James Knight
2023-08-26 20:09 ` Thomas Petazzoni via buildroot [this message]
2023-04-29 18:12 ` [Buildroot] [PATCH 2/4] utils/check-package: support a file-state instance for library types James Knight
2023-09-03 16:11 ` Ricardo Martincoski
2023-04-29 18:12 ` [Buildroot] [PATCH 3/4] utils/check-package: support ignore-indent flag for configurations James Knight
2023-09-03 16:13 ` Ricardo Martincoski
2023-04-29 18:12 ` [Buildroot] [PATCH 4/4] utils/check-package: utilize ignore-indent flag for special configs James Knight
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=20230826220909.54b81153@windsurf \
--to=buildroot@buildroot.org \
--cc=james.d.knight@live.com \
--cc=ricardo.martincoski@datacom.com.br \
--cc=thomas.petazzoni@bootlin.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox