summaryrefslogtreecommitdiff
path: root/util/kconfig_check.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-31 12:13:38 -0700
committerCommit Bot <commit-bot@chromium.org>2022-02-05 00:26:33 +0000
commit29619ad8feefc30b25913605857da3a002f4cdf2 (patch)
treeb0554c56743083bd0f4999b7fc0cf96d1d79a72c /util/kconfig_check.py
parent96dd55b79647566a440f3ddf3193a289997d57c2 (diff)
downloadchrome-ec-29619ad8feefc30b25913605857da3a002f4cdf2.tar.gz
util: Tweak kconfig_check for use in the Makefile
Deal with two problems we have in the chroot: - An old Python requires a workaround for required arguments - We may not have access to the Zephyr tree and its full Kconfig, so need to gracefully fall back to using ad-hoc searching Note: This was part of a reverted commit. It is being split out to avoid mixing the switch-over with updates to the script. BUG=b:181323955 BRANCH=none TEST=CQ and see if it passes now Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4c885cc0661955b3b091c339b61e21cc2af7ac72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425449 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'util/kconfig_check.py')
-rwxr-xr-xutil/kconfig_check.py16
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)