[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQ8D4OVT81iTVs8jjrBXX6Zgwc+VJ_vb7hb4J-vCZZN=g@mail.gmail.com>
Date: Tue, 24 Sep 2024 12:46:12 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: David Hunter <david.hunter.linux@...il.com>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
shuah@...nel.org, javier.carrasco.cruz@...il.com
Subject: Re: [PATCH 5/7] linux-kbuild: fix: implement choice for kconfigs
On Sat, Sep 14, 2024 at 2:12 AM David Hunter
<david.hunter.linux@...il.com> wrote:
>
> Properly implement the config entries that are within the choice keyword
> for kconfig. Currently, the script only stops the previous config entry
> when a choice keyword is encountered.
>
> When the keyword "choice" is encountered, do the following:
> - distribute the lines immediately following the "choice"
> keyword to each config entry inside the "choice" section.
> - process the config entries with the distributed lines.
>
> Signed-off-by: David Hunter <david.hunter.linux@...il.com>
> ---
> scripts/kconfig/streamline_config.pl | 40 ++++++++++++++++++++++++++--
> 1 file changed, 38 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index 26e544744579..593df824ead7 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -162,6 +162,10 @@ sub read_kconfig {
>
> my $source = "$ksource/$kconfig";
> my $last_source = "";
> + my $choice_activated = 0;
> + my $distribute = 0;
> + my $dist_string;
> +
>
> # Check for any environment variables used
> while ($source =~ /\$\((\w+)\)/ && $last_source ne $source) {
> @@ -214,6 +218,19 @@ sub read_kconfig {
> $state = "DEP";
> }
>
> + if($choice_activated) {
> + $distribute = 0;
> + my $config_lines = "$_\n" . "$dist_string";
> + my $tmpconfig = ".choice.kconfig";
> + open (my $FH, '>', $tmpconfig);
> + print $FH $config_lines;
> + close($FH);
> +
> + read_kconfig($tmpconfig);
> + unlink($tmpconfig) or die "Can't delete $tmpconfig: $!\n";
This is ugly.
Please do not use the temp file.
I believe the only benefit to parse 'choice' block
is to propagate its 'depends on' down to member configs.
See how the 'if' statement is handled.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists