Skip to contentSkip to conversation

kconfig: Add option to get the full help text with listnewconfig

RFC PATCH Superseded Laura Abbott 3 participants 4 messages Oct 29, 2019 – Nov 4, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kconfig: Add option to get the full help text with listnewconfig

make listnewconfig will list the individual options that need to be set. This is useful but there's no easy way to get the help text associated with the options at the same time. Introduce a new targe 'make extendedlistnewconfig' which lists the full help text of all the new options as well. This makes it easier to automatically generate changes that are easy for humans to review. This command also adds markers between each option for easier parsing.

---
Red Hat has been relying on some external libraries that have a tendency to break to get the help text for all new config options. I'd really like an in tree way to get the help text so we can automatically generate patches for people to reveiw new config options. I'm open to other approaches that let us script getting the help text as well.

---
 scripts/kconfig/Makefile |  5 ++++-
 scripts/kconfig/conf.c   | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
scripts/kconfig/Makefile +4 -1
index ef2f2336c469..aaaf1f62300c 100644
@@ -66,7 +66,9 @@ localyesconfig localmodconfig: $(obj)/conf
 #  syncconfig has become an internal implementation detail and is now
 #  deprecated for external use
 simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
-	alldefconfig randconfig listnewconfig olddefconfig syncconfig
+	alldefconfig randconfig listnewconfig olddefconfig syncconfig \
+	extendedlistnewconfig
+
 PHONY += $(simple-targets)
 
 $(simple-targets): $(obj)/conf
@@ -134,6 +136,7 @@ help:
 	@echo  '  alldefconfig    - New config with all symbols set to default'
 	@echo  '  randconfig	  - New config with random answer to all options'
 	@echo  '  listnewconfig   - List new options'
+	@echo  '  extendedlistnewconfig   - List new options'
 	@echo  '  olddefconfig	  - Same as oldconfig but sets new symbols to their'
 	@echo  '                    default value without prompting'
 	@echo  '  kvmconfig	  - Enable additional options for kvm guest kernel support'
scripts/kconfig/conf.c +12 -1
index 40e16e871ae2..7aeb77374d9a 100644
@@ -32,6 +32,7 @@ enum input_mode {
 	defconfig,
 	savedefconfig,
 	listnewconfig,
+	extendedlistnewconfig,
 	olddefconfig,
 };
 static enum input_mode input_mode = oldaskconfig;
@@ -434,6 +435,11 @@ static void check_conf(struct menu *menu)
 						printf("%s%s=%s\n", CONFIG_, sym->name, str);
 					}
 				}
+			} else if (input_mode == extendedlistnewconfig) {
+				printf("-----\n");
+				print_help(menu);
+				printf("-----\n");
+
 			} else {
 				if (!conf_cnt++)
 					printf("*\n* Restart config...\n*\n");
@@ -459,6 +465,7 @@ static struct option long_opts[] = {
 	{"alldefconfig",    no_argument,       NULL, alldefconfig},
 	{"randconfig",      no_argument,       NULL, randconfig},
 	{"listnewconfig",   no_argument,       NULL, listnewconfig},
+	{"extendedlistnewconfig",   no_argument,       NULL, extendedlistnewconfig},
 	{"olddefconfig",    no_argument,       NULL, olddefconfig},
 	{NULL, 0, NULL, 0}
 };
@@ -469,6 +476,7 @@ static void conf_usage(const char *progname)
 	printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
 	printf("[option] is _one_ of the following:\n");
 	printf("  --listnewconfig         List new options\n");
+	printf("  --extendedlistnewconfig List new options and help text\n");
 	printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
 	printf("  --oldconfig             Update a configuration using a provided .config as base\n");
 	printf("  --syncconfig            Similar to oldconfig but generates configuration in\n"
@@ -543,6 +551,7 @@ int main(int ac, char **av)
 		case allmodconfig:
 		case alldefconfig:
 		case listnewconfig:
+		case extendedlistnewconfig:
 		case olddefconfig:
 			break;
 		case '?':
@@ -576,6 +585,7 @@ int main(int ac, char **av)
 	case oldaskconfig:
 	case oldconfig:
 	case listnewconfig:
+	case extendedlistnewconfig:
 	case olddefconfig:
 		conf_read(NULL);
 		break;
@@ -657,6 +667,7 @@ int main(int ac, char **av)
 		/* fall through */
 	case oldconfig:
 	case listnewconfig:
+	case extendedlistnewconfig:
 	case syncconfig:
 		/* Update until a loop caused no more changes */
 		do {
@@ -675,7 +686,7 @@ int main(int ac, char **av)
 				defconfig_file);
 			return 1;
 		}
-	} else if (input_mode != listnewconfig) {
+	} else if (input_mode != listnewconfig && input_mode != extendedlistnewconfig) {
 		if (!no_conf_write && conf_write(NULL)) {
 			fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
 			exit(1);
Signature · 1 line
2.21.0
#1 lore raw

Hi Laura,

Quoted 16 lines · Laura Abbott
scripts/kconfig/Makefile +3 -1
index ef2f2336c469..aaaf1f62300c 100644
@@ -66,7 +66,9 @@ localyesconfig localmodconfig: $(obj)/conf
 #  syncconfig has become an internal implementation detail and is now
 #  deprecated for external use
 simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
-	alldefconfig randconfig listnewconfig olddefconfig syncconfig
+	alldefconfig randconfig listnewconfig olddefconfig syncconfig \
+	extendedlistnewconfig
+
 PHONY += $(simple-targets)
 
 $(simple-targets): $(obj)/conf

scripts/kconfig/Makefile help: · line 139

Quoted 4 lines
scripts/kconfig/Makefile +1 -0
@@ -134,6 +136,7 @@ help:
 	@echo  '  alldefconfig    - New config with all symbols set to default'
 	@echo  '  randconfig	  - New config with random answer to all options'
 	@echo  '  listnewconfig   - List new options'
+	@echo  '  extendedlistnewconfig   - List new options'

This text should also say " and help text" similar to what conf.c does.

scripts/kconfig/Makefile help: · line 142

Quoted 3 lines
scripts/kconfig/Makefile +0 -0
 	@echo  '  olddefconfig	  - Same as oldconfig but sets new symbols to their'
 	@echo  '                    default value without prompting'
 	@echo  '  kvmconfig	  - Enable additional options for kvm guest kernel support'

I can't say that I like the name, but I won't try to paint it a different color.

Signature · 1 line
~Randy
#2 lore raw
In reply to Laura Abbott
Quoted 9 lines · Laura Abbott

make listnewconfig will list the individual options that need to be set. This is useful but there's no easy way to get the help text associated with the options at the same time. Introduce a new targe 'make extendedlistnewconfig' which lists the full help text of all the new options as well. This makes it easier to automatically generate changes that are easy for humans to review. This command also adds markers between each option for easier parsing.

Quoted 7 lines

---
Red Hat has been relying on some external libraries that have a tendency to break to get the help text for all new config options. I'd really like an in tree way to get the help text so we can automatically generate patches for people to reveiw new config options. I'm open to other approaches that let us script getting the help text as well.

I am not familiar with the workflow in Red Hat.
I cannot propose another approach.

I am not a big fan of the target name. 'extendedlistnewconfig' is so long that it breaks the alignment of 'make help'.
Maybe 'helpnewconfig' is understandable although I am open to discussion for a better name.

BTW, did you check how the newly-added 'choice' was displayed? Its help message is displayed, but the choice has no name. So, people might be confused what the help message is talking about.

Quoted 104 lines
---
 scripts/kconfig/Makefile |  5 ++++-
 scripts/kconfig/conf.c   | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
scripts/kconfig/Makefile +4 -1
index ef2f2336c469..aaaf1f62300c 100644
@@ -66,7 +66,9 @@ localyesconfig localmodconfig: $(obj)/conf
 #  syncconfig has become an internal implementation detail and is now
 #  deprecated for external use
 simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
-       alldefconfig randconfig listnewconfig olddefconfig syncconfig
+       alldefconfig randconfig listnewconfig olddefconfig syncconfig \
+       extendedlistnewconfig
+
 PHONY += $(simple-targets)
 
 $(simple-targets): $(obj)/conf
@@ -134,6 +136,7 @@ help:
        @echo  '  alldefconfig    - New config with all symbols set to default'
        @echo  '  randconfig      - New config with random answer to all options'
        @echo  '  listnewconfig   - List new options'
+       @echo  '  extendedlistnewconfig   - List new options'
        @echo  '  olddefconfig    - Same as oldconfig but sets new symbols to their'
        @echo  '                    default value without prompting'
        @echo  '  kvmconfig       - Enable additional options for kvm guest kernel support'
scripts/kconfig/conf.c +12 -2
index 40e16e871ae2..7aeb77374d9a 100644
@@ -32,6 +32,7 @@ enum input_mode {
        defconfig,
        savedefconfig,
        listnewconfig,
+       extendedlistnewconfig,
        olddefconfig,
 };
 static enum input_mode input_mode = oldaskconfig;
@@ -434,6 +435,11 @@ static void check_conf(struct menu *menu)
                                                printf("%s%s=%s\n", CONFIG_, sym->name, str);
                                        }
                                }
+                       } else if (input_mode == extendedlistnewconfig) {
+                               printf("-----\n");
+                               print_help(menu);
+                               printf("-----\n");
+
                        } else {
                                if (!conf_cnt++)
                                        printf("*\n* Restart config...\n*\n");
@@ -459,6 +465,7 @@ static struct option long_opts[] = {
        {"alldefconfig",    no_argument,       NULL, alldefconfig},
        {"randconfig",      no_argument,       NULL, randconfig},
        {"listnewconfig",   no_argument,       NULL, listnewconfig},
+       {"extendedlistnewconfig",   no_argument,       NULL, extendedlistnewconfig},
        {"olddefconfig",    no_argument,       NULL, olddefconfig},
        {NULL, 0, NULL, 0}
 };
@@ -469,6 +476,7 @@ static void conf_usage(const char *progname)
        printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
        printf("[option] is _one_ of the following:\n");
        printf("  --listnewconfig         List new options\n");
+       printf("  --extendedlistnewconfig List new options and help text\n");
        printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
        printf("  --oldconfig             Update a configuration using a provided .config as base\n");
        printf("  --syncconfig            Similar to oldconfig but generates configuration in\n"
@@ -543,6 +551,7 @@ int main(int ac, char **av)
                case allmodconfig:
                case alldefconfig:
                case listnewconfig:
+               case extendedlistnewconfig:
                case olddefconfig:
                        break;
                case '?':
@@ -576,6 +585,7 @@ int main(int ac, char **av)
        case oldaskconfig:
        case oldconfig:
        case listnewconfig:
+       case extendedlistnewconfig:
        case olddefconfig:
                conf_read(NULL);
                break;
@@ -657,6 +667,7 @@ int main(int ac, char **av)
                /* fall through */
        case oldconfig:
        case listnewconfig:
+       case extendedlistnewconfig:
        case syncconfig:
                /* Update until a loop caused no more changes */
                do {
@@ -675,7 +686,7 @@ int main(int ac, char **av)
                                defconfig_file);
                        return 1;
                }
-       } else if (input_mode != listnewconfig) {
+       } else if (input_mode != listnewconfig && input_mode != extendedlistnewconfig) {
                if (!no_conf_write && conf_write(NULL)) {
                        fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                        exit(1);
--

2.21.0

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
Quoted 22 lines · Masahiro Yamada
Quoted 9 lines · Laura Abbott

make listnewconfig will list the individual options that need to be set. This is useful but there's no easy way to get the help text associated with the options at the same time. Introduce a new targe 'make extendedlistnewconfig' which lists the full help text of all the new options as well. This makes it easier to automatically generate changes that are easy for humans to review. This command also adds markers between each option for easier parsing.

Quoted 7 lines

---
Red Hat has been relying on some external libraries that have a tendency to break to get the help text for all new config options. I'd really like an in tree way to get the help text so we can automatically generate patches for people to reveiw new config options. I'm open to other approaches that let us script getting the help text as well.

I am not familiar with the workflow in Red Hat.
I cannot propose another approach.

Quoted 7 lines

I am not a big fan of the target name. 'extendedlistnewconfig' is so long that it breaks the alignment of 'make help'.
Maybe 'helpnewconfig' is understandable although I am open to discussion for a better name.

Yes, I agree the name is long. helpnewconfig is fine by me.

Quoted 5 lines

BTW, did you check how the newly-added 'choice' was displayed? Its help message is displayed, but the choice has no name. So, people might be confused what the help message is talking about.

Thanks for pointing this out. For what we're looking to do I think we can work around it.

Thanks,
Laura

Quoted 108 lines
Quoted 106 lines

---
  scripts/kconfig/Makefile |  5 ++++-
  scripts/kconfig/conf.c   | 13 ++++++++++++-
  2 files changed, 16 insertions(+), 2 deletions(-)
scripts/kconfig/Makefile +4 -1
index ef2f2336c469..aaaf1f62300c 100644
@@ -66,7 +66,9 @@ localyesconfig localmodconfig: $(obj)/conf
  #  syncconfig has become an internal implementation detail and is now
  #  deprecated for external use
  simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
-       alldefconfig randconfig listnewconfig olddefconfig syncconfig
+       alldefconfig randconfig listnewconfig olddefconfig syncconfig \
+       extendedlistnewconfig
+
  PHONY += $(simple-targets)
 
  $(simple-targets): $(obj)/conf
@@ -134,6 +136,7 @@ help:
         @echo  '  alldefconfig    - New config with all symbols set to default'
         @echo  '  randconfig      - New config with random answer to all options'
         @echo  '  listnewconfig   - List new options'
+       @echo  '  extendedlistnewconfig   - List new options'
         @echo  '  olddefconfig    - Same as oldconfig but sets new symbols to their'
         @echo  '                    default value without prompting'
         @echo  '  kvmconfig       - Enable additional options for kvm guest kernel support'
scripts/kconfig/conf.c +12 -2
index 40e16e871ae2..7aeb77374d9a 100644
@@ -32,6 +32,7 @@ enum input_mode {
         defconfig,
         savedefconfig,
         listnewconfig,
+       extendedlistnewconfig,
         olddefconfig,
  };
  static enum input_mode input_mode = oldaskconfig;
@@ -434,6 +435,11 @@ static void check_conf(struct menu *menu)
                                                 printf("%s%s=%s\n", CONFIG_, sym->name, str);
                                         }
                                 }
+                       } else if (input_mode == extendedlistnewconfig) {
+                               printf("-----\n");
+                               print_help(menu);
+                               printf("-----\n");
+
                         } else {
                                 if (!conf_cnt++)
                                         printf("*\n* Restart config...\n*\n");
@@ -459,6 +465,7 @@ static struct option long_opts[] = {
         {"alldefconfig",    no_argument,       NULL, alldefconfig},
         {"randconfig",      no_argument,       NULL, randconfig},
         {"listnewconfig",   no_argument,       NULL, listnewconfig},
+       {"extendedlistnewconfig",   no_argument,       NULL, extendedlistnewconfig},
         {"olddefconfig",    no_argument,       NULL, olddefconfig},
         {NULL, 0, NULL, 0}
  };
@@ -469,6 +476,7 @@ static void conf_usage(const char *progname)
         printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
         printf("[option] is _one_ of the following:\n");
         printf("  --listnewconfig         List new options\n");
+       printf("  --extendedlistnewconfig List new options and help text\n");
         printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
         printf("  --oldconfig             Update a configuration using a provided .config as base\n");
         printf("  --syncconfig            Similar to oldconfig but generates configuration in\n"
@@ -543,6 +551,7 @@ int main(int ac, char **av)
                 case allmodconfig:
                 case alldefconfig:
                 case listnewconfig:
+               case extendedlistnewconfig:
                 case olddefconfig:
                         break;
                 case '?':
@@ -576,6 +585,7 @@ int main(int ac, char **av)
         case oldaskconfig:
         case oldconfig:
         case listnewconfig:
+       case extendedlistnewconfig:
         case olddefconfig:
                 conf_read(NULL);
                 break;
@@ -657,6 +667,7 @@ int main(int ac, char **av)
                 /* fall through */
         case oldconfig:
         case listnewconfig:
+       case extendedlistnewconfig:
         case syncconfig:
                 /* Update until a loop caused no more changes */
                 do {
@@ -675,7 +686,7 @@ int main(int ac, char **av)
                                 defconfig_file);
                         return 1;
                 }
-       } else if (input_mode != listnewconfig) {
+       } else if (input_mode != listnewconfig && input_mode != extendedlistnewconfig) {
                 if (!no_conf_write && conf_write(NULL)) {
                         fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                         exit(1);
--

2.21.0