From fba568a16e9c994591b298d4f0111ed003d9fdc3 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 29 Nov 2021 07:16:47 +0100 Subject: [PATCH] utils/checkpackagelib/lib_mk.py: check typo in define Check typo in define to detect SMAKE_LINUX_CONFIG_FIXUPS in smack (fixed by 41e2132fbe8a8fc237ca4a2cd2eff9bd9ced09a6) The new expression will catch "SMAKE_CONF_OPTS" as well as "define SMAKE_LINUX_CONFIG_FIXUPS" Two modifications were made: - add (define\s+)? which will match "define " but also an empty value. Thanks to this, the second group will always contain the variable name. - remove \s*(\+|)= which seems superfluous Also, add GCC_TARGET in ALLOWED variable to avoid the following warnings: arch/arch.mk:12: possible typo: GCC_TARGET_ARCH -> *ARCH* arch/arch.mk:13: possible typo: GCC_TARGET_ABI -> *ARCH* arch/arch.mk:14: possible typo: GCC_TARGET_NAN -> *ARCH* arch/arch.mk:15: possible typo: GCC_TARGET_FP32_MODE -> *ARCH* arch/arch.mk:16: possible typo: GCC_TARGET_CPU -> *ARCH* arch/arch.mk:17: possible typo: GCC_TARGET_FPU -> *ARCH* arch/arch.mk:18: possible typo: GCC_TARGET_FLOAT_ABI -> *ARCH* arch/arch.mk:19: possible typo: GCC_TARGET_MODE -> *ARCH* Reviewed-by: Ricardo Martincoski Signed-off-by: Fabrice Fontaine Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- utils/checkpackagelib/lib_mk.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py index 0278354434..95501e5515 100644 --- a/utils/checkpackagelib/lib_mk.py +++ b/utils/checkpackagelib/lib_mk.py @@ -230,6 +230,7 @@ class TypoInPackageVariable(_CheckFunction): "BR_CCACHE_INITIAL_SETUP", "BR_LIBC", "BR_NO_CHECK_HASH_FOR", + "GCC_TARGET", "LINUX_EXTENSIONS", "LINUX_POST_PATCH_HOOKS", "LINUX_TOOLS", @@ -242,7 +243,7 @@ class TypoInPackageVariable(_CheckFunction): "TARGET_FINALIZE_HOOKS", "TARGETS_ROOTFS", "XTENSA_CORE_NAME"])) - VARIABLE = re.compile(r"^([A-Z0-9_]+_[A-Z0-9_]+)\s*(\+|)=") + VARIABLE = re.compile(r"^(define\s+)?([A-Z0-9_]+_[A-Z0-9_]+)") def before(self): package, _ = os.path.splitext(os.path.basename(self.filename)) @@ -252,7 +253,7 @@ class TypoInPackageVariable(_CheckFunction): # linux extensions do not use LINUX_EXT_ prefix for variables package = package.replace("LINUX_EXT_", "") self.package = package - self.REGEX = re.compile(r"^(HOST_|ROOTFS_)?({}_[A-Z0-9_]+)".format(package)) + self.REGEX = re.compile(r"(HOST_|ROOTFS_)?({}_[A-Z0-9_]+)".format(package)) self.FIND_VIRTUAL = re.compile( r"^{}_PROVIDES\s*(\+|)=\s*(.*)".format(package)) self.virtual = [] @@ -262,7 +263,7 @@ class TypoInPackageVariable(_CheckFunction): if m is None: return - variable = m.group(1) + variable = m.group(2) # allow to set variables for virtual package this package provides v = self.FIND_VIRTUAL.search(text)