diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-11-09 00:34:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:55:53 -0500 |
commit | 90389160efc2864501ced6e662f9419eb7a3e6c8 (patch) | |
tree | 3b2957a7540bf9e78ef106fe606945e435fab957 /scripts/kconfig | |
parent | 3f23ca2b37d13a89bb6cd0421821fc9c3b8ccd47 (diff) |
[PATCH] kconfig: preset config during all*config
Allow to force setting of config variables during all{no,mod,yes,random}config
to a specific value. For that conf first checks the KCONFIG_ALLCONFIG
environment variable for a file name, otherwise it checks for
all{no,mod,yes,random}.config and all.config. The file is a normal config
file, which presets the config variables, but they are still subject to normal
dependency checks.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/conf.c | 30 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 17 | ||||
-rw-r--r-- | scripts/kconfig/lkc_proto.h | 1 |
3 files changed, 45 insertions, 3 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index dffbf2ea1f9d..8ba5d29d3d42 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -82,6 +82,15 @@ static void conf_askvalue(struct symbol *sym, const char *def) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | switch (input_mode) { | 84 | switch (input_mode) { |
85 | case set_no: | ||
86 | case set_mod: | ||
87 | case set_yes: | ||
88 | case set_random: | ||
89 | if (sym_has_value(sym)) { | ||
90 | printf("%s\n", def); | ||
91 | return; | ||
92 | } | ||
93 | break; | ||
85 | case ask_new: | 94 | case ask_new: |
86 | case ask_silent: | 95 | case ask_silent: |
87 | if (sym_has_value(sym)) { | 96 | if (sym_has_value(sym)) { |
@@ -558,6 +567,27 @@ int main(int ac, char **av) | |||
558 | case ask_new: | 567 | case ask_new: |
559 | conf_read(NULL); | 568 | conf_read(NULL); |
560 | break; | 569 | break; |
570 | case set_no: | ||
571 | case set_mod: | ||
572 | case set_yes: | ||
573 | case set_random: | ||
574 | name = getenv("KCONFIG_ALLCONFIG"); | ||
575 | if (name && !stat(name, &tmpstat)) { | ||
576 | conf_read_simple(name); | ||
577 | break; | ||
578 | } | ||
579 | switch (input_mode) { | ||
580 | case set_no: name = "allno.config"; break; | ||
581 | case set_mod: name = "allmod.config"; break; | ||
582 | case set_yes: name = "allyes.config"; break; | ||
583 | case set_random: name = "allrandom.config"; break; | ||
584 | default: break; | ||
585 | } | ||
586 | if (!stat(name, &tmpstat)) | ||
587 | conf_read_simple(name); | ||
588 | else if (!stat("all.config", &tmpstat)) | ||
589 | conf_read_simple("all.config"); | ||
590 | break; | ||
561 | default: | 591 | default: |
562 | break; | 592 | break; |
563 | } | 593 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 02f670cc6bb9..4bba6202b79e 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -69,15 +69,13 @@ char *conf_get_default_confname(void) | |||
69 | return name; | 69 | return name; |
70 | } | 70 | } |
71 | 71 | ||
72 | int conf_read(const char *name) | 72 | int conf_read_simple(const char *name) |
73 | { | 73 | { |
74 | FILE *in = NULL; | 74 | FILE *in = NULL; |
75 | char line[1024]; | 75 | char line[1024]; |
76 | char *p, *p2; | 76 | char *p, *p2; |
77 | int lineno = 0; | 77 | int lineno = 0; |
78 | struct symbol *sym; | 78 | struct symbol *sym; |
79 | struct property *prop; | ||
80 | struct expr *e; | ||
81 | int i; | 79 | int i; |
82 | 80 | ||
83 | if (name) { | 81 | if (name) { |
@@ -232,6 +230,19 @@ int conf_read(const char *name) | |||
232 | 230 | ||
233 | if (modules_sym) | 231 | if (modules_sym) |
234 | sym_calc_value(modules_sym); | 232 | sym_calc_value(modules_sym); |
233 | return 0; | ||
234 | } | ||
235 | |||
236 | int conf_read(const char *name) | ||
237 | { | ||
238 | struct symbol *sym; | ||
239 | struct property *prop; | ||
240 | struct expr *e; | ||
241 | int i; | ||
242 | |||
243 | if (conf_read_simple(name)) | ||
244 | return 1; | ||
245 | |||
235 | for_all_symbols(i, sym) { | 246 | for_all_symbols(i, sym) { |
236 | sym_calc_value(sym); | 247 | sym_calc_value(sym); |
237 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | 248 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 6dc6d0c48e7a..b6a389c5fcbd 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -2,6 +2,7 @@ | |||
2 | /* confdata.c */ | 2 | /* confdata.c */ |
3 | P(conf_parse,void,(const char *name)); | 3 | P(conf_parse,void,(const char *name)); |
4 | P(conf_read,int,(const char *name)); | 4 | P(conf_read,int,(const char *name)); |
5 | P(conf_read_simple,int,(const char *name)); | ||
5 | P(conf_write,int,(const char *name)); | 6 | P(conf_write,int,(const char *name)); |
6 | 7 | ||
7 | /* menu.c */ | 8 | /* menu.c */ |