linux/debian/patches/features/all/Kbuild-kconfig-Verbose-vers...

163 lines
5.1 KiB
Diff

From 9ea05ef9d1e272f17808838510f886d3138845b8 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 14 Sep 2010 04:33:34 +0100
Subject: [PATCH] Kbuild: kconfig: Verbose version of --listnewconfig
If the KBUILD_VERBOSE environment variable is set to non-zero, show
the default values of new symbols and not just their names.
Based on work by Bastian Blank <waldi@debian.org> and
maximilian attems <max@stro.at>. Simplified by Michal Marek
<mmarek@suse.cz>.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
scripts/kconfig/conf.c | 42 ++++++++++++++++++++++++++++++++----------
scripts/kconfig/confdata.c | 9 +++++++++
scripts/kconfig/expr.h | 2 ++
scripts/kconfig/lkc_proto.h | 1 +
4 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index f208f90..ffaa787 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -364,7 +364,6 @@ static void conf(struct menu *menu)
switch (prop->type) {
case P_MENU:
if ((input_mode == silentoldconfig ||
- input_mode == listnewconfig ||
input_mode == oldnoconfig) &&
rootEntry != menu) {
check_conf(menu);
@@ -425,11 +424,7 @@ static void check_conf(struct menu *menu)
if (sym && !sym_has_value(sym)) {
if (sym_is_changable(sym) ||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
- if (input_mode == listnewconfig) {
- if (sym->name && !sym_is_choice_value(sym)) {
- printf("%s%s\n", CONFIG_, sym->name);
- }
- } else if (input_mode != oldnoconfig) {
+ if (input_mode != oldnoconfig) {
if (!conf_cnt++)
printf(_("*\n* Restart config...\n*\n"));
rootEntry = menu_get_parent_menu(menu);
@@ -442,6 +437,30 @@ static void check_conf(struct menu *menu)
check_conf(child);
}
+static void report_conf(struct menu *menu, bool verbose)
+{
+ struct symbol *sym;
+ struct menu *child;
+
+ if (!menu_is_visible(menu))
+ return;
+
+ if (verbose && menu == &rootmenu) {
+ printf("\n#\n"
+ "# Changes:\n"
+ "#\n");
+ }
+
+ sym = menu->sym;
+ if (sym && (sym->flags & SYMBOL_NEW) &&
+ sym_is_changable(sym) && sym->name && !sym_is_choice_value(sym)) {
+ conf_write_new_symbol(stdout, sym, verbose);
+ }
+
+ for (child = menu->list; child; child = child->next)
+ report_conf(child, verbose);
+}
+
static struct option long_opts[] = {
{"oldaskconfig", no_argument, NULL, oldaskconfig},
{"oldconfig", no_argument, NULL, oldconfig},
@@ -482,6 +501,7 @@ int main(int ac, char **av)
const char *progname = av[0];
int opt;
const char *name, *defconfig_file = NULL /* gcc uninit */;
+ const char *value;
struct stat tmpstat;
setlocale(LC_ALL, "");
@@ -634,16 +654,18 @@ int main(int ac, char **av)
input_mode = silentoldconfig;
/* fall through */
case oldconfig:
- case listnewconfig:
case oldnoconfig:
case silentoldconfig:
/* Update until a loop caused no more changes */
do {
conf_cnt = 0;
check_conf(&rootmenu);
- } while (conf_cnt &&
- (input_mode != listnewconfig &&
- input_mode != oldnoconfig));
+ } while (conf_cnt && input_mode != oldnoconfig);
+ break;
+ case listnewconfig:
+ conf_set_all_new_symbols(def_default);
+ value = getenv("KBUILD_VERBOSE");
+ report_conf(&rootmenu, value && atoi(value));
break;
}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 59b667c..d2be252 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -695,6 +695,14 @@ next_menu:
return 0;
}
+void conf_write_new_symbol(FILE *fp, struct symbol *sym, bool verbose)
+{
+ if (verbose)
+ conf_write_symbol(fp, sym, &kconfig_printer_cb, NULL);
+ else
+ fprintf(fp, "%s%s\n", CONFIG_, sym->name);
+}
+
int conf_write(const char *name)
{
FILE *out;
@@ -1079,6 +1087,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
for_all_symbols(i, sym) {
if (sym_has_value(sym))
continue;
+ sym->flags |= SYMBOL_NEW;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 80fce57..0db77f3 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -104,6 +104,8 @@ struct symbol {
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
+#define SYMBOL_NEW 0x100000 /* symbol is new (loaded config did not provide a value) */
+
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 47fe9c3..dd0024a 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -7,6 +7,7 @@ P(conf_read_simple,int,(const char *name, int));
P(conf_write_defconfig,int,(const char *name));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
+P(conf_write_new_symbol, void,(FILE*, struct symbol*, bool));
P(conf_get_changed,bool,(void));
P(conf_set_changed_callback, void,(void (*fn)(void)));
P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
--
1.7.5.4