diff mbox series

[meta-rockchip] bsp: rkbin: fix default COMPATIBLE_MACHINE matching all

Message ID 20231016112110.220599-1-foss+yocto@0leil.net
State New
Headers show
Series [meta-rockchip] bsp: rkbin: fix default COMPATIBLE_MACHINE matching all | expand

Commit Message

Quentin Schulz Oct. 16, 2023, 11:21 a.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

The goal of the default COMPATIBLE_MACHINE was to not allow
rockchip-rkbin to be even parsed if a MACHINE isn't part of the
COMPATIBLE_MACHINE.

However, COMPATIBLE_MACHINE is a regexp checked using Python's re module
approximately like:
"""
if re.match(COMPATIBLE_MACHINE, MACHINE):
	return True
"""

and re.match() returns a match whatever MACHINE is if COMPATIBLE_MACHINE
is the empty string.

Therefore, let's change it to `^$` which only matches the empty string,
which shouldn't be possible for anything in MACHINEOVERRIDES, and if it
is there are probably bigger problems than parsing rockchip-rkbin.

Fixes: f8af59dd7cd7 ("rock-5b: add")
Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 recipes-bsp/rkbin/rockchip-rkbin_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Trevor Woerner Oct. 25, 2023, 1:42 p.m. UTC | #1
On Mon 2023-10-16 @ 01:21:10 PM, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> The goal of the default COMPATIBLE_MACHINE was to not allow
> rockchip-rkbin to be even parsed if a MACHINE isn't part of the
> COMPATIBLE_MACHINE.
> 
> However, COMPATIBLE_MACHINE is a regexp checked using Python's re module
> approximately like:
> """
> if re.match(COMPATIBLE_MACHINE, MACHINE):
> 	return True
> """
> 
> and re.match() returns a match whatever MACHINE is if COMPATIBLE_MACHINE
> is the empty string.
> 
> Therefore, let's change it to `^$` which only matches the empty string,
> which shouldn't be possible for anything in MACHINEOVERRIDES, and if it
> is there are probably bigger problems than parsing rockchip-rkbin.
> 
> Fixes: f8af59dd7cd7 ("rock-5b: add")
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  recipes-bsp/rkbin/rockchip-rkbin_git.bb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to meta-rockchip, master branch. Thanks!
diff mbox series

Patch

diff --git a/recipes-bsp/rkbin/rockchip-rkbin_git.bb b/recipes-bsp/rkbin/rockchip-rkbin_git.bb
index 7fefb01..f9e680d 100644
--- a/recipes-bsp/rkbin/rockchip-rkbin_git.bb
+++ b/recipes-bsp/rkbin/rockchip-rkbin_git.bb
@@ -12,7 +12,7 @@  inherit bin_package deploy
 
 S = "${WORKDIR}/git"
 
-COMPATIBLE_MACHINE = ""
+COMPATIBLE_MACHINE = "^$"
 COMPATIBLE_MACHINE:rk3588s = "rk3588s"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"