[U-Boot] [PATCH 2/3] moveconfig: Allow control of which implying configs are shown
Simon Glass
sjg at chromium.org
Fri Jun 16 03:39:32 UTC 2017
Sometimes it is useful to display CONFIG_TARGET or CONFIG_CMD configs. Add
an option to control this.
Also we generally ignore implying configs which affect fewer than 5
boards. But sometimes it is useful to show those those, so add an option
that reduces the minimum to two.
ERRATUM configs are never useful for implying things, so ignore those.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/moveconfig.py | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 4295b47d7c..f9c16d484a 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -1466,7 +1466,15 @@ def move_config(configs, options, db_queue):
slots.show_failed_boards()
slots.show_suspicious_boards()
-def imply_config(config_list, find_superset=False):
+(IMPLY_MIN_2, IMPLY_TARGET, IMPLY_CMD) = (1, 2, 4)
+
+IMPLY_FLAGS = {
+ 'min2': [IMPLY_MIN_2, 'Show options which imply >2 boards (normally >5)'],
+ 'target': [IMPLY_TARGET, 'Allow CONFIG_TARGET_... options to imply'],
+ 'cmd': [IMPLY_CMD, 'Allow CONFIG_CMD_... to imply'],
+};
+
+def do_imply_config(config_list, imply_flags, find_superset=False):
"""Find CONFIG options which imply those in the list
Some CONFIG options can be implied by others and this can help to reduce
@@ -1491,6 +1499,8 @@ def imply_config(config_list, find_superset=False):
Params:
config_list: List of CONFIG options to check (each a string)
+ imply_flags: Flags which control which implying configs are allowed
+ (IMPLY_...)
find_superset: True to look for configs which are a superset of those
already found. So for example if CONFIG_EXYNOS5 implies an option,
but CONFIG_EXYNOS covers a larger set of defconfigs and also
@@ -1551,8 +1561,14 @@ def imply_config(config_list, find_superset=False):
# Look at every possible config, except the target one
for imply_config in rest_configs:
- if 'CONFIG_TARGET' in imply_config:
+ if 'ERRATUM' in imply_config:
continue
+ if not (imply_flags & IMPLY_CMD):
+ if 'CONFIG_CMD' in imply_config:
+ continue
+ if not (imply_flags & IMPLY_TARGET):
+ if 'CONFIG_TARGET' in imply_config:
+ continue
# Find set of defconfigs that have this config
imply_defconfig = defconfig_db[imply_config]
@@ -1599,7 +1615,7 @@ def imply_config(config_list, find_superset=False):
num_common = len(imply_configs[config])
# Don't bother if there are less than 5 defconfigs affected.
- if num_common < 5:
+ if num_common < (2 if imply_flags & IMPLY_MIN_2 else 5):
continue
missing = defconfigs - imply_configs[config]
missing_str = ', '.join(missing) if missing else 'all'
@@ -1628,6 +1644,8 @@ def main():
"or '-' to read from stdin")
parser.add_option('-i', '--imply', action='store_true', default=False,
help='find options which imply others')
+ parser.add_option('-I', '--imply-flags', type='string', default='',
+ help="control the -i option ('help' for help")
parser.add_option('-n', '--dry-run', action='store_true', default=False,
help='perform a trial run (show log with no changes)')
parser.add_option('-e', '--exit-on-error', action='store_true',
@@ -1664,7 +1682,17 @@ def main():
check_top_directory()
if options.imply:
- imply_config(configs)
+ imply_flags = 0
+ for flag in options.imply_flags.split():
+ if flag == 'help' or flag not in IMPLY_FLAGS:
+ print "Imply flags: (separate with ',')"
+ for name, info in IMPLY_FLAGS.iteritems():
+ print ' %-15s: %s' % (name, info[1])
+ parser.print_usage()
+ sys.exit(1)
+ imply_flags |= IMPLY_FLAGS[flag][0]
+
+ do_imply_config(configs, imply_flags)
return
config_db = {}
--
2.13.1.518.g3df882009-goog
More information about the U-Boot
mailing list