From patchwork Mon Feb 6 12:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmidt, Adriaan" X-Patchwork-Id: 2594 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 06 Feb 2023 13:21:34 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-lf1-f61.google.com (mail-lf1-f61.google.com [209.85.167.61]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 316CLXKg005214 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 6 Feb 2023 13:21:33 +0100 Received: by mail-lf1-f61.google.com with SMTP id g27-20020a0565123b9b00b004d861df2daesf4802709lfv.13; Mon, 06 Feb 2023 04:21:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675686088; cv=pass; d=google.com; s=arc-20160816; b=tgolp0jxQTJxlDKUM0DF13KEaNkWoXNqYXyUwHpu6T3ofQDeIho9fp41o/QWJ/ZwLm ibgB0gMd3N1hCV+wD8k30g8of5GP/gKzqyWmVF38IXqJakglU+Cl6wRJWwsDRDLAVlHD cUjEl0TN4jzh45S0U7+/TdgD+AgF7JHgjEn4vR79l76WP9kr+giCqtNdOVToP7nUBIoa VYyBER08VAai8Bkzqn4f7I+1AYcoJVK2ztsOutr/fDU6icTWltlqDiNT4C8KOsMJB2aG t8VGqEpqUEeGjtTxBiJvS9sasSh+A3+dfovMxVyP44HNKmZTg9KE6JiuvRmewrYXTRiy TV/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:feedback-id:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=Zzhsx/H0DasndWXNeNemghAQxNsAv9BwomY/vOEfX08=; b=02i1XfY4y9/lgpWTvaF3iM6+b1hnx1LTrtl5SDvFnDYV9Z3AQZVZA5ftNh7YskjjYi siyX9kkRdPMWzFm5F7ZD9qeq4zBQWgPTxI63LVNoLXs1K0H/A8+DS3S2318328qBuAE8 PwWwhhShhOrxOwjI2j334VjbWqIzbi+4PlzpGb00cSL5wl6lt/9QzPojxbwqi6mbTZay 0ln1q8o31jWeoO2tIZ4Xw5DoVto/euGm4F7BRYnX3Jw8W4o1UMmhsgjnuLBN8MVkGM/L 29lpnuw83bQ2o6ZHSNcxkC4mgVt9lLWVMUypHuDTKrldakdaSkVOu/sxY0nowIEX4HTH 5gDw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=Ymlkbh0a; spf=pass (google.com: domain of fm-526363-202302061221256fb1d31fc0e44c5971-dlvtfx@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-526363-202302061221256fb1d31fc0e44c5971-DlVTfx@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:feedback-id:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=Zzhsx/H0DasndWXNeNemghAQxNsAv9BwomY/vOEfX08=; b=HXt3mtD5dgBFBzw1ycIjD32SkdLydkoyfqB10uAtZiMi4pjfKYCx38rlRUJ7i/hFuw 7ox40ksOTvQXFlt7wOXk195RwZ+I/fH5NQ5InAySI16cm4N/1/tmU05svwhnu8Yxiymr GAwsANPMFzW0voeTHXjDvXKYnX3KFEmPDH0XKthwsgLmKFmbJzLsvcbp3olKTll2HhZY 2W5t0kJz72YTTF7VWbK2++NNae9xr+IPG45+3jkADz7XAtHzi2MH7j86/wXl9z3o+MaY J/Gw3YoQaZg04/CO8VkK8ka6u+DUI7wocG1NxAx4IzjKfKx++oYlCdbsHggAA6OVGeGY sBIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=Zzhsx/H0DasndWXNeNemghAQxNsAv9BwomY/vOEfX08=; b=eAArnI3np6lTGo9jf+7ZGb6sddMMc/ZDvp2JFCOkBJOIvJXL7BaYEDdks7aH7jLv2X Q5EYitfwfn/cocijxNAXu5XSkfKp3D6C8JYzQMkftIckidIFa+kej0a2o3iIVacjGar+ wrY60MIzbtr+Ii+E42Xsli798UQNPKgZ8RRsQVjpqmlXB5wunyPwvyuPNYy8CR4AMMAS OvxA+jMRBsOUo9R1QfQG1jwKaH2ShcPKfrCYY2SJlIUgZZw4ee3ot8qCgaihxcb5FXqL 0AmGz5eNAQELhJV7KkV2Fiww6ZYxSb3Zj+C3m4PVsUPROEQE+33/a3VzMAUk5j5eNv44 dlTg== Sender: isar-users@googlegroups.com X-Gm-Message-State: AO0yUKX6DS0dBkMPmmCpoFbcqvO1RyJ6sSsaTqiS5UybAcMtMenof9w+ ax/PocFnFVUhxNqbFWl7pMI= X-Google-Smtp-Source: AK7set/W7YtlH/HX6zDSitrSe/V+y7YQOh6C1wgiayhA68GZ0FLGp+asqYIqtUbg183UAXZl7QYoMQ== X-Received: by 2002:a2e:991a:0:b0:290:5823:cde1 with SMTP id v26-20020a2e991a000000b002905823cde1mr2689606lji.122.1675686087672; Mon, 06 Feb 2023 04:21:27 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:a991:0:b0:292:8017:11d9 with SMTP id x17-20020a2ea991000000b00292801711d9ls1095272ljq.7.-pod-prod-gmail; Mon, 06 Feb 2023 04:21:26 -0800 (PST) X-Received: by 2002:a2e:b895:0:b0:290:5fbe:d0a1 with SMTP id r21-20020a2eb895000000b002905fbed0a1mr6131485ljp.2.1675686086245; Mon, 06 Feb 2023 04:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675686086; cv=none; d=google.com; s=arc-20160816; b=AqEzmJbOQECpBRW+w8SoqRCViyq6E5CsfWaeo6XFgvQJGdbpIUj4ezpT4dTbA4gCcY mp0KLYh7SzoOK79LRkIyaGK7BHMEXhDB728KQgBQ8DlUi/HjpUaWVdL2X8/hTsbQ4p2f siORjtC9w8z8U8xAN/b8XMP8nHVmlMYK7Rlnj+rhm8lMHcH22qyIUnoWzT7yicAaL21z xXpN2Ttlackipe5dZDZU7KYX0DxjMcdiNGhxOSvC4MOX3RSyXVT6VEZ6T+d7ERBt5lx2 ynj8N+W592L93o0q1oQylNNopq6/omeRiEZmOFrVRGr905b5lHXFneoCliCYtdj0mgxu P62A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=B8IHSJ0JY4BDFHJ/2JjV/8+GlnbfnFWNraIRqb9z0JI=; b=EiGILtd9PjzUyaGD3DUMRsvQJTfYPE4xuyIiUjyoJhapFmd0w7XJnqxGFQFmoXyka+ Vvyy2xHkR17kq49DGz/YgEatWRZ4ysV2hVv3naXq3934QrX7GiAcEqqTdSrCaE46P5wU Qkz0b/kl8KQUMwbMK/hP9NGd/NuIca1dDytRx+wzrx2/ybBWCjV/MkH1H5eiOVTRbfAR t4hh6iCB0n2Y5Yk6ZYW8fXXY1qYgIJ4uujHy47h0bgqzgZL2njAJbc+szUnqiBGt9d/L kNcUqBKyNyOfqPlNT6fg41s8YHbSgnDpBf8OrcekS5jqPDxao3bGLr2lb5E3Z3ntSDpi +d7A== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=Ymlkbh0a; spf=pass (google.com: domain of fm-526363-202302061221256fb1d31fc0e44c5971-dlvtfx@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-526363-202302061221256fb1d31fc0e44c5971-DlVTfx@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net. [185.136.64.225]) by gmr-mx.google.com with ESMTPS id n23-20020a2e86d7000000b00286e157db47si521748ljj.6.2023.02.06.04.21.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2023 04:21:26 -0800 (PST) Received-SPF: pass (google.com: domain of fm-526363-202302061221256fb1d31fc0e44c5971-dlvtfx@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) client-ip=185.136.64.225; Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 202302061221256fb1d31fc0e44c5971 for ; Mon, 06 Feb 2023 13:21:25 +0100 From: Adriaan Schmidt To: isar-users@googlegroups.com Cc: jan.kiszka@siemens.com, Adriaan Schmidt Subject: [PATCH 2/3] add multiarch support Date: Mon, 6 Feb 2023 13:20:49 +0100 Message-Id: <20230206122050.337270-3-adriaan.schmidt@siemens.com> In-Reply-To: <20230206122050.337270-1-adriaan.schmidt@siemens.com> References: <20230206122050.337270-1-adriaan.schmidt@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-526363:519-21489:flowmailer X-Original-Sender: adriaan.schmidt@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=Ymlkbh0a; spf=pass (google.com: domain of fm-526363-202302061221256fb1d31fc0e44c5971-dlvtfx@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-526363-202302061221256fb1d31fc0e44c5971-DlVTfx@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= This adds support for building packages for native and compat architectures to dpdk-base.bbclass. Thus, all package recipes automatically have a *-native and *-compat target, which can be used in DEPENDS/RDEPENDS definitions. Additionally *-compat targets can be used in IMAGE_INSTALL, where they are automatically converted to install package:${COMPAT_DISTRO_ARCH}. Note that the switch ISAR_ENABLE_COMPAT_ARCH still exist and controls addition of the compat architecture during bootstrapping. Signed-off-by: Adriaan Schmidt Signed-off-by: Adriaan Schmidt Signed-off-by: Adriaan Schmidt --- .../recipes-app/samefile/samefile_2.14.bb | 2 +- meta/classes/compat.bbclass | 49 +++++++++++++++++++ meta/classes/debianize.bbclass | 2 +- meta/classes/dpkg-base.bbclass | 1 + meta/classes/image.bbclass | 4 +- meta/classes/multiarch.bbclass | 44 +++++++++++++++++ meta/classes/native.bbclass | 10 ++++ meta/conf/bitbake.conf | 1 + 8 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 meta/classes/compat.bbclass create mode 100644 meta/classes/multiarch.bbclass create mode 100644 meta/classes/native.bbclass diff --git a/meta-isar/recipes-app/samefile/samefile_2.14.bb b/meta-isar/recipes-app/samefile/samefile_2.14.bb index 5e36a2ac..c53c9445 100644 --- a/meta-isar/recipes-app/samefile/samefile_2.14.bb +++ b/meta-isar/recipes-app/samefile/samefile_2.14.bb @@ -21,7 +21,7 @@ do_prepare_build() { # deb_debianize. Pre-exisiting files will not be recreated, changelog # will be prepended unless its latest entry is for CHANGELOG_V. cat << EOF > ${WORKDIR}/changelog -${PN} (0.1) unstable; urgency=low +${BPN} (0.1) unstable; urgency=low * a long long time ago there was an early version diff --git a/meta/classes/compat.bbclass b/meta/classes/compat.bbclass new file mode 100644 index 00000000..7142ec3a --- /dev/null +++ b/meta/classes/compat.bbclass @@ -0,0 +1,49 @@ +# This software is a part of ISAR. +# Copyright (C) 2023 Siemens AG +# +# SPDX-License-Identifier: MIT + +# this class is "dual-use": it can be inherited (e.g., by bootstrap and image +# classes) to access variables and functions, and it's also addedd via BBCLASSEXTEND +# when inheriting multiconfig.bbclass. + +################################################################################ +# generic functions +################################################################################ + +# calcucate COMPAT_DISTRO_ARCH +# we can't use simple overrides, because in case we're building a package +# with a PACKAGE_ARCH != DISTRO_ARCH, overrides would find the wrong value. +python() { + distro_arch = d.getVar('DISTRO_ARCH') + compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH:' + distro_arch) + if compat_distro_arch is None and 'class-compat' in d.getVar('OVERRIDES').split(':'): + bb.fatal(f"{distro_arch} does not have a compat arch") + d.setVar('COMPAT_DISTRO_ARCH', compat_distro_arch) +} + +# function to convert bitbake targets to installable debian packages, +# e.g., "hello-compat" to "hello:i386". +def isar_compat_packages(var, d): + bb_targets = (d.getVar(var, True) or '').split() + packages = [] + compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH', True) + for t in bb_targets: + if t.endswith('-compat'): + packages.append(t[:-len('-compat')] + ':' + compat_distro_arch) + else: + packages.append(t) + return ' '.join(packages) + + +################################################################################ +# package recipe modifications when actually building *-compat: +################################################################################ + +# check that we can actually build compat (ISAR_ENABLE_COMPAT_ARCH is set) +python do_fetch:prepend:class-compat() { + if not d.getVar('ISAR_ENABLE_COMPAT_ARCH', True) == '1': + bb.fatal("compat package requested, but ISAR_ENABLE_COMPAT_ARCH is not set.") +} + +PACKAGE_ARCH:class-compat = "${COMPAT_DISTRO_ARCH}" diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass index a6694a00..1b98c02d 100644 --- a/meta/classes/debianize.bbclass +++ b/meta/classes/debianize.bbclass @@ -31,7 +31,7 @@ deb_add_changelog() { date=$(LANG=C date -R -d @${timestamp}) cat < ${S}/debian/changelog -${PN} (${changelog_v}) UNRELEASED; urgency=low +${BPN} (${changelog_v}) UNRELEASED; urgency=low * generated by Isar diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index ad28f7b3..55cc6655 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -5,6 +5,7 @@ # SPDX-License-Identifier: MIT inherit sbuild +inherit multiarch inherit debianize inherit terminal inherit repository diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 539ec51d..8d0dda30 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -79,9 +79,11 @@ image_do_mounts() { buildchroot_do_mounts } +inherit compat + ROOTFSDIR = "${IMAGE_ROOTFS}" ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache" -ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}" +ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_compat_packages('IMAGE_INSTALL', d)}" ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${MACHINE}" diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass new file mode 100644 index 00000000..5b280699 --- /dev/null +++ b/meta/classes/multiarch.bbclass @@ -0,0 +1,44 @@ +# This software is a part of ISAR. +# Copyright (C) 2021-2022 Siemens AG +# +# SPDX-License-Identifier: MIT + +BBCLASSEXTEND += "native compat" +BPN = "${PN}" + +python multiarch_virtclass_handler() { + def fixup_pn_in_vars(d): + vars = 'SRC_URI FILESPATH'.split() + for var in vars: + v = d.getVar(var, False) + if v is not None: + d.setVar(var, v.replace('${PN}', '${BPN}')) + + def fixup_depends(suffix, d): + vars = 'PROVIDES RPROVIDES DEPENDS RDEPENDS'.split() + for var in vars: + multiarch_var = [] + val = d.getVar(var, True) + if val is None: + continue + for v in val.split(): + if v.endswith('-compat') or v.endswith('-native'): + multiarch_var.append(v) + else: + multiarch_var.append(v + suffix) + d.setVar(var, ' '.join(multiarch_var)) + + pn = e.data.getVar('PN') + if pn.endswith('-compat'): + e.data.setVar('BPN', pn[:-len('-compat')]) + e.data.appendVar('OVERRIDES', ':class-compat') + fixup_pn_in_vars(e.data) + fixup_depends('-compat', e.data) + elif pn.endswith('-native'): + e.data.setVar('BPN', pn[:-len('-native')]) + e.data.appendVar('OVERRIDES', ':class-native') + fixup_pn_in_vars(e.data) + fixup_depends('-native', e.data) +} +addhandler multiarch_virtclass_handler +multiarch_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass new file mode 100644 index 00000000..ef20e8bc --- /dev/null +++ b/meta/classes/native.bbclass @@ -0,0 +1,10 @@ +# This software is a part of ISAR. +# Copyright (C) 2023 Siemens AG +# +# SPDX-License-Identifier: MIT + +################################################################################ +# package recipe modifications when actually building *-native: +################################################################################ + +PACKAGE_ARCH:class-native = "${HOST_ARCH}" diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index f1a9438e..f38bb447 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -81,6 +81,7 @@ QEMU_ARCH:riscv64 = "riscv64" # Codename of the repository created by the caching class DEBDISTRONAME ?= "isar" +NATIVELSBSTRING ?= "isarnative" # Strings used in sstate signature files TARGET_VENDOR = ""