From: David Hunter <david.hunter.linux@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: David Hunter <david.hunter.linux@gmail.com>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
shuah@kernel.org, javier.carrasco.cruz@gmail.com
Subject: [PATCH 5/7] linux-kbuild: fix: implement choice for kconfigs
Date: Fri, 13 Sep 2024 13:12:00 -0400 [thread overview]
Message-ID: <20240913171205.22126-6-david.hunter.linux@gmail.com> (raw)
In-Reply-To: <20240913171205.22126-1-david.hunter.linux@gmail.com>
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@gmail.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";
+ }
+
+
# collect the depends for the config
} elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
$state = "DEP";
@@ -258,8 +275,27 @@ sub read_kconfig {
$iflevel-- if ($iflevel);
# stop on "help" and keywords that end a menu entry
- } elsif (/^\s*(---)?help(---)?\s*$/ || /^(comment|choice|menu)\b/) {
- $state = "NONE";
+ } elsif (/^\s*(---)?help(---)?\s*$/ || /^(comment|menu)\b/) {
+ $state = "NONE";
+
+ # for choice, distribute the lines before each config entry
+ # to each config entry
+ } elsif (/^\s*choice\b/) {
+ $state = "CHOICE";
+ $choice_activated = 1;
+ $distribute = 1;
+ } elsif(/^\s*endchoice/) {
+ $choice_activated = 0;
+ $dist_string = "";
+ }
+
+ if($choice_activated && $distribute) {
+ # do not put 'choice' inside of string to distribute
+ if($state eq "CHOICE") {
+ $state = "NONE";
+ } else {
+ $dist_string .= "$_\n";
+ }
}
}
close($kinfile);
--
2.43.0
next prev parent reply other threads:[~2024-09-13 17:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 17:11 David Hunter
2024-09-13 17:11 ` [PATCH 1/7] linux-kbuild: fix: config option can be bool David Hunter
2024-09-24 2:55 ` Masahiro Yamada
2024-10-10 19:46 ` David Hunter
2024-10-14 14:22 ` David Hunter
2024-09-13 17:11 ` [PATCH 2/7] linux-kbuild: fix: missing variable operator David Hunter
2024-09-24 3:04 ` Masahiro Yamada
2024-10-14 14:26 ` David Hunter
2024-09-13 17:11 ` [PATCH 3/7] linux-kbuild: fix: ensure all defaults are tracked David Hunter
2024-09-24 3:06 ` Masahiro Yamada
2024-10-14 14:27 ` David Hunter
2024-09-13 17:11 ` [PATCH 4/7] linux-kbuild: fix: ensure selected configs were turned on in original David Hunter
2024-09-24 3:45 ` Masahiro Yamada
2024-10-14 14:38 ` David Hunter
2024-09-13 17:12 ` David Hunter [this message]
2024-09-24 3:46 ` [PATCH 5/7] linux-kbuild: fix: implement choice for kconfigs Masahiro Yamada
2024-10-10 20:06 ` David Hunter
2024-10-10 20:29 ` David Hunter
2024-10-14 14:39 ` David Hunter
2024-09-13 17:12 ` [PATCH 6/7] linux-kbuild: fix: configs with defaults do not need a prompt David Hunter
2024-09-24 4:08 ` Masahiro Yamada
2024-10-14 14:41 ` David Hunter
2024-09-13 17:12 ` [PATCH 7/7] linux-kbuild: fix: process config options set to "y" David Hunter
2024-09-24 4:21 ` Masahiro Yamada
2024-10-10 20:47 ` David Hunter
2024-10-14 14:42 ` David Hunter
2024-09-13 20:39 ` Shuah Khan
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=20240913171205.22126-6-david.hunter.linux@gmail.com \
--to=david.hunter.linux@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).