[OE-core] [PATCH] bitbake.conf: fix suspicious comparison with ('' or 'custom')
Masahiro Yamada
masahiroy at kernel.org
Sun Dec 22 07:59:51 UTC 2019
I am not sure what is intended by the code:
d.getVar('TARGET_OS', d, 1) == ('' or 'custom')
This is equivalent to:
d.getVar('TARGET_OS', d, 1) == 'custom'
If the intended behavior is to take the second element of the array
when TARGET_OS is empty or 'custom', the correct code would be:
d.getVar('TARGET_OS', d, 1) == '' or
d.getVar('TARGET_OS', d, 1) == 'custom'
Or, more simply:
d.getVar('TARGET_OS', d, 1) in ('', 'custom')
I guess this is probably the intended behavior.
Signed-off-by: Masahiro Yamada <masahiroy at kernel.org>
---
meta/conf/bitbake.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index e75bbcece0..7dc446b9a4 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -129,7 +129,7 @@ SDKUSE_NLS ??= "yes"
TARGET_ARCH = "${TUNE_ARCH}"
TARGET_OS = "linux${LIBCEXTENSION}${ABIEXTENSION}"
TARGET_VENDOR = "-oe"
-TARGET_SYS = "${TARGET_ARCH}${TARGET_VENDOR}${@['-' + d.getVar('TARGET_OS'), ''][d.getVar('TARGET_OS') == ('' or 'custom')]}"
+TARGET_SYS = "${TARGET_ARCH}${TARGET_VENDOR}${@['-' + d.getVar('TARGET_OS'), ''][d.getVar('TARGET_OS') in ('', 'custom')]}"
TARGET_PREFIX = "${TARGET_SYS}-"
TARGET_CC_ARCH = "${TUNE_CCARGS}"
TARGET_LD_ARCH = "${TUNE_LDARGS}"
@@ -138,7 +138,7 @@ TARGET_AS_ARCH = "${TUNE_ASARGS}"
SDKMACHINE ??= "x86_64"
SDK_OS = "${BUILD_OS}"
SDK_VENDOR = "-oesdk"
-SDK_SYS = "${SDK_ARCH}${SDK_VENDOR}${@['-' + d.getVar('SDK_OS'), ''][d.getVar('SDK_OS') == ('' or 'custom')]}"
+SDK_SYS = "${SDK_ARCH}${SDK_VENDOR}${@['-' + d.getVar('SDK_OS'), ''][d.getVar('SDK_OS') in ('', 'custom')]}"
SDK_PREFIX = "${SDK_SYS}-"
SDK_CC_ARCH = "${BUILD_CC_ARCH}"
SDKPKGSUFFIX = "nativesdk"
--
2.17.1
More information about the Openembedded-core
mailing list