All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fiona Klute via buildroot <buildroot@buildroot.org>
To: Arnout Vandecappelle <arnout@rnout.be>, buildroot@buildroot.org
Cc: Sen Hastings <sen@hastings.org>
Subject: Re: [Buildroot] [PATCH v2 1/6] support/scripts/pkg-stats: search only Config.in{, .host} for URL
Date: Wed, 6 May 2026 19:13:48 +0200	[thread overview]
Message-ID: <0bbddc2a-d460-49be-a29c-363105e63b75@gmx.de> (raw)
In-Reply-To: <51a2670e-19c1-4b40-a95e-1e38735ef8fd@rnout.be>

Am 05.05.26 um 21:32 schrieb Arnout Vandecappelle:
> On 26/04/2026 17:33, Fiona Klute via buildroot wrote:
>> The previous Config.* glob also caught linux/Config.ext.in and
>> package/php/Config.ext, as well as some backup files created by
>> editors (e.g. Config.in~ after editing a Config.in file in Emacs),
>> leading to wrong results depending on directory listing order.
>>
>> Also use "with" to automatically close the file when the block is
>> left, even on error.
>>
>> Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
> 
>   Applied to master, thanks.
> 
>> ---
>> This cannot solve the problem we have no structured URL information
>> and don't look at which option the URL is listed under, but at least
>> it's less wrong.
> 
>   Does either of these actually cause problems?

Rarely. If there are multiple URLs in one config file, we simply pick 
the first one, so now for linux/Config.in you always get the kernel.org 
URL added in this series, even if you selected the CIP kernel which has 
its own URL in its help text. There probably aren't many packages where 
that's an issue.

Mostly it just feels awkward to probe the help text instead of having an 
explicit definition.

>   What is still incorrect is that it doesn't report when Config.in 
> doesn't have an upstream URL while Config.in.host doesn't.

True. Though in that case we'd also have to differentiate between that 
and "there is no Config.in" for host-only packages. So far pkg-stats 
treats host and target packages as one and only reports infra separately.

>> Changes v1 -> v2:
>> * Try fixed names instead of globbing all directory entries
>>
>>   support/scripts/pkg-stats | 22 +++++++++++-----------
>>   1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
>> index 55aa63c861..efb85a7405 100755
>> --- a/support/scripts/pkg-stats
>> +++ b/support/scripts/pkg-stats
>> @@ -148,17 +148,17 @@ class Package:
>>           Fills in the .url field
>>           """
>>           self.status['url'] = ("warning", "no Config.in")
>> -        for filename in os.listdir(self.pkgdir):
>> -            if fnmatch.fnmatch(filename, 'Config.*'):
>> -                fp = open(os.path.join(self.pkgdir, filename), "r")
>> -                for config_line in fp:
>> -                    if URL_RE.match(config_line):
>> -                        self.url = config_line.strip()
>> -                        self.status['url'] = ("ok", "found")
>> -                        fp.close()
>> -                        return
>> -                self.status['url'] = ("error", "missing")
>> -                fp.close()
>> +        for filename in ('Config.in', 'Config.in.host'):
>> +            try:
>> +                with open(os.path.join(self.pkgdir, filename), "r") 
>> as fp:
>> +                    for config_line in fp:
>> +                        if URL_RE.match(config_line):
>> +                            self.url = config_line.strip()
>> +                            self.status['url'] = ("ok", "found")
>> +                            return
>> +                    self.status['url'] = ("error", "missing")
>> +            except FileNotFoundError:
> 
>   We could modernise things by switching to pathlib and using .exists() 
> a priori (and never mind the exception in case of TOCTOU or unreadable 
> file).
> 
>   But that's further improvement :-)

I agree. I kept this series to simple and hopefully uncontroversial 
fixes, didn't want to get into full refactoring right away. ;-)

Best regards,
Fiona

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-05-06 17:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-26 15:33 [Buildroot] [PATCH v2 0/6] Bugfixes for pkg-stats Fiona Klute via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 1/6] support/scripts/pkg-stats: search only Config.in{, .host} for URL Fiona Klute via buildroot
2026-05-05 19:32   ` Arnout Vandecappelle via buildroot
2026-05-06 17:13     ` Fiona Klute via buildroot [this message]
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 2/6] support/scripts/pkg-stats: format upstream URL info consistently in HTML Fiona Klute via buildroot
2026-05-05 19:44   ` Arnout Vandecappelle via buildroot
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 3/6] linux/Config.in: add kernel.org URL as BR2_LINUX_KERNEL_LATEST_VERSION help Fiona Klute via buildroot
2026-05-05 19:45   ` Arnout Vandecappelle via buildroot
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 4/6] support/scripts/pkg-stats: fix host/target infra filter Fiona Klute via buildroot
2026-05-05 19:50   ` Arnout Vandecappelle via buildroot
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 5/6] support/scripts/pkg-stats: don't buffer whole file searching for infra Fiona Klute via buildroot
2026-05-05 19:53   ` Arnout Vandecappelle via buildroot
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-04-26 15:33 ` [Buildroot] [PATCH v2 6/6] support/scripts/pkg-stats: run main function only if called as script Fiona Klute via buildroot
2026-05-05 19:53   ` Arnout Vandecappelle via buildroot
2026-05-15 17:46   ` Thomas Perale via buildroot
2026-05-05 19:25 ` [Buildroot] [PATCH v2 0/6] Bugfixes for pkg-stats Arnout Vandecappelle via buildroot
2026-05-06 17:49   ` Fiona Klute via buildroot
2026-05-07  8:34     ` Arnout Vandecappelle via buildroot
2026-05-07 11:55       ` Thomas Petazzoni via buildroot
2026-05-07 13:09         ` Peter Korsgaard

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=0bbddc2a-d460-49be-a29c-363105e63b75@gmx.de \
    --to=buildroot@buildroot.org \
    --cc=arnout@rnout.be \
    --cc=fiona.klute@gmx.de \
    --cc=sen@hastings.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.