diff options
author | Simon Glass <sjg@chromium.org> | 2022-01-31 11:57:41 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-07 18:53:02 +0000 |
commit | d08a4c945a48223e0641327a1f1d7545912667e7 (patch) | |
tree | ef8cf7574459444086656ada60c2dcd4d8154ee4 /util/kconfig_check.py | |
parent | b295f811932e0c4982e09ba292af61c2f05f80fd (diff) | |
download | chrome-ec-d08a4c945a48223e0641327a1f1d7545912667e7.tar.gz |
util: Support building a new list of ad-hoc CONFIGs
Add a separate command for this, so that the file can easily be
regenerated completely.
BUG=b:181323955
BRANCH=none
TEST=./util/kconfig_check.py -c build/blipper/.config
-a util/config_allowed.txt -p PLATFORM_EC_ -s zephyr/ build
See that the output file is generated
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Ife8e4cee3bcacf3d8206cd598140b88608a13109
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425450
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'util/kconfig_check.py')
-rwxr-xr-x | util/kconfig_check.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/util/kconfig_check.py b/util/kconfig_check.py index 30a798b8f4..3987825aac 100755 --- a/util/kconfig_check.py +++ b/util/kconfig_check.py @@ -76,6 +76,7 @@ a corresponding Kconfig option for Zephyr''' subparsers = parser.add_subparsers(dest='cmd') subparsers.required = True + subparsers.add_parser('build', help='Build new list of ad-hoc CONFIGs') subparsers.add_parser('check', help='Check for new ad-hoc CONFIGs') return parser.parse_args(argv) @@ -344,6 +345,31 @@ update in your CL: return 1 return 0 + def do_build(self, configs_file, srcdir, allowed_file, prefix, use_defines, + search_paths): + """Find new ad-hoc configs in the configs_file + + Args: + configs_file: Filename containing CONFIG options to check + srcdir: Source directory to scan for Kconfig files + allowed_file: File containing allowed CONFIG options + prefix: Prefix to strip from the start of each Kconfig + (e.g. 'PLATFORM_EC_') + 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 + + Returns: + Exit code: 0 if OK, 1 if a problem was found + """ + new_adhoc, _, updated_adhoc = self.check_adhoc_configs( + configs_file, srcdir, allowed_file, prefix, use_defines, + search_paths) + with open(NEW_ALLOWED_FNAME, 'w') as out: + combined = sorted(new_adhoc + updated_adhoc) + for config in combined: + print(f'CONFIG_{config}', file=out) + print(f'New list is in {NEW_ALLOWED_FNAME}') def main(argv): """Main function""" @@ -356,6 +382,10 @@ def main(argv): configs_file=args.configs, srcdir=args.srctree, allowed_file=args.allowed, prefix=args.prefix, use_defines=args.use_defines, search_paths=args.search_path) + elif args.cmd == 'build': + return checker.do_build(configs_file=args.configs, srcdir=args.srctree, + allowed_file=args.allowed, prefix=args.prefix, + use_defines=args.use_defines, search_paths=args.search_path) return 2 |