History

Merge tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada: - show clearer error messages where pkg-config is needed, but not installed - rename SYMBOL_AUTO to SYMBOL_NO_WRITE to reflect its semantics - create all necessary directories by Kconfig tool itself instead of Makefile - update the .config unconditionally when syncconfig is invoked - use 'include' directive instead of '-include' where include/config/{auto,tristate}.conf is mandatory - do not try to update the .config when running install targets - add .DELETE_ON_ERROR to delete partially updated files - misc cleanups and fixes * tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: remove P_ENV property type kconfig: remove unused sym_get_env_prop() function kconfig: fix the rule of mainmenu_stmt symbol init/Kconfig: Use short unix-style option instead of --longname Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory kbuild: remove auto.conf from prerequisite of phony targets kbuild: do not update config for 'make kernelrelease' kbuild: do not update config when running install targets kbuild: add .DELETE_ON_ERROR special target kbuild: use 'include' directive to load auto.conf from top Makefile kconfig: allow all config targets to write auto.conf if missing kconfig: make syncconfig update .config regardless of sym_change_count kconfig: create directories needed for syncconfig by itself kconfig: remove unneeded directory generation from local*config kconfig: split out useful helpers in confdata.c kconfig: rename file_write_dep and move it to confdata.c kconfig: fix typos in description of "choice" in kconfig-language.txt kconfig: handle format string before calling conf_message_callback() kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE kconfig: check for pkg-config on make {menu,n,g,x}config

Linus Torvalds committed 8 years ago

Commit 01f0e5c2 parents e026bcc 188086121 files · +227 −146Browse files

Showing the changes to scripts (17 of 21 files). Show all

Unified · Split

17 files
  1. scripts/Kbuild.include +3 −0
  2. scripts/Makefile.modbuiltin +2 −2
  3. scripts/kconfig/Makefile +7 −10
  4. scripts/kconfig/check-pkgconfig.sh +8 −0
  5. scripts/kconfig/conf.c +22 −17
  6. scripts/kconfig/confdata.c +127 −29
  7. scripts/kconfig/expr.h +1 −2
  8. scripts/kconfig/gconf.c +3 −2
  9. scripts/kconfig/lkc.h +0 −2
  10. scripts/kconfig/lkc_proto.h +2 −2
  11. scripts/kconfig/mconf.c +4 −6
  12. scripts/kconfig/menu.c +1 −1
  13. scripts/kconfig/nconf.c +3 −5
  14. scripts/kconfig/qconf.cc +2 −1
  15. scripts/kconfig/symbol.c +1 −12
  16. scripts/kconfig/util.c +0 −30
  17. scripts/kconfig/zconf.y +3 −3
scripts/Kbuild.include+3−0
@@ -400,3 +400,6 @@ endif · 399 unmodified lines
400endef400endef
401#401#
402###############################################################################402###############################################################################
403
404# delete partially updated (i.e. corrupted) files on error
405.DELETE_ON_ERROR:
scripts/Makefile.modbuiltin+2−2
@@ -8,10 +8,10 @@ src := $(obj) · 7 unmodified lines
8PHONY := __modbuiltin8PHONY := __modbuiltin
9__modbuiltin:9__modbuiltin:
10 10
11-include include/config/auto.conf11include include/config/auto.conf
12# tristate.conf sets tristate variables to uppercase 'Y' or 'M'12# tristate.conf sets tristate variables to uppercase 'Y' or 'M'
13# That way, we get the list of built-in modules in obj-Y13# That way, we get the list of built-in modules in obj-Y
14-include include/config/tristate.conf14include include/config/tristate.conf
15 15
16include scripts/Kbuild.include16include scripts/Kbuild.include
17 17
scripts/kconfig/Makefile+7−10
@@ -3,8 +3,7 @@ · 2 unmodified lines
3# Kernel configuration targets3# Kernel configuration targets
4# These targets are used from top-level makefile4# These targets are used from top-level makefile
5 5
6PHONY += xconfig gconfig menuconfig config syncconfig \6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig
7 localmodconfig localyesconfig
8 7
9ifdef KBUILD_KCONFIG8ifdef KBUILD_KCONFIG
10Kconfig := $(KBUILD_KCONFIG)9Kconfig := $(KBUILD_KCONFIG)
@@ -34,14 +33,7 @@ config: $(obj)/conf · 23 unmodified lines
34nconfig: $(obj)/nconf33nconfig: $(obj)/nconf
35 $< $(silent) $(Kconfig)34 $< $(silent) $(Kconfig)
36 35
37# This has become an internal implementation detail and is now deprecated
38# for external use.
39syncconfig: $(obj)/conf
40 $(Q)mkdir -p include/config include/generated
41 $< $(silent) --$@ $(Kconfig)
42
43localyesconfig localmodconfig: $(obj)/conf36localyesconfig localmodconfig: $(obj)/conf
44 $(Q)mkdir -p include/config include/generated
45 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config37 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
46 $(Q)if [ -f .config ]; then \38 $(Q)if [ -f .config ]; then \
47 cmp -s .tmp.config .config || \39 cmp -s .tmp.config .config || \
@@ -56,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf · 8 unmodified lines
56 $(Q)rm -f .tmp.config48 $(Q)rm -f .tmp.config
57 49
58# These targets map 1:1 to the commandline options of 'conf'50# These targets map 1:1 to the commandline options of 'conf'
51#
52# Note:
53# syncconfig has become an internal implementation detail and is now
54# deprecated for external use
59simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \55simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
60 alldefconfig randconfig listnewconfig olddefconfig56 alldefconfig randconfig listnewconfig olddefconfig syncconfig
61PHONY += $(simple-targets)57PHONY += $(simple-targets)
62 58
63$(simple-targets): $(obj)/conf59$(simple-targets): $(obj)/conf
@@ -215,6 +211,7 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c · 151 unmodified lines
215 211
216# check if necessary packages are available, and configure build flags212# check if necessary packages are available, and configure build flags
217define filechk_conf_cfg213define filechk_conf_cfg
214 $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \
218 $(CONFIG_SHELL) $<215 $(CONFIG_SHELL) $<
219endef216endef
220 217
scripts/kconfig/check-pkgconfig.sh+8−0
@@ -0,0 +1,8 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# Check for pkg-config presence
4
5if [ -z $(command -v pkg-config) ]; then
6 echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
7 exit 1
8fi
scripts/kconfig/conf.c+22−17
@@ -496,6 +496,7 @@ int main(int ac, char **av) · 495 unmodified lines
496 int opt;496 int opt;
497 const char *name, *defconfig_file = NULL /* gcc uninit */;497 const char *name, *defconfig_file = NULL /* gcc uninit */;
498 struct stat tmpstat;498 struct stat tmpstat;
499 int no_conf_write = 0;
499 500
500 tty_stdio = isatty(0) && isatty(1);501 tty_stdio = isatty(0) && isatty(1);
501 502
@@ -633,13 +634,14 @@ int main(int ac, char **av) · 131 unmodified lines
633 }634 }
634 635
635 if (sync_kconfig) {636 if (sync_kconfig) {
636 if (conf_get_changed()) {637 name = getenv("KCONFIG_NOSILENTUPDATE");
637 name = getenv("KCONFIG_NOSILENTUPDATE");638 if (name && *name) {
638 if (name && *name) {639 if (conf_get_changed()) {
639 fprintf(stderr,640 fprintf(stderr,
640 "\n*** The configuration requires explicit update.\n\n");641 "\n*** The configuration requires explicit update.\n\n");
641 return 1;642 return 1;
642 }643 }
644 no_conf_write = 1;
643 }645 }
644 }646 }
645 647
@@ -684,29 +686,32 @@ int main(int ac, char **av) · 38 unmodified lines
684 break;686 break;
685 }687 }
686 688
687 if (sync_kconfig) {689 if (input_mode == savedefconfig) {
688 /* syncconfig is used during the build so we shall update autoconf.
689 * All other commands are only used to generate a config.
690 */
691 if (conf_get_changed() && conf_write(NULL)) {
692 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
693 exit(1);
694 }
695 if (conf_write_autoconf()) {
696 fprintf(stderr, "\n*** Error during update of the configuration.\n\n");
697 return 1;
698 }
699 } else if (input_mode == savedefconfig) {
700 if (conf_write_defconfig(defconfig_file)) {690 if (conf_write_defconfig(defconfig_file)) {
701 fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",691 fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
702 defconfig_file);692 defconfig_file);
703 return 1;693 return 1;
704 }694 }
705 } else if (input_mode != listnewconfig) {695 } else if (input_mode != listnewconfig) {
706 if (conf_write(NULL)) {696 if (!no_conf_write && conf_write(NULL)) {
707 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");697 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
708 exit(1);698 exit(1);
709 }699 }
700
701 /*
702 * Create auto.conf if it does not exist.
703 * This prevents GNU Make 4.1 or older from emitting
704 * "include/config/auto.conf: No such file or directory"
705 * in the top-level Makefile
706 *
707 * syncconfig always creates or updates auto.conf because it is
708 * used during the build.
709 */
710 if (conf_write_autoconf(sync_kconfig) && sync_kconfig) {
711 fprintf(stderr,
712 "\n*** Error during sync of the configuration.\n\n");
713 return 1;
714 }
710 }715 }
711 return 0;716 return 0;
712}717}
scripts/kconfig/confdata.c+127−29
@@ -16,6 +16,64 @@ · 15 unmodified lines
16 16
17#include "lkc.h"17#include "lkc.h"
18 18
19/* return true if 'path' exists, false otherwise */
20static bool is_present(const char *path)
21{
22 struct stat st;
23
24 return !stat(path, &st);
25}
26
27/* return true if 'path' exists and it is a directory, false otherwise */
28static bool is_dir(const char *path)
29{
30 struct stat st;
31
32 if (stat(path, &st))
33 return 0;
34
35 return S_ISDIR(st.st_mode);
36}
37
38/*
39 * Create the parent directory of the given path.
40 *
41 * For example, if 'include/config/auto.conf' is given, create 'include/config'.
42 */
43static int make_parent_dir(const char *path)
44{
45 char tmp[PATH_MAX + 1];
46 char *p;
47
48 strncpy(tmp, path, sizeof(tmp));
49 tmp[sizeof(tmp) - 1] = 0;
50
51 /* Remove the base name. Just return if nothing is left */
52 p = strrchr(tmp, '/');
53 if (!p)
54 return 0;
55 *(p + 1) = 0;
56
57 /* Just in case it is an absolute path */
58 p = tmp;
59 while (*p == '/')
60 p++;
61
62 while ((p = strchr(p, '/'))) {
63 *p = 0;
64
65 /* skip if the directory exists */
66 if (!is_dir(tmp) && mkdir(tmp, 0755))
67 return -1;
68
69 *p = '/';
70 while (*p == '/')
71 p++;
72 }
73
74 return 0;
75}
76
19struct conf_printer {77struct conf_printer {
20 void (*print_symbol)(FILE *, struct symbol *, const char *, void *);78 void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
21 void (*print_comment)(FILE *, const char *, void *);79 void (*print_comment)(FILE *, const char *, void *);
@@ -43,16 +101,16 @@ static void conf_warning(const char *fmt, ...) · 21 unmodified lines
43 conf_warnings++;101 conf_warnings++;
44}102}
45 103
46static void conf_default_message_callback(const char *fmt, va_list ap)104static void conf_default_message_callback(const char *s)
47{105{
48 printf("#\n# ");106 printf("#\n# ");
49 vprintf(fmt, ap);107 printf("%s", s);
50 printf("\n#\n");108 printf("\n#\n");
51}109}
52 110
53static void (*conf_message_callback) (const char *fmt, va_list ap) =111static void (*conf_message_callback)(const char *s) =
54 conf_default_message_callback;112 conf_default_message_callback;
55void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))113void conf_set_message_callback(void (*fn)(const char *s))
56{114{
57 conf_message_callback = fn;115 conf_message_callback = fn;
58}116}
@@ -60,10 +118,15 @@ void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) · 1 unmodified line
60static void conf_message(const char *fmt, ...)118static void conf_message(const char *fmt, ...)
61{119{
62 va_list ap;120 va_list ap;
121 char buf[4096];
122
123 if (!conf_message_callback)
124 return;
63 125
64 va_start(ap, fmt);126 va_start(ap, fmt);
65 if (conf_message_callback)127
66 conf_message_callback(fmt, ap);128 vsnprintf(buf, sizeof(buf), fmt, ap);
129 conf_message_callback(buf);
67 va_end(ap);130 va_end(ap);
68}131}
69 132
@@ -83,7 +146,6 @@ const char *conf_get_autoconfig_name(void) · 13 unmodified lines
83 146
84char *conf_get_default_confname(void)147char *conf_get_default_confname(void)
85{148{
86 struct stat buf;
87 static char fullname[PATH_MAX+1];149 static char fullname[PATH_MAX+1];
88 char *env, *name;150 char *env, *name;
89 151
@@ -91,7 +153,7 @@ char *conf_get_default_confname(void) · 1 unmodified line
91 env = getenv(SRCTREE);153 env = getenv(SRCTREE);
92 if (env) {154 if (env) {
93 sprintf(fullname, "%s/%s", env, name);155 sprintf(fullname, "%s/%s", env, name);
94 if (!stat(fullname, &buf))156 if (is_present(fullname))
95 return fullname;157 return fullname;
96 }158 }
97 return name;159 return name;
@@ -397,7 +459,7 @@ int conf_read(const char *name) · 299 unmodified lines
397 459
398 for_all_symbols(i, sym) {460 for_all_symbols(i, sym) {
399 sym_calc_value(sym);461 sym_calc_value(sym);
400 if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO))462 if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
401 continue;463 continue;
402 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {464 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
403 /* check that calculated value agrees with saved value */465 /* check that calculated value agrees with saved value */
@@ -725,10 +787,9 @@ int conf_write(const char *name) · 321 unmodified lines
725 787
726 dirname[0] = 0;788 dirname[0] = 0;
727 if (name && name[0]) {789 if (name && name[0]) {
728 struct stat st;
729 char *slash;790 char *slash;
730 791
731 if (!stat(name, &st) && S_ISDIR(st.st_mode)) {792 if (is_dir(name)) {
732 strcpy(dirname, name);793 strcpy(dirname, name);
733 strcat(dirname, "/");794 strcat(dirname, "/");
734 basename = conf_get_configname();795 basename = conf_get_configname();
@@ -813,26 +874,59 @@ next: · 78 unmodified lines
813 return 0;874 return 0;
814}875}
815 876
877/* write a dependency file as used by kbuild to track dependencies */
878static int conf_write_dep(const char *name)
879{
880 struct file *file;
881 FILE *out;
882
883 if (!name)
884 name = ".kconfig.d";
885 out = fopen("..config.tmp", "w");
886 if (!out)
887 return 1;
888 fprintf(out, "deps_config := \\\n");
889 for (file = file_list; file; file = file->next) {
890 if (file->next)
891 fprintf(out, "\t%s \\\n", file->name);
892 else
893 fprintf(out, "\t%s\n", file->name);
894 }
895 fprintf(out, "\n%s: \\\n"
896 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
897
898 env_write_dep(out, conf_get_autoconfig_name());
899
900 fprintf(out, "\n$(deps_config): ;\n");
901 fclose(out);
902
903 if (make_parent_dir(name))
904 return 1;
905 rename("..config.tmp", name);
906 return 0;
907}
908
816static int conf_split_config(void)909static int conf_split_config(void)
817{910{
818 const char *name;911 const char *name;
819 char path[PATH_MAX+1];912 char path[PATH_MAX+1];
820 char *s, *d, c;913 char *s, *d, c;
821 struct symbol *sym;914 struct symbol *sym;
822 struct stat sb;
823 int res, i, fd;915 int res, i, fd;
824 916
825 name = conf_get_autoconfig_name();917 name = conf_get_autoconfig_name();
826 conf_read_simple(name, S_DEF_AUTO);918 conf_read_simple(name, S_DEF_AUTO);
827 sym_calc_value(modules_sym);919 sym_calc_value(modules_sym);
828 920
921 if (make_parent_dir("include/config/foo.h"))
922 return 1;
829 if (chdir("include/config"))923 if (chdir("include/config"))
830 return 1;924 return 1;
831 925
832 res = 0;926 res = 0;
833 for_all_symbols(i, sym) {927 for_all_symbols(i, sym) {
834 sym_calc_value(sym);928 sym_calc_value(sym);
835 if ((sym->flags & SYMBOL_AUTO) || !sym->name)929 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
836 continue;930 continue;
837 if (sym->flags & SYMBOL_WRITE) {931 if (sym->flags & SYMBOL_WRITE) {
838 if (sym->flags & SYMBOL_DEF_AUTO) {932 if (sym->flags & SYMBOL_DEF_AUTO) {
@@ -897,19 +991,12 @@ static int conf_split_config(void) · 58 unmodified lines
897 res = 1;991 res = 1;
898 break;992 break;
899 }993 }
900 /*994
901 * Create directory components,995 if (make_parent_dir(path)) {
902 * unless they exist already.996 res = 1;
903 */997 goto out;
904 d = path;
905 while ((d = strchr(d, '/'))) {
906 *d = 0;
907 if (stat(path, &sb) && mkdir(path, 0755)) {
908 res = 1;
909 goto out;
910 }
911 *d++ = '/';
912 }998 }
999
913 /* Try it again. */1000 /* Try it again. */
914 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);1001 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
915 if (fd == -1) {1002 if (fd == -1) {
@@ -926,16 +1013,20 @@ out: · 10 unmodified lines
926 return res;1013 return res;
927}1014}
928 1015
929int conf_write_autoconf(void)1016int conf_write_autoconf(int overwrite)
930{1017{
931 struct symbol *sym;1018 struct symbol *sym;
932 const char *name;1019 const char *name;
1020 const char *autoconf_name = conf_get_autoconfig_name();
933 FILE *out, *tristate, *out_h;1021 FILE *out, *tristate, *out_h;
934 int i;1022 int i;
935 1023
1024 if (!overwrite && is_present(autoconf_name))
1025 return 0;
1026
936 sym_clear_all_valid();1027 sym_clear_all_valid();
937 1028
938 file_write_dep("include/config/auto.conf.cmd");1029 conf_write_dep("include/config/auto.conf.cmd");
939 1030
940 if (conf_split_config())1031 if (conf_split_config())
941 return 1;1032 return 1;
@@ -982,19 +1073,26 @@ int conf_write_autoconf(void) · 40 unmodified lines
982 name = getenv("KCONFIG_AUTOHEADER");1073 name = getenv("KCONFIG_AUTOHEADER");
983 if (!name)1074 if (!name)
984 name = "include/generated/autoconf.h";1075 name = "include/generated/autoconf.h";
1076 if (make_parent_dir(name))
1077 return 1;
985 if (rename(".tmpconfig.h", name))1078 if (rename(".tmpconfig.h", name))
986 return 1;1079 return 1;
1080
987 name = getenv("KCONFIG_TRISTATE");1081 name = getenv("KCONFIG_TRISTATE");
988 if (!name)1082 if (!name)
989 name = "include/config/tristate.conf";1083 name = "include/config/tristate.conf";
1084 if (make_parent_dir(name))
1085 return 1;
990 if (rename(".tmpconfig_tristate", name))1086 if (rename(".tmpconfig_tristate", name))
991 return 1;1087 return 1;
992 name = conf_get_autoconfig_name();1088
1089 if (make_parent_dir(autoconf_name))
1090 return 1;
993 /*1091 /*
994 * This must be the last step, kbuild has a dependency on auto.conf1092 * This must be the last step, kbuild has a dependency on auto.conf
995 * and this marks the successful completion of the previous steps.1093 * and this marks the successful completion of the previous steps.
996 */1094 */
997 if (rename(".tmpconfig", name))1095 if (rename(".tmpconfig", autoconf_name))
998 return 1;1096 return 1;
999 1097
1000 return 0;1098 return 0;
scripts/kconfig/expr.h+1−2
@@ -141,7 +141,7 @@ struct symbol { · 140 unmodified lines
141#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */141#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
142#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */142#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
143#define SYMBOL_CHANGED 0x0400 /* ? */143#define SYMBOL_CHANGED 0x0400 /* ? */
144#define SYMBOL_AUTO 0x1000 /* value from environment variable */144#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */
145#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */145#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
146#define SYMBOL_WARNED 0x8000 /* warning has been issued */146#define SYMBOL_WARNED 0x8000 /* warning has been issued */
147 147
@@ -185,7 +185,6 @@ enum prop_type { · 37 unmodified lines
185 P_SELECT, /* select BAR */185 P_SELECT, /* select BAR */
186 P_IMPLY, /* imply BAR */186 P_IMPLY, /* imply BAR */
187 P_RANGE, /* range 7..100 (for a symbol) */187 P_RANGE, /* range 7..100 (for a symbol) */
188 P_ENV, /* value from environment variable */
189 P_SYMBOL, /* where a symbol is defined */188 P_SYMBOL, /* where a symbol is defined */
190};189};
191 190
scripts/kconfig/gconf.c+3−2
@@ -101,8 +101,8 @@ const char *dbg_sym_flags(int val) · 100 unmodified lines
101 strcat(buf, "write/");101 strcat(buf, "write/");
102 if (val & SYMBOL_CHANGED)102 if (val & SYMBOL_CHANGED)
103 strcat(buf, "changed/");103 strcat(buf, "changed/");
104 if (val & SYMBOL_AUTO)104 if (val & SYMBOL_NO_WRITE)
105 strcat(buf, "auto/");105 strcat(buf, "no_write/");
106 106
107 buf[strlen(buf) - 1] = '\0';107 buf[strlen(buf) - 1] = '\0';
108 108
@@ -525,6 +525,7 @@ void on_save_activate(GtkMenuItem * menuitem, gpointer user_data) · 416 unmodified lines
525{525{
526 if (conf_write(NULL))526 if (conf_write(NULL))
527 text_insert_msg("Error", "Unable to save configuration !");527 text_insert_msg("Error", "Unable to save configuration !");
528 conf_write_autoconf(0);
528}529}
529 530
530 531
scripts/kconfig/lkc.h+0−2
@@ -97,7 +97,6 @@ void menu_set_type(int type); · 96 unmodified lines
97 97
98/* util.c */98/* util.c */
99struct file *file_lookup(const char *name);99struct file *file_lookup(const char *name);
100int file_write_dep(const char *name);
101void *xmalloc(size_t size);100void *xmalloc(size_t size);
102void *xcalloc(size_t nmemb, size_t size);101void *xcalloc(size_t nmemb, size_t size);
103void *xrealloc(void *p, size_t size);102void *xrealloc(void *p, size_t size);
@@ -126,7 +125,6 @@ const char *sym_get_string_default(struct symbol *sym); · 22 unmodified lines
126struct symbol *sym_check_deps(struct symbol *sym);125struct symbol *sym_check_deps(struct symbol *sym);
127struct property *prop_alloc(enum prop_type type, struct symbol *sym);126struct property *prop_alloc(enum prop_type type, struct symbol *sym);
128struct symbol *prop_get_symbol(struct property *prop);127struct symbol *prop_get_symbol(struct property *prop);
129struct property *sym_get_env_prop(struct symbol *sym);
130 128
131static inline tristate sym_get_tristate_value(struct symbol *sym)129static inline tristate sym_get_tristate_value(struct symbol *sym)
132{130{
scripts/kconfig/lkc_proto.h+2−2
@@ -7,10 +7,10 @@ int conf_read(const char *name); · 6 unmodified lines
7int conf_read_simple(const char *name, int);7int conf_read_simple(const char *name, int);
8int conf_write_defconfig(const char *name);8int conf_write_defconfig(const char *name);
9int conf_write(const char *name);9int conf_write(const char *name);
10int conf_write_autoconf(void);10int conf_write_autoconf(int overwrite);
11bool conf_get_changed(void);11bool conf_get_changed(void);
12void conf_set_changed_callback(void (*fn)(void));12void conf_set_changed_callback(void (*fn)(void));
13void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap));13void conf_set_message_callback(void (*fn)(const char *s));
14 14
15/* menu.c */15/* menu.c */
16extern struct menu rootmenu;16extern struct menu rootmenu;
scripts/kconfig/mconf.c+4−6
@@ -772,16 +772,13 @@ static void show_helptext(const char *title, const char *text) · 771 unmodified lines
772 show_textbox(title, text, 0, 0);772 show_textbox(title, text, 0, 0);
773}773}
774 774
775static void conf_message_callback(const char *fmt, va_list ap)775static void conf_message_callback(const char *s)
776{776{
777 char buf[PATH_MAX+1];
778
779 vsnprintf(buf, sizeof(buf), fmt, ap);
780 if (save_and_exit) {777 if (save_and_exit) {
781 if (!silent)778 if (!silent)
782 printf("%s", buf);779 printf("%s", s);
783 } else {780 } else {
784 show_textbox(NULL, buf, 6, 60);781 show_textbox(NULL, s, 6, 60);
785 }782 }
786}783}
787 784
@@ -977,6 +974,7 @@ static int handle_exit(void) · 189 unmodified lines
977 "\n\n");974 "\n\n");
978 return 1;975 return 1;
979 }976 }
977 conf_write_autoconf(0);
980 /* fall through */978 /* fall through */
981 case -1:979 case -1:
982 if (!silent)980 if (!silent)
scripts/kconfig/menu.c+1−1
@@ -212,7 +212,7 @@ void menu_add_option(int token, char *arg) · 211 unmodified lines
212 sym_defconfig_list = current_entry->sym;212 sym_defconfig_list = current_entry->sym;
213 else if (sym_defconfig_list != current_entry->sym)213 else if (sym_defconfig_list != current_entry->sym)
214 zconf_error("trying to redefine defconfig symbol");214 zconf_error("trying to redefine defconfig symbol");
215 sym_defconfig_list->flags |= SYMBOL_AUTO;215 sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
216 break;216 break;
217 case T_OPT_ALLNOCONFIG_Y:217 case T_OPT_ALLNOCONFIG_Y:
218 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;218 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
scripts/kconfig/nconf.c+3−5
@@ -674,6 +674,7 @@ static int do_exit(void) · 673 unmodified lines
674 "Your configuration changes were NOT saved.",674 "Your configuration changes were NOT saved.",
675 1,675 1,
676 "<OK>");676 "<OK>");
677 conf_write_autoconf(0);
677 break;678 break;
678 default:679 default:
679 btn_dialog(680 btn_dialog(
@@ -1210,12 +1211,9 @@ static void conf(struct menu *menu) · 530 unmodified lines
1210 }1211 }
1211}1212}
1212 1213
1213static void conf_message_callback(const char *fmt, va_list ap)1214static void conf_message_callback(const char *s)
1214{1215{
1215 char buf[1024];1216 btn_dialog(main_window, s, 1, "<OK>");
1216
1217 vsnprintf(buf, sizeof(buf), fmt, ap);
1218 btn_dialog(main_window, buf, 1, "<OK>");
1219}1217}
1220 1218
1221static void show_help(struct menu *menu)1219static void show_help(struct menu *menu)
scripts/kconfig/qconf.cc+2−1
@@ -1149,7 +1149,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym) · 1148 unmodified lines
1149 case P_DEFAULT:1149 case P_DEFAULT:
1150 case P_SELECT:1150 case P_SELECT:
1151 case P_RANGE:1151 case P_RANGE:
1152 case P_ENV:
1153 debug += prop_get_type_name(prop->type);1152 debug += prop_get_type_name(prop->type);
1154 debug += ": ";1153 debug += ": ";
1155 expr_print(prop->expr, expr_print_help, &debug, E_NONE);1154 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
@@ -1535,6 +1534,8 @@ bool ConfigMainWindow::saveConfig(void) · 379 unmodified lines
1535 QMessageBox::information(this, "qconf", "Unable to save configuration!");1534 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1536 return false;1535 return false;
1537 }1536 }
1537 conf_write_autoconf(0);
1538
1538 return true;1539 return true;
1539}1540}
1540 1541
scripts/kconfig/symbol.c+1−12
@@ -76,15 +76,6 @@ struct property *sym_get_choice_prop(struct symbol *sym) · 75 unmodified lines
76 return NULL;76 return NULL;
77}77}
78 78
79struct property *sym_get_env_prop(struct symbol *sym)
80{
81 struct property *prop;
82
83 for_all_properties(sym, prop, P_ENV)
84 return prop;
85 return NULL;
86}
87
88static struct property *sym_get_default_prop(struct symbol *sym)79static struct property *sym_get_default_prop(struct symbol *sym)
89{80{
90 struct property *prop;81 struct property *prop;
@@ -463,7 +454,7 @@ void sym_calc_value(struct symbol *sym) · 372 unmodified lines
463 }454 }
464 }455 }
465 456
466 if (sym->flags & SYMBOL_AUTO)457 if (sym->flags & SYMBOL_NO_WRITE)
467 sym->flags &= ~SYMBOL_WRITE;458 sym->flags &= ~SYMBOL_WRITE;
468 459
469 if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)460 if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)
@@ -1298,8 +1289,6 @@ const char *prop_get_type_name(enum prop_type type) · 828 unmodified lines
1298 switch (type) {1289 switch (type) {
1299 case P_PROMPT:1290 case P_PROMPT:
1300 return "prompt";1291 return "prompt";
1301 case P_ENV:
1302 return "env";
1303 case P_COMMENT:1292 case P_COMMENT:
1304 return "comment";1293 return "comment";
1305 case P_MENU:1294 case P_MENU:
scripts/kconfig/util.c+0−30
@@ -29,36 +29,6 @@ struct file *file_lookup(const char *name) · 28 unmodified lines
29 return file;29 return file;
30}30}
31 31
32/* write a dependency file as used by kbuild to track dependencies */
33int file_write_dep(const char *name)
34{
35 struct file *file;
36 FILE *out;
37
38 if (!name)
39 name = ".kconfig.d";
40 out = fopen("..config.tmp", "w");
41 if (!out)
42 return 1;
43 fprintf(out, "deps_config := \\\n");
44 for (file = file_list; file; file = file->next) {
45 if (file->next)
46 fprintf(out, "\t%s \\\n", file->name);
47 else
48 fprintf(out, "\t%s\n", file->name);
49 }
50 fprintf(out, "\n%s: \\\n"
51 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
52
53 env_write_dep(out, conf_get_autoconfig_name());
54
55 fprintf(out, "\n$(deps_config): ;\n");
56 fclose(out);
57 rename("..config.tmp", name);
58 return 0;
59}
60
61
62/* Allocate initial growable string */32/* Allocate initial growable string */
63struct gstr str_new(void)33struct gstr str_new(void)
64{34{
scripts/kconfig/zconf.y+3−3
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; · 30 unmodified lines
31static struct menu *current_menu, *current_entry;31static struct menu *current_menu, *current_entry;
32 32
33%}33%}
34%expect 3134%expect 30
35 35
36%union36%union
37{37{
@@ -117,7 +117,7 @@ start: mainmenu_stmt stmt_list | stmt_list; · 79 unmodified lines
117 117
118/* mainmenu entry */118/* mainmenu entry */
119 119
120mainmenu_stmt: T_MAINMENU prompt nl120mainmenu_stmt: T_MAINMENU prompt T_EOL
121{121{
122 menu_add_prompt(P_MENU, $2, NULL);122 menu_add_prompt(P_MENU, $2, NULL);
123};123};
@@ -265,7 +265,7 @@ symbol_option_arg: · 141 unmodified lines
265choice: T_CHOICE word_opt T_EOL265choice: T_CHOICE word_opt T_EOL
266{266{
267 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);267 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
268 sym->flags |= SYMBOL_AUTO;268 sym->flags |= SYMBOL_NO_WRITE;
269 menu_add_entry(sym);269 menu_add_entry(sym);
270 menu_add_expr(P_CHOICE, NULL, NULL);270 menu_add_expr(P_CHOICE, NULL, NULL);
271 free($2);271 free($2);