kconfig: Add option to get the full help text with listnewconfig
authorLaura Abbott <labbott@redhat.com>
Mon, 4 Nov 2019 22:10:08 +0000 (17:10 -0500)
committerChristian Lamparter <chunkeey@gmail.com>
Sat, 1 Feb 2020 18:07:26 +0000 (19:07 +0100)
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 helpnewconfig' 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.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/conf.c

index c661b531a3d3e581c4ddefa4183f72dcaf4f903c..5f1758c73ccf1762114c542ce08bbd5340822550 100644 (file)
@@ -32,6 +32,7 @@ enum input_mode {
        defconfig,
        savedefconfig,
        listnewconfig,
        defconfig,
        savedefconfig,
        listnewconfig,
+       helpnewconfig,
        olddefconfig,
 };
 static enum input_mode input_mode = oldaskconfig;
        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);
                                        }
                                }
                                                printf("%s%s=%s\n", CONFIG_, sym->name, str);
                                        }
                                }
+                       } else if (input_mode == helpnewconfig) {
+                               printf("-----\n");
+                               print_help(menu);
+                               printf("-----\n");
+
                        } else {
                                if (!conf_cnt++)
                                        printf("*\n* Restart config...\n*\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},
        {"alldefconfig",    no_argument,       NULL, alldefconfig},
        {"randconfig",      no_argument,       NULL, randconfig},
        {"listnewconfig",   no_argument,       NULL, listnewconfig},
+       {"helpnewconfig",   no_argument,       NULL, helpnewconfig},
        {"olddefconfig",    no_argument,       NULL, olddefconfig},
        {NULL, 0, NULL, 0}
 };
        {"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("Usage: %s [-s] [option] <kconfig-file>\n", progname);
        printf("[option] is _one_ of the following:\n");
        printf("  --listnewconfig         List new options\n");
+       printf("  --helpnewconfig         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"
        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 allmodconfig:
                case alldefconfig:
                case listnewconfig:
+               case helpnewconfig:
                case olddefconfig:
                        break;
                case '?':
                case olddefconfig:
                        break;
                case '?':
@@ -576,6 +585,7 @@ int main(int ac, char **av)
        case oldaskconfig:
        case oldconfig:
        case listnewconfig:
        case oldaskconfig:
        case oldconfig:
        case listnewconfig:
+       case helpnewconfig:
        case olddefconfig:
                conf_read(NULL);
                break;
        case olddefconfig:
                conf_read(NULL);
                break;
@@ -657,6 +667,7 @@ int main(int ac, char **av)
                /* fall through */
        case oldconfig:
        case listnewconfig:
                /* fall through */
        case oldconfig:
        case listnewconfig:
+       case helpnewconfig:
        case syncconfig:
                /* Update until a loop caused no more changes */
                do {
        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;
                }
                                defconfig_file);
                        return 1;
                }
-       } else if (input_mode != listnewconfig) {
+       } else if (input_mode != listnewconfig && input_mode != helpnewconfig) {
                if (!no_conf_write && conf_write(NULL)) {
                        fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                        exit(1);
                if (!no_conf_write && conf_write(NULL)) {
                        fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
                        exit(1);