summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-04-30 13:01:42 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-30 22:51:12 +0000
commit39d7af5b215a544fb6fa6f8a32ea2fc3c9cb9ce5 (patch)
tree700db51b372ee01d37196f28a3466f4de6c01f66 /util
parentcaab3a60b0403e7059f83bbcc1deb09fa565beb7 (diff)
downloadchrome-ec-39d7af5b215a544fb6fa6f8a32ea2fc3c9cb9ce5.tar.gz
zephyr: fix namespace for Kconfig check scripts
Update both the scripts used to verify that ad-hoc CONFIG options have a Kconfig option to use the same search criteria. The list of Kconfigs is now all option that start with the config or menuconfig keyword. The full Kconfig list is transformed to replace CONFIG_PLATFORM_EC_ with CONFIG_, to match the Chromium EC namespace. BUG=b:184037201 BRANCH=none TEST=make buildall TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I5edeeddd4e935b4bbf2ce7321a19249a543d916e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2860985 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/build_allowed.sh13
-rwxr-xr-xutil/check_allowed.sh11
2 files changed, 17 insertions, 7 deletions
diff --git a/util/build_allowed.sh b/util/build_allowed.sh
index 4b734ef055..6ef4fe03a5 100755
--- a/util/build_allowed.sh
+++ b/util/build_allowed.sh
@@ -24,6 +24,7 @@ allowed=util/config_allowed.txt
[ "$1" == "-u" ] && update=1
tmp=$(mktemp -d)
+kconfigs="${tmp}/kconfigs"
#
# Look for the CONFIG options, excluding those in Kconfig and defconfig files.
@@ -36,10 +37,14 @@ git grep CONFIG_ | \
# We need a list of the valid Kconfig options to exclude these from the allowed
# list.
-find . -name "Kconfig*" -exec cat {} \; | sed -n \
- -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
- -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
- | sort | uniq >"${tmp}/allowed.tmp2"
+find . -type f -name "Kconfig*" -exec cat {} \; | sed -n -e \
+ 's/^\s*\(config\|menuconfig\) *\([A-Za-z0-9_]*\)$/CONFIG_\2/p' \
+ | sort | uniq > "${kconfigs}"
+
+# Most Kconfigs follow the pattern of CONFIG_PLATFORM_EC_*. Strip PLATFORM_EC_
+# from the config name to match the cros-ec namespace.
+sed -e 's/^CONFIG_PLATFORM_EC_/CONFIG_/p' "${kconfigs}" | sort | uniq \
+ > "${tmp}/allowed.tmp2"
# Use only the options that are present in the first file but not the second.
# These comprise new ad-hoc CONFIG options.
diff --git a/util/check_allowed.sh b/util/check_allowed.sh
index 03b6df8fe9..0881409036 100755
--- a/util/check_allowed.sh
+++ b/util/check_allowed.sh
@@ -41,6 +41,7 @@ tmp=$(mktemp -d)
# Temporary files
new_configs="${tmp}/configs"
suspects="${tmp}/suspects"
+kconfigs="${tmp}/kconfigs"
ok="${tmp}/ok"
new_adhoc="${tmp}/adhoc"
@@ -54,9 +55,13 @@ sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' "${config}" | sort | uniq \
comm -23 "${new_configs}" "${allow}" > "${suspects}"
# Find all the Kconfig options so far defined
-find "${srctree}" -name "Kconfig*" -exec cat {} \; | sed -n -e \
- 's/^\s*\(config\|menuconfig\) PLATFORM_EC_\([A-Za-z0-9_]*\)$/CONFIG_\2/p' \
- | sort | uniq > "${ok}"
+find "${srctree}" -type f -name "Kconfig*" -exec cat {} \; | sed -n -e \
+ 's/^\s*\(config\|menuconfig\) *\([A-Za-z0-9_]*\)$/CONFIG_\2/p' \
+ | sort | uniq > "${kconfigs}"
+
+# Most Kconfigs follow the pattern of CONFIG_PLATFORM_EC_*. Strip PLATFORM_EC_
+# from the config name to match the cros-ec namespace.
+sed -e 's/^CONFIG_PLATFORM_EC_/CONFIG_/p' "${kconfigs}" | sort | uniq > "${ok}"
# Complain about any new ad-hoc CONFIGs
comm -23 "${suspects}" "${ok}" >"${new_adhoc}"