summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-08-22 22:18:21 +0900
committerTom Rini <trini@konsulko.com>2016-09-06 13:18:20 -0400
commit916224c38d2e5a582bba472b9e4b133c12862efa (patch)
tree14491de2dba832238e0c7d3b09bbaf970e67d294 /tools
parent09c6c06688d0042872a2eba3b19862d74d2f4a8a (diff)
tools: moveconfig: warn loudly if moved option has no entry in Kconfig
Currently, the tool gives up moving an option quietly if its entry was not found in Kconfig. If the option is not defined in the config header in the first place, it is no problem (as the Kconfig entry may have been hidden by reasonable "depends on"). However, if the option is defined in the config header, the missing Kconfig entry is a sign of possible behavior change. It is highly recommended to manually check if the option has been moved as expected. In this case, let's add "suspicious" in the log and change the log color (if --color option is given) to make it stand out. This was suggested by Tom in [1]. [1] http://lists.denx.de/pipermail/u-boot/2016-July/261988.html Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Suggested-by: Tom Rini <trini@konsulko.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/moveconfig.py45
1 files changed, 31 insertions, 14 deletions
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 93f3781462..98e86088b2 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -47,12 +47,18 @@ It looks like one of the following:
This config option was moved to the defconfig
- CONFIG_... is not defined in Kconfig. Do nothing.
- The entry for this CONFIG was not found in Kconfig.
+ The entry for this CONFIG was not found in Kconfig. The option is not
+ defined in the config header, either. So, this case can be just skipped.
+
+ - CONFIG_... is not defined in Kconfig (suspicious). Do nothing.
+ This option is defined in the config header, but its entry was not found
+ in Kconfig.
There are two common cases:
- You forgot to create an entry for the CONFIG before running
this tool, or made a typo in a CONFIG passed to this tool.
- The entry was hidden due to unmet 'depends on'.
- This is correct behavior.
+ The tool does not know if the result is reasonable, so please check it
+ manually.
- 'CONFIG_...' is the same as the define in Kconfig. Do nothing.
The define in the config header matched the one in Kconfig.
@@ -210,7 +216,8 @@ STATE_SAVEDEFCONFIG = 3
ACTION_MOVE = 0
ACTION_NO_ENTRY = 1
-ACTION_NO_CHANGE = 2
+ACTION_NO_ENTRY_WARN = 2
+ACTION_NO_CHANGE = 3
COLOR_BLACK = '0;30'
COLOR_RED = '0;31'
@@ -659,14 +666,6 @@ class KconfigParser:
"""
not_set = '# %s is not set' % config
- for line in dotconfig_lines:
- line = line.rstrip()
- if line.startswith(config + '=') or line == not_set:
- old_val = line
- break
- else:
- return (ACTION_NO_ENTRY, config)
-
for line in autoconf_lines:
line = line.rstrip()
if line.startswith(config + '='):
@@ -675,6 +674,17 @@ class KconfigParser:
else:
new_val = not_set
+ for line in dotconfig_lines:
+ line = line.rstrip()
+ if line.startswith(config + '=') or line == not_set:
+ old_val = line
+ break
+ else:
+ if new_val == not_set:
+ return (ACTION_NO_ENTRY, config)
+ else:
+ return (ACTION_NO_ENTRY_WARN, config)
+
# If this CONFIG is neither bool nor trisate
if old_val[-2:] != '=y' and old_val[-2:] != '=m' and old_val != not_set:
# tools/scripts/define2mk.sed changes '1' to 'y'.
@@ -704,6 +714,7 @@ class KconfigParser:
results = []
updated = False
+ suspicious = False
with open(self.dotconfig) as f:
dotconfig_lines = f.readlines()
@@ -725,6 +736,10 @@ class KconfigParser:
elif action == ACTION_NO_ENTRY:
actlog = "%s is not defined in Kconfig. Do nothing." % value
log_color = COLOR_LIGHT_BLUE
+ elif action == ACTION_NO_ENTRY_WARN:
+ actlog = "%s is not defined in Kconfig (suspicious). Do nothing." % value
+ log_color = COLOR_YELLOW
+ suspicious = True
elif action == ACTION_NO_CHANGE:
actlog = "'%s' is the same as the define in Kconfig. Do nothing." \
% value
@@ -744,7 +759,7 @@ class KconfigParser:
os.remove(self.config_autoconf)
os.remove(self.autoconf)
- return (updated, log)
+ return (updated, suspicious, log)
def check_defconfig(self):
"""Check the defconfig after savedefconfig
@@ -923,7 +938,9 @@ class Slot:
def do_savedefconfig(self):
"""Update the .config and run 'make savedefconfig'."""
- (updated, log) = self.parser.update_dotconfig()
+ (updated, suspicious, log) = self.parser.update_dotconfig()
+ if suspicious:
+ self.suspicious_boards.add(self.defconfig)
self.log += log
if not self.options.force_sync and not updated:
@@ -994,7 +1011,7 @@ class Slot:
def get_suspicious_boards(self):
"""Returns a set of boards (defconfigs) with possible misconversion.
"""
- return self.suspicious_boards
+ return self.suspicious_boards - self.failed_boards
class Slots: