Menuconfig: Don't ask to save configuration when nothing has changed

Closes https://github.com/espressif/esp-idf/issues/4303
pull/4494/head
Roland Dobai 2019-11-08 14:40:28 +01:00 zatwierdzone przez bot
rodzic 8c3cb232f0
commit be749395c4
7 zmienionych plików z 35 dodań i 15 usunięć

Wyświetl plik

@ -20,7 +20,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
# the build system is responsible for detecting the mismatch between
# CONFIG_IDF_TARGET and $IDF_TARGET.
string
default "$(IDF_TARGET)"
default "$IDF_TARGET"
config IDF_TARGET_ESP32
bool

Wyświetl plik

@ -34,7 +34,7 @@ SDKCONFIG_DEFAULTS ?= $(PROJECT_PATH)/sdkconfig.defaults
$(KCONFIG_TOOL_DIR)/mconf-idf: $(KCONFIG_TOOL_DIR)/conf-idf
# reset MAKEFLAGS as the menuconfig makefile uses implicit compile rules
$(KCONFIG_TOOL_DIR)/mconf-idf $(KCONFIG_TOOL_DIR)/conf-idf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c)
$(KCONFIG_TOOL_DIR)/mconf-idf $(KCONFIG_TOOL_DIR)/conf-idf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c) $(wildcard $(KCONFIG_TOOL_DIR)/*.y)
ifeq ($(OS),Windows_NT)
# mconf-idf is used only in MSYS
MAKEFLAGS="" CC=$(HOSTCC) LD=$(HOSTLD) \
@ -66,7 +66,8 @@ SDKCONFIG_DEFAULTS_FILES := $(foreach f,$(SDKCONFIG_DEFAULTS),$(wildcard $(f)))
SDKCONFIG_DEFAULTS_FILES += $(foreach f,$(SDKCONFIG_DEFAULTS_FILES),$(wildcard $(f).$(IDF_TARGET)))
ifeq ($(OS),Windows_NT)
SDKCONFIG_DEFAULTS_FILES := $(shell cygpath -m $(SDKCONFIG_DEFAULTS_FILES))
# -i is for ignore missing arguments in case SDKCONFIG_DEFAULTS_FILES is empty
SDKCONFIG_DEFAULTS_FILES := $(shell cygpath -i -m $(SDKCONFIG_DEFAULTS_FILES))
endif
DEFAULTS_ARG := $(foreach f,$(SDKCONFIG_DEFAULTS_FILES),--defaults $(f))
@ -94,7 +95,8 @@ define RunConfGen
$(DEFAULTS_ARG) \
--output config ${SDKCONFIG} \
--output makefile $(SDKCONFIG_MAKEFILE) \
--output header $(BUILD_DIR_BASE)/include/sdkconfig.h
--output header $(BUILD_DIR_BASE)/include/sdkconfig.h \
$1
endef
ifeq ($(OS),Windows_NT)
@ -135,23 +137,23 @@ ifdef BATCH_BUILD
@echo "See esp-idf documentation for more details."
@exit 1
else
$(call RunConfGen)
$(call RunConfGen,--dont-write-deprecated)
# RunConfGen before menuconfig ensures that deprecated options won't be ignored (they've got renamed)
$(call RunMenuConf)
# RunConfGen after menuconfig ensures that deprecated options are appended to $(SDKCONFIG) for backward compatibility
$(call RunConfGen)
$(call RunConfGen,)
endif
# defconfig creates a default config, based on SDKCONFIG_DEFAULTS if present
defconfig: | check_python_dependencies prepare_kconfig_files
$(summary) DEFCONFIG
$(call RunConfGen)
$(call RunConfGen,)
# if neither defconfig or menuconfig are requested, use the GENCONFIG rule to
# ensure generated config files are up to date
$(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(SDKCONFIG) $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD) | check_python_dependencies prepare_kconfig_files $(call prereq_if_explicit,defconfig) $(call prereq_if_explicit,menuconfig)
$(summary) GENCONFIG
$(call RunConfGen)
$(call RunConfGen,)
touch $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h # ensure newer than sdkconfig
else # "$(MAKE_RESTARTS)" != ""

Wyświetl plik

@ -263,12 +263,14 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
${menuconfig_depends}
# create any missing config file, with defaults if necessary
COMMAND ${prepare_kconfig_files_command}
COMMAND ${confgen_basecommand} --env "IDF_TARGET=${idf_target}" --output config ${sdkconfig}
COMMAND ${confgen_basecommand}
--env "IDF_TARGET=${idf_target}"
--dont-write-deprecated
--output config ${sdkconfig}
COMMAND ${CMAKE_COMMAND} -E env
"COMPONENT_KCONFIGS_SOURCE_FILE=${kconfigs_path}"
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=${kconfigs_projbuild_path}"
"IDF_CMAKE=y"
"IDF_TARGET=${IDF_TARGET}"
"KCONFIG_CONFIG=${sdkconfig}"
"IDF_TARGET=${idf_target}"
${MENUCONFIG_CMD} ${root_kconfig}

Wyświetl plik

@ -311,7 +311,7 @@ ifeq ($(MAKECMDGOALS),gconfig)
fi
endif
zconf.tab.o: zconf.lex.c zconf.hash.c
zconf.tab.o: zconf.lex.c zconf.hash.c zconf.tab.c
qconf.o: qconf.moc

Wyświetl plik

@ -1042,6 +1042,8 @@ int main(int ac, char **av)
return 1;
}
sym_set_change_count(0);
set_config_filename(conf_get_configname());
conf_set_message_callback(conf_message_callback);
do {

Wyświetl plik

@ -12,6 +12,7 @@
#include <stdbool.h>
#include "lkc.h"
#include "expand_env.h"
#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
@ -202,6 +203,14 @@ config_option: T_PROMPT prompt if_expr T_EOL
config_option: T_DEFAULT expr if_expr T_EOL
{
if ($2 && $2->type == E_SYMBOL) {
char *str = expand_environment($2->left.sym->name, zconf_curname(), zconf_lineno());
if (strcmp($2->left.sym->name, str) != 0) {
$2->left.sym->name = realloc($2->left.sym->name, strlen(str) + 1);
strncpy($2->left.sym->name, str, strlen(str) + 1);
}
free_expanded(str);
}
menu_add_expr(P_DEFAULT, $2, $3);
if ($1->stype != S_UNKNOWN)
menu_set_type($1->stype);

Wyświetl plik

@ -213,6 +213,10 @@ def main():
help='File with deprecated Kconfig options',
required=False)
parser.add_argument('--dont-write-deprecated',
help='Do not write compatibility statements for deprecated values',
action='store_true')
parser.add_argument('--output', nargs=2, action='append',
help='Write output file (format and output filename)',
metavar=('FORMAT', 'FILENAME'),
@ -253,10 +257,6 @@ def main():
sdkconfig_renames += os.environ.get("COMPONENT_SDKCONFIG_RENAMES", "").split()
deprecated_options = DeprecatedOptions(config.config_prefix, path_rename_files=sdkconfig_renames)
sdkconfig_renames = [args.sdkconfig_rename] if args.sdkconfig_rename else []
sdkconfig_renames += os.environ.get("COMPONENT_SDKCONFIG_RENAMES", "").split()
deprecated_options = DeprecatedOptions(config.config_prefix, path_rename_files=sdkconfig_renames)
if len(args.defaults) > 0:
def _replace_empty_assignments(path_in, path_out):
with open(path_in, 'r') as f_in, open(path_out, 'w') as f_out:
@ -304,6 +304,11 @@ def main():
except OSError:
pass
if args.dont_write_deprecated:
# The deprecated object was useful until now for replacements. Now it will be redefined with no configurations
# and as the consequence, it won't generate output with deprecated statements.
deprecated_options = DeprecatedOptions('', path_rename_files=[])
# Output the files specified in the arguments
for output_type, filename in args.output:
with tempfile.NamedTemporaryFile(prefix="confgen_tmp", delete=False) as f: