diff options
author | Simon Glass <sjg@chromium.org> | 2021-05-27 15:49:15 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-28 23:56:08 +0000 |
commit | 5b4c6473a341ebbd88463c908b39bb2820e5c43b (patch) | |
tree | e6e5c87b9164cbbec214d389fa8752977d0c89d0 /util/kconfig_check.py | |
parent | d680d3972ab9c3060165ef8a39445ff2e132efd1 (diff) | |
download | chrome-ec-5b4c6473a341ebbd88463c908b39bb2820e5c43b.tar.gz |
Makefile: Switch to the Python script for CONFIG checking
Now that the Python script seems to do what we need, switch over to
use that for checking for allowed ad-hoc CONFIGs.
Sadly we need a work-around for the very old Python 3 version used in
the chroot.
The new script is better at finding Kconfig options, so this allows some
reductions in the config_allowed.txt file.
Delete the now-unused shell scripts.
BUG=b:181323955
BRANCH=none
TEST=python3 util/test_kconfig_check.py
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I2dafc9dfe9d9020638f4e49b5c5ee0fc0b10000b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923233
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'util/kconfig_check.py')
-rwxr-xr-x | util/kconfig_check.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/util/kconfig_check.py b/util/kconfig_check.py index 93f3afd53c..30a798b8f4 100755 --- a/util/kconfig_check.py +++ b/util/kconfig_check.py @@ -70,7 +70,12 @@ a corresponding Kconfig option for Zephyr''' parser.add_argument('-s', '--srctree', type=str, default='zephyr/', help='Path to source tree to look for Kconfigs') - subparsers = parser.add_subparsers(dest='cmd', required=True) + # TODO(sjg@chromium.org): The chroot uses a very old Python. Once it moves + # to 3.7 or later we can use this instead: + # subparsers = parser.add_subparsers(dest='cmd', required=True) + subparsers = parser.add_subparsers(dest='cmd') + subparsers.required = True + subparsers.add_parser('check', help='Check for new ad-hoc CONFIGs') return parser.parse_args(argv) @@ -269,7 +274,14 @@ class KconfigCheck: current state of the Kconfig options """ configs = self.read_configs(configs_file, use_defines) - kconfigs = self.scan_kconfigs(srcdir, prefix, search_paths) + try: + kconfigs = self.scan_kconfigs(srcdir, prefix, search_paths) + except kconfiglib.KconfigError: + # If we don't actually have access to the full Kconfig then we may + # get an error. Fall back to using manual methods. + kconfigs = self.scan_kconfigs(srcdir, prefix, search_paths, + try_kconfiglib=False) + allowed = self.read_allowed(allowed_file) new_adhoc = self.find_new_adhoc(configs, kconfigs, allowed) unneeded_adhoc = self.find_unneeded_adhoc(kconfigs, allowed) |