From fd3279204eab47cf60dad868ce93d43e655c9d6a Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Tue, 22 Jan 2019 15:56:19 +0800 Subject: [PATCH] kconfig: update .config on missed or conflicting symbol values The existing .config may have missed or conflicting values if the file is manually edited or Kconfig is changed. Kconfiglib will assign default values to missed symbols and resolve conflicts when loading .config, but the current silentoldconfig.py fails to write the updated symbol values back to .config. This patch checks if any missed or conflicting symbol value is fixed by Kconfiglib and write the updated values back to .config if necessary. Tracked-On: #2371 Signed-off-by: Junjie Mao --- scripts/kconfig/silentoldconfig.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/kconfig/silentoldconfig.py b/scripts/kconfig/silentoldconfig.py index 82a3bfaf1..cb868c113 100644 --- a/scripts/kconfig/silentoldconfig.py +++ b/scripts/kconfig/silentoldconfig.py @@ -75,6 +75,19 @@ def main(): kconfig = kdefconfig sys.stdout.write("Overwrite with default configuration based on %s.\n" % defconfig_path) need_update = True + else: + # Use the existing .config as the base. + # + # Mark need_update if any visible symbol picks a different value + # from what is specified in .config. + for sym in [x for x in kconfig.unique_defined_syms if x.visibility]: + if sym.type in [kconfiglib.BOOL, kconfiglib.TRISTATE]: + picked_value = sym.tri_value + else: + picked_value = sym.str_value + need_update = (picked_value != sym.user_value) + if need_update: + break else: # base on a default configuration if kdefconfig: