diff options
author | Simon Glass <sjg@chromium.org> | 2022-01-31 12:08:41 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-07 18:53:18 +0000 |
commit | 90cd4033ccb514a60a9476e4bbb469e9cb6c6cfa (patch) | |
tree | 985b87891bb3c0eeff4d92b1833d5426d07879b1 /util/kconfig_check.py | |
parent | d08a4c945a48223e0641327a1f1d7545912667e7 (diff) | |
download | chrome-ec-90cd4033ccb514a60a9476e4bbb469e9cb6c6cfa.tar.gz |
util: Allow ignoring problematic Kconfig options
The script normally complains if an option is in config_allowed but is
actually defined in Kconfig.
This doesn't always work though, since it is possible that the option
is defined in Zephyr itself, not in the platform/etc/zephyr directory.
Add an option to ignore them.
BUG=b:181323955
BRANCH=none
TEST=./util/kconfig_check.py -c build/blipper/.config
-a util/config_allowed.txt -p PLATFORM_EC_ -s zephyr/
-I ~/cosarm/src/third_party/zephyr/main -i DAC check
See that this does not cause an error now
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Icbb245b0cd4dcdc59a72a970020314d8a265fb98
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425451
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'util/kconfig_check.py')
-rwxr-xr-x | util/kconfig_check.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/util/kconfig_check.py b/util/kconfig_check.py index 3987825aac..d1eba8e62b 100755 --- a/util/kconfig_check.py +++ b/util/kconfig_check.py @@ -63,6 +63,9 @@ a corresponding Kconfig option for Zephyr''' parser.add_argument( '-D', '--debug', action='store_true', help='Enabling debugging (provides a full traceback on error)') + parser.add_argument( + '-i', '--ignore', action='append', + help='Kconfig options to ignore (without CONFIG_ prefix)') parser.add_argument('-I', '--search-path', type=str, action='append', help='Search paths to look for Kconfigs') parser.add_argument('-p', '--prefix', type=str, default='PLATFORM_EC_', @@ -290,7 +293,7 @@ class KconfigCheck: return new_adhoc, unneeded_adhoc, updated_adhoc def do_check(self, configs_file, srcdir, allowed_file, prefix, use_defines, - search_paths): + search_paths, ignore=None): """Find new ad-hoc configs in the configs_file Args: @@ -302,6 +305,9 @@ class KconfigCheck: use_defines: True if each line of the file starts with #define search_paths: List of project paths to search for Kconfig files, in addition to the current directory + ignore: List of Kconfig options to ignore if they match an ad-hoc + CONFIG. This means they will not cause an error if they match + an ad-hoc CONFIG. Returns: Exit code: 0 if OK, 1 if a problem was found @@ -327,12 +333,15 @@ To temporarily disable this, use: ALLOW_CONFIG=1 make ... ''', file=sys.stderr) return 1 + if not ignore: + ignore = [] + unneeded_adhoc = [name for name in unneeded_adhoc if name not in ignore] if unneeded_adhoc: with open(NEW_ALLOWED_FNAME, 'w') as out: for config in updated_adhoc: print('CONFIG_%s' % config, file=out) - now_in_kconfig = '\n'.join(['CONFIG_%s' % name - for name in unneeded_adhoc]) + now_in_kconfig = '\n'.join( + ['CONFIG_%s' % name for name in unneeded_adhoc]) print(f'''The following options are now in Kconfig: {now_in_kconfig} @@ -381,7 +390,8 @@ def main(argv): return checker.do_check( configs_file=args.configs, srcdir=args.srctree, allowed_file=args.allowed, prefix=args.prefix, - use_defines=args.use_defines, search_paths=args.search_path) + use_defines=args.use_defines, search_paths=args.search_path, + ignore=args.ignore) elif args.cmd == 'build': return checker.do_build(configs_file=args.configs, srcdir=args.srctree, allowed_file=args.allowed, prefix=args.prefix, |