@@ -20,7 +20,4 @@ SRC_URI = " \
file://yet-another-change.txt;apply=yes;striplevel=0"
SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
-# NOTE: This is just to test 32-bit building on 64-bit archs.
-PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
-
inherit dpkg
@@ -13,7 +13,4 @@ PV = "0.1-98f2e41"
SRC_URI = "git://github.com/ilbers/libhello.git;protocol=https;branch=master;destsuffix=${P}"
SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
-# NOTE: This is just to test 32-bit building on 64-bit archs.
-PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
-
inherit dpkg
@@ -7,6 +7,15 @@ BBCLASSEXTEND += "native compat"
BPN = "${PN}"
python multiarch_virtclass_handler() {
+ # In compat/native builds, ${PN} includes the -compat/-native suffix,
+ # so recipe-writers need to be careful when using it. Most of the time,
+ # they probably want to use ${BPN}, and in general, it's their responsibility
+ # to do so. If they don't, then it's ok for the build of the compat/native
+ # variant to fail. However, some variables are evaluated at parse time,
+ # and this will break the recipe even when compat/native is not requested.
+ # e.g., SRC_URI="file://${PN}" will try to checksum the local file at
+ # parse time, and parsing always happens for all build variants. So in those
+ # few variables, we automatically replace ${PN} with ${BPN}.
def fixup_pn_in_vars(d):
vars = 'SRC_URI FILESPATH'.split()
for var in vars:
@@ -14,6 +23,8 @@ python multiarch_virtclass_handler() {
if v is not None:
d.setVar(var, v.replace('${PN}', '${BPN}'))
+ # When building compat/native, the corresponding suffix needs to be
+ # propagated to all bitbake dependency definitions.
def fixup_depends(suffix, d):
vars = 'PROVIDES RPROVIDES DEPENDS RDEPENDS'.split()
for var in vars:
@@ -67,9 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
KERNEL_FILE:riscv64 ?= "vmlinux"
KERNEL_FILE:arm64 ?= "vmlinux"
-OVERRIDES = "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
+OVERRIDES = "${PACKAGE_ARCH}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
-COMPAT_OVERRIDE = "${@'compat-arch' if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1' else ''}"
# Setting default QEMU_ARCH variables for different DISTRO_ARCH:
QEMU_ARCH:amd64 = "x86_64"
@@ -274,6 +274,8 @@ do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config"
do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}"
+inherit compat
+
do_bootstrap() {
if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
PV = "1.0"
inherit rootfs
+inherit compat
python() {
distro_gcc = d.getVar('DISTRO_GCC')
@@ -20,18 +21,19 @@ python() {
d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
' libstdc++-{}-dev:{}'.format(distro_gcc, distro_arch))
- if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
- compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
+ if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
+ compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
+ d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+ ' libc6-dev:{}'.format(compat_arch))
+ d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+ ' crossbuild-essential-{}'.format(compat_arch))
+ if d.getVar('DISTRO_GCC'):
d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
' libgcc-{}-dev:{}'.format(distro_gcc, compat_arch))
d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
' libstdc++-{}-dev:{}'.format(distro_gcc, compat_arch))
}
-SBUILD_CHROOT_COMPAT_PREINSTALL:compat-arch = " \
- libc6-dev:${COMPAT_DISTRO_ARCH} \
- crossbuild-essential-${COMPAT_DISTRO_ARCH}"
-
SBUILD_CHROOT_PREINSTALL_COMMON = " \
${SBUILD_CHROOT_COMPAT_PREINSTALL} \
libc6-dev:${DISTRO_ARCH} \
@@ -96,7 +96,9 @@ class CIBuilder(Test):
with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
if compat_arch:
f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
+ f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-compat"\n')
f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
+ f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-compat"\n')
f.write('IMAGE_INSTALL += "kselftest"\n')
if cross:
f.write('ISAR_CROSS_COMPILE = "1"\n')
The compat-arch override is no longer needed, as PACKAGE_ARCH is controlled by DEPENDing on <package>-compat. Also change the compat test: adding the compat package now happens via IMAGE_INSTALL in the config. Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com> --- meta-isar/recipes-app/hello-isar/hello-isar.bb | 3 --- meta-isar/recipes-app/libhello/libhello.bb | 3 --- meta/classes/multiarch.bbclass | 11 +++++++++++ meta/conf/bitbake.conf | 3 +-- .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++ .../sbuild-chroot/sbuild-chroot.inc | 14 ++++++++------ testsuite/cibuilder.py | 2 ++ 7 files changed, 24 insertions(+), 14 deletions(-)