[1/1] refactor: use to_boolean when comparing boolean vars

Message ID 20240221093354.67929-1-felix.moessbauer@siemens.com
State Accepted, archived
Headers show
Series [1/1] refactor: use to_boolean when comparing boolean vars | expand

Commit Message

MOESSBAUER, Felix Feb. 21, 2024, 9:33 a.m. UTC
When comparing user-defined boolean variables (e.g. ENABLE_<FOO>),
a comparison against the string "0" or "1" is error-prone, as the user
might use other strings which also denote True / False. For that,
bitbake offers the bb.utils.to_boolean function.

This patch refactors all these patterns which are in scope of ISAR.
The parts which are copied from OE are not touched, as well as the WIC
plugins.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/recipes-app/hello/hello.bb                        | 2 +-
 meta/classes/base.bbclass                                   | 6 +++---
 meta/classes/compat.bbclass                                 | 2 +-
 meta/classes/crossvars.bbclass                              | 4 ++--
 meta/classes/dpkg-base.bbclass                              | 6 +++---
 meta/classes/imagetypes_container.bbclass                   | 2 +-
 meta/classes/imagetypes_wic.bbclass                         | 4 ++--
 meta/classes/multiarch.bbclass                              | 2 +-
 meta/classes/patch.bbclass                                  | 4 ++--
 meta/classes/sdk.bbclass                                    | 6 +++---
 meta/conf/bitbake.conf                                      | 2 +-
 meta/recipes-bsp/u-boot/u-boot-custom.inc                   | 4 ++--
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc         | 6 +++---
 meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb | 2 +-
 meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc       | 4 ++--
 meta/recipes-kernel/kselftest/kselftest.inc                 | 2 +-
 meta/recipes-kernel/linux/linux-custom.inc                  | 2 +-
 17 files changed, 30 insertions(+), 30 deletions(-)

Comments

Uladzimir Bely March 11, 2024, 12:09 p.m. UTC | #1
On Wed, 2024-02-21 at 10:33 +0100, 'Felix Moessbauer' via isar-users
wrote:
> When comparing user-defined boolean variables (e.g. ENABLE_<FOO>),
> a comparison against the string "0" or "1" is error-prone, as the
> user
> might use other strings which also denote True / False. For that,
> bitbake offers the bb.utils.to_boolean function.
> 
> This patch refactors all these patterns which are in scope of ISAR.
> The parts which are copied from OE are not touched, as well as the
> WIC
> plugins.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta-isar/recipes-app/hello/hello.bb                        | 2 +-
>  meta/classes/base.bbclass                                   | 6 +++-
> --
>  meta/classes/compat.bbclass                                 | 2 +-
>  meta/classes/crossvars.bbclass                              | 4 ++--
>  meta/classes/dpkg-base.bbclass                              | 6 +++-
> --
>  meta/classes/imagetypes_container.bbclass                   | 2 +-
>  meta/classes/imagetypes_wic.bbclass                         | 4 ++--
>  meta/classes/multiarch.bbclass                              | 2 +-
>  meta/classes/patch.bbclass                                  | 4 ++--
>  meta/classes/sdk.bbclass                                    | 6 +++-
> --
>  meta/conf/bitbake.conf                                      | 2 +-
>  meta/recipes-bsp/u-boot/u-boot-custom.inc                   | 4 ++--
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc         | 6 +++-
> --
>  meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb | 2 +-
>  meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc       | 4 ++--
>  meta/recipes-kernel/kselftest/kselftest.inc                 | 2 +-
>  meta/recipes-kernel/linux/linux-custom.inc                  | 2 +-
>  17 files changed, 30 insertions(+), 30 deletions(-)

Applied to next, thanks.

Patch

diff --git a/meta-isar/recipes-app/hello/hello.bb b/meta-isar/recipes-app/hello/hello.bb
index acf8ed73..6efb50de 100644
--- a/meta-isar/recipes-app/hello/hello.bb
+++ b/meta-isar/recipes-app/hello/hello.bb
@@ -15,7 +15,7 @@  SRC_URI = "apt://${PN}"
 MAINTAINER = "isar-users <isar-users@googlegroups.com>"
 CHANGELOG_V = "<orig-version>+isar"
 
-DEB_BUILD_OPTIONS += "${@ 'nocheck' if d.getVar('ISAR_CROSS_COMPILE') == '1' else '' }"
+DEB_BUILD_OPTIONS += "${@ 'nocheck' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) else '' }"
 
 do_prepare_build() {
 	deb_add_changelog
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 88004120..529811af 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -181,7 +181,7 @@  def isar_export_proxies(d):
     variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
                     'ftp_proxy', 'FTP_PROXY' ]
 
-    if d.getVar('BB_NO_NETWORK') == "1":
+    if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')):
         for v in variables:
             d.setVar(v, deadend_proxy)
         for v in [ 'no_proxy', 'NO_PROXY' ]:
@@ -190,10 +190,10 @@  def isar_export_proxies(d):
     return bb.utils.export_proxies(d)
 
 def isar_export_ccache(d):
-    if d.getVar('USE_CCACHE') == '1':
+    if bb.utils.to_boolean(d.getVar('USE_CCACHE')):
         os.environ['CCACHE_DIR'] = '/ccache'
         os.environ['PATH_PREPEND'] = '/usr/lib/ccache'
-        if d.getVar('CCACHE_DEBUG') == '1':
+        if bb.utils.to_boolean(d.getVar('CCACHE_DEBUG')):
             os.environ['CCACHE_DEBUG'] = '1'
             os.environ['CCACHE_DEBUGDIR'] = '/ccache/debug'
     else:
diff --git a/meta/classes/compat.bbclass b/meta/classes/compat.bbclass
index f0a23b6b..907c3ce2 100644
--- a/meta/classes/compat.bbclass
+++ b/meta/classes/compat.bbclass
@@ -31,7 +31,7 @@  python() {
 
 def isar_can_build_compat(d):
     return (d.getVar('COMPAT_DISTRO_ARCH') is not None and
-        d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1')
+        bb.utils.to_boolean(d.getVar('ISAR_ENABLE_COMPAT_ARCH')))
 
 ################################################################################
 # package recipe modifications when building *-compat:
diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 828afe46..00326c9a 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -9,7 +9,7 @@  python __anonymous() {
     import pwd
     d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
 
-    mode = d.getVar('ISAR_CROSS_COMPILE')
+    mode = bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE'))
 
     # support derived schroots
     flavor = d.getVar('SBUILD_FLAVOR')
@@ -22,7 +22,7 @@  python __anonymous() {
 
     if distro_arch != host_arch and \
         (package_arch == host_arch or \
-         (package_arch in [distro_arch, compat_arch, '${BUILD_ARCH}'] and mode == "1")):
+         (package_arch in [distro_arch, compat_arch, '${BUILD_ARCH}'] and mode)):
         d.setVar('BUILD_ARCH', host_arch)
         schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
         sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index a8263046..43ff0d85 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -15,7 +15,7 @@  inherit essential
 DEPENDS ?= ""
 RPROVIDES ?= "${PROVIDES}"
 
-DEPENDS:append:riscv64 = "${@' crossbuild-essential-riscv64' if d.getVar('ISAR_CROSS_COMPILE') == '1' and d.getVar('PN') != 'crossbuild-essential-riscv64' else ''}"
+DEPENDS:append:riscv64 = "${@' crossbuild-essential-riscv64' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) and d.getVar('PN') != 'crossbuild-essential-riscv64' else ''}"
 DEB_BUILD_PROFILES ?= ""
 DEB_BUILD_OPTIONS ?= ""
 
@@ -218,7 +218,7 @@  dpkg_runbuild() {
 
 def isar_deb_build_profiles(d):
     deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
-    if d.getVar('ISAR_CROSS_COMPILE') == "1":
+    if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')):
         deb_build_profiles += ' cross'
     return deb_build_profiles.strip()
 
@@ -313,7 +313,7 @@  python do_devshell() {
     isar_export_proxies(d)
     isar_export_ccache(d)
     isar_export_build_settings(d)
-    if d.getVar('USE_CCACHE') == '1':
+    if bb.utils.to_boolean(d.getVar('USE_CCACHE')):
         bb.build.exec_func('schroot_configure_ccache', d)
 
     schroot = d.getVar('SBUILD_CHROOT')
diff --git a/meta/classes/imagetypes_container.bbclass b/meta/classes/imagetypes_container.bbclass
index c2e84809..7c44350c 100644
--- a/meta/classes/imagetypes_container.bbclass
+++ b/meta/classes/imagetypes_container.bbclass
@@ -13,7 +13,7 @@  CONTAINER_IMAGE_NAME ?= "${PN}-${DISTRO}-${DISTRO_ARCH}"
 CONTAINER_IMAGE_TAG ?= "${PV}-${PR}"
 
 python() {
-    if not d.getVar('USING_CONTAINER') == '1':
+    if not bb.utils.to_boolean(d.getVar('USING_CONTAINER')):
         return
     for t in d.getVar('CONTAINER_TYPES').split():
         t_clean = t.replace('-', '_').replace('.', '_')
diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 4c74f166..bce881ed 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -5,7 +5,7 @@ 
 #
 
 USING_WIC = "${@bb.utils.contains('IMAGE_BASETYPES', 'wic', '1', '0', d)}"
-WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if d.getVar('USING_WIC') == '1' else ''}"
+WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if bb.utils.to_boolean(d.getVar('USING_WIC')) else ''}"
 
 WKS_FILE ??= "sdimage-efi"
 
@@ -16,7 +16,7 @@  do_copy_wks_template () {
 }
 
 python () {
-    if not d.getVar('USING_WIC') == '1':
+    if not bb.utils.to_boolean(d.getVar('USING_WIC')):
         return
 
     if d.getVar('WIC_IMAGER_INSTALL'):
diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
index 48cec9ab..f82e2502 100644
--- a/meta/classes/multiarch.bbclass
+++ b/meta/classes/multiarch.bbclass
@@ -26,7 +26,7 @@  python() {
     # and not for the builder architecture
     depends = d.getVar('DEPENDS')
     if depends is not None and d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') \
-       and d.getVar('ISAR_CROSS_COMPILE') != '1':
+       and not bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')):
         new_deps = []
         for dep in depends.split():
             if dep.endswith('-native'):
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 2337693d..1fa9b1aa 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -16,7 +16,7 @@  PATCH_GIT_USER_EMAIL ?= "isar.patch@isar"
 inherit terminal
 
 python () {
-    if d.getVar('PATCHTOOL') == 'git' and d.getVar('PATCH_COMMIT_FUNCTIONS') == '1':
+    if d.getVar('PATCHTOOL') == 'git' and bb.utils.to_boolean(d.getVar('PATCH_COMMIT_FUNCTIONS')):
         extratasks = bb.build.tasksbetween('do_unpack', 'do_patch', d)
         try:
             extratasks.remove('do_unpack')
@@ -65,7 +65,7 @@  python patch_task_postfunc() {
 
     if os.path.exists(srcsubdir):
         if func == 'do_patch':
-            haspatches = (d.getVar('PATCH_HAS_PATCHES_DIR') == '1')
+            haspatches = bb.utils.to_boolean(d.getVar('PATCH_HAS_PATCHES_DIR'))
             patchdir = os.path.join(srcsubdir, 'patches')
             if os.path.exists(patchdir):
                 shutil.rmtree(patchdir)
diff --git a/meta/classes/sdk.bbclass b/meta/classes/sdk.bbclass
index 52c3bec5..74c0acb9 100644
--- a/meta/classes/sdk.bbclass
+++ b/meta/classes/sdk.bbclass
@@ -57,7 +57,7 @@  TAR_TRANSFORM:class-sdk = " --transform='s|rootfs|${IMAGE_FULLNAME}|'"
 
 # bitbake dependencies
 SDKDEPENDS += "sdk-files ${SDK_INSTALL}"
-SDKDEPENDS:append:riscv64 = "${@' crossbuild-essential-riscv64' if d.getVar('ISAR_CROSS_COMPILE') == '1' and d.getVar('PN') != 'crossbuild-essential-riscv64' else ''}"
+SDKDEPENDS:append:riscv64 = "${@' crossbuild-essential-riscv64' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) and d.getVar('PN') != 'crossbuild-essential-riscv64' else ''}"
 DEPENDS:class-sdk = "${SDKDEPENDS}"
 
 SDKROOTFSDEPENDS = ""
@@ -68,10 +68,10 @@  SDKROOTFSVARDEPS = ""
 SDKROOTFSVARDEPS:class-sdk = "SDK_INCLUDE_ISAR_APT"
 do_rootfs_install[vardeps] += "${SDKROOTFSVARDEPS}"
 
-ROOTFS_POSTPROCESS_COMMAND:remove = "${@'rootfs_cleanup_isar_apt' if d.getVar('SDK_INCLUDE_ISAR_APT') == '1' else ''}"
+ROOTFS_POSTPROCESS_COMMAND:remove = "${@'rootfs_cleanup_isar_apt' if bb.utils.to_boolean(d.getVar('SDK_INCLUDE_ISAR_APT')) else ''}"
 
 # additional SDK steps
-ROOTFS_CONFIGURE_COMMAND:append:class-sdk = " ${@'rootfs_configure_isar_apt_dir' if d.getVar('SDK_INCLUDE_ISAR_APT') == '1' else ''}"
+ROOTFS_CONFIGURE_COMMAND:append:class-sdk = " ${@'rootfs_configure_isar_apt_dir' if bb.utils.to_boolean(d.getVar('SDK_INCLUDE_ISAR_APT')) else ''}"
 rootfs_configure_isar_apt_dir() {
     # Copy isar-apt instead of mounting:
     sudo cp -Trpfx --reflink=auto ${REPO_ISAR_DIR}/${DISTRO} ${ROOTFSDIR}/isar-apt
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 80dc01c7..91c5c815 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -158,7 +158,7 @@  INHERIT += "isar-events sstate"
 
 # Buildstats requires IMAGE_ROOTFS to be always defined
 IMAGE_ROOTFS ??= "${WORKDIR}/rootfs"
-INHERIT += "${@'buildstats' if d.getVar('USE_BUILDSTATS') == '1' else ''}"
+INHERIT += "${@'buildstats' if bb.utils.to_boolean(d.getVar('USE_BUILDSTATS')) else ''}"
 
 # Default values for ccache
 USE_CCACHE ??= "0"
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
index f16906ce..25f0e1ef 100644
--- a/meta/recipes-bsp/u-boot/u-boot-custom.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -10,9 +10,9 @@  FILESPATH:append := ":${FILE_DIRNAME}/files"
 DESCRIPTION ?= "Custom U-Boot"
 
 PROVIDES += "u-boot-${MACHINE} u-boot-${MACHINE}-dev"
-PROVIDES += "${@'u-boot-tools' if d.getVar('U_BOOT_TOOLS_PACKAGE') == '1' else ''}"
+PROVIDES += "${@'u-boot-tools' if bb.utils.to_boolean(d.getVar('U_BOOT_TOOLS_PACKAGE')) else ''}"
 PROVIDES += "${@('u-boot-config u-boot-' + d.getVar('MACHINE') + '-config') \
-    if d.getVar('U_BOOT_CONFIG_PACKAGE') == '1' else ''}"
+    if bb.utils.to_boolean(d.getVar('U_BOOT_CONFIG_PACKAGE')) else ''}"
 
 inherit dpkg
 
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 3477c2fb..4b69332e 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -26,9 +26,9 @@  DEPLOY_ISAR_BOOTSTRAP ?= ""
 DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
 DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg"
 DISTRO_BOOTSTRAP_BASE_PACKAGES:append:https-support = ",ca-certificates"
-DISTRO_VARS_PREFIX ?= "${@'HOST_' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else ''}"
-BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'DISTRO')}"
-BOOTSTRAP_BASE_DISTRO = "${@d.getVar('HOST_BASE_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'BASE_DISTRO')}"
+DISTRO_VARS_PREFIX ?= "${@'HOST_' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else ''}"
+BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else 'DISTRO')}"
+BOOTSTRAP_BASE_DISTRO = "${@d.getVar('HOST_BASE_DISTRO' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else 'BASE_DISTRO')}"
 FILESEXTRAPATHS:append = ":${BBPATH}"
 
 inherit deb-dl-dir
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
index ce985df2..1d1bcc5f 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
@@ -11,5 +11,5 @@  require sbuild-chroot.inc
 
 SBUILD_CHROOT_PREINSTALL ?= " \
     ${SBUILD_CHROOT_PREINSTALL_COMMON} \
-    ${@' apt-utils' if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1' else ''} \
+    ${@' apt-utils' if bb.utils.to_boolean(d.getVar('ISAR_ENABLE_COMPAT_ARCH')) else ''} \
     "
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index 2f07de82..d794c6fd 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -27,7 +27,7 @@  python() {
         d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
                     ' libstdc++-{}-dev:{}'.format(distro_gcc, distro_arch))
 
-    if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
+    if bb.utils.to_boolean(d.getVar('ISAR_ENABLE_COMPAT_ARCH')):
         compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
         d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
                     ' libc6-dev:{}'.format(compat_arch))
@@ -47,7 +47,7 @@  SBUILD_CHROOT_PREINSTALL_COMMON = " \
     fakeroot \
     build-essential \
     debhelper \
-    ${@ 'ccache' if d.getVar('USE_CCACHE') == '1' else ''} \
+    ${@ 'ccache' if bb.utils.to_boolean(d.getVar('USE_CCACHE')) else ''} \
     devscripts \
     equivs \
 "
diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc
index 8e961e72..6196f825 100644
--- a/meta/recipes-kernel/kselftest/kselftest.inc
+++ b/meta/recipes-kernel/kselftest/kselftest.inc
@@ -44,7 +44,7 @@  KSELFTEST_SKIP_TARGETS ?= ""
 KSELFTEST_FORCE_TARGETS ?= "0"
 
 KSELFTEST_ARGS = "${@ "TARGETS=\"${KSELFTEST_TARGETS}\"" if d.getVar('KSELFTEST_TARGETS') else ''}"
-KSELFTEST_ARGS .= "${@ " FORCE_TARGETS=1" if d.getVar('KSELFTEST_FORCE_TARGETS') == '1' else ''}"
+KSELFTEST_ARGS .= "${@ " FORCE_TARGETS=1" if bb.utils.to_boolean(d.getVar('KSELFTEST_FORCE_TARGETS')) else ''}"
 KSELFTEST_ARGS .= "${@ " SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" if d.getVar('KSELFTEST_SKIP_TARGETS') else ''}"
 
 do_prepare_build[cleandirs] += "${S}/debian"
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 876397c3..91e9b5ff 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -139,7 +139,7 @@  def config_fragments(d):
 
 def get_additional_build_profiles(d):
     profiles = d.getVar('BASE_DISTRO')
-    if d.getVar('KERNEL_LIBC_DEV_DEPLOY') != '1':
+    if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
         profiles += ' nolibcdev'
     return profiles