From patchwork Mon Feb 20 09:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmidt, Adriaan" X-Patchwork-Id: 2664 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 20 Feb 2023 10:05:27 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-wm1-f58.google.com (mail-wm1-f58.google.com [209.85.128.58]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 31K95QtB001946 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Feb 2023 10:05:26 +0100 Received: by mail-wm1-f58.google.com with SMTP id j6-20020a05600c1c0600b003e1f2de4b2bsf330045wms.6; Mon, 20 Feb 2023 01:05:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676883921; cv=pass; d=google.com; s=arc-20160816; b=Mghk3fgRVUi+16+l2niB1t2I6RjMQn3DjC+7oEJPNZOwook1Ygdj+G80sroahK9PXy hpPmF/8gaGS4VR2zKsNt/mg1UFvS8e+LBNBxZnh04gzeBAbSs87ZdGULZr8D4QJKOb5D eFrwpvCBXqYFQKHWkMbBcSMmyBRqhIxZei+mN2rG60hpD74nxA1PDHAwnJC5atSj4E/c HvLqQS0i0JNePls+SUML7ZZm3axMAGi0l6kyAJbhSlcxjWDFx2MtiFyoK9pzGdQsscBR rAoQik3juH44+sjWWcUtw62YZBlRICUw/c8vTQmfvoTxMr7xWJ8O455AsuprazYoOIuU hOHA== 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=PJ/k9WV9W34+JJS74EAQkxXYc78xV/reOG1fs8QCx/Q=; b=HBH6jAZt3QHtHii5CxhTusFsnqqOyRYZuhMMjC1WHVTSxwtwcQUqs3z+0ZXfu0A3ee /0LHzVDYIgLQ6Beo4AkvzXjakFnqAhuSKrK6rLUTVJDApQmQlY8S574vLB5jPq8TpY0D 9Bvibw0Lhxrw/YHmYjp5PKQPTQDCbRCxR+mAXZUPGs85/VO0mWu9HopOsjUro1rgGFRm pJwufWNE8MKGT4q5zNBc7M1RK3owVJWvOo5N7oTIMoDqHhoIsfbEkOIdtWCP5OqbQOW/ 60afC/aXRo6vBYb7qTD5eDOS9IFRPPpr7cV7vNYrydQ48U9te+aNpzN+AofHHlUNvjhf +PnQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fANG+0ac; spf=pass (google.com: domain of fm-526363-202302200905194114eb3961370fa1fb-gdacql@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-526363-202302200905194114eb3961370fa1fb-GDacQL@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=PJ/k9WV9W34+JJS74EAQkxXYc78xV/reOG1fs8QCx/Q=; b=Odf7PLDy48vYZ0Ld5813118C+wyIdHqtK32Gw82ol7ixBMvAIDJQWE8tDHEzgjt4yB RjWN3slup2cTZC1jBXY4oL5QoIchVkVwZh11lMHWmTwb8Vut9vRvYftMIj/YF3SIA0eV 7t16z/VXkHTfibVyHv+XXjeSzuaZ7GDAp0uD1var6e6uRw4JD8oxrrk6x9Agna07oIpy 4Wr3TtDNEgmATQdPeDMK0yCbUlwYt1+E1hBsMhFshEr3wpxOhLG/YfnW7vDRp84dsGzS jibts0mIy6KwouXLrQHBz78WUb1WVcsQQbsUxh9ZoUUlRly0mx2ZRDlbQW4+EskuqbfN +Z8w== 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=PJ/k9WV9W34+JJS74EAQkxXYc78xV/reOG1fs8QCx/Q=; b=BkYKVdcR5KJP09XiWwjp/2TQlEb18zn8EnDRNVXj1QtQ5xn9JEVzkLMishgGM2YVFq dE/JrZrVTFJjdsORu6aLmAoOyxwLr6qGBRmVPdStr37lXFVImZ5vl3ORfXxU/9Npuv8Z N0BQIXWyAq2pF9Eo9KY2j1HIBDpPYa3CM9Qsr5TYzVU8waB++JenQ/sEev1s++AMimNQ E+rjF+8DHdLe3o6YRW6LStuiwAc/ir+Ac7UDR9qdlamtUESWi+yyFJ7Az1+mZ+iROA+M RdOeuTxl13/+7J1OnzITrWjohEaRpW7fTKS9fJDj4DW9PciR6pulR2SCITPd+rqhGQG6 Jglg== Sender: isar-users@googlegroups.com X-Gm-Message-State: AO0yUKUze9zwy31t/+IeCoDi75cC3ey0pJkh6cuAeDjbfvkMPcnZc1AF jElhceNXd7pqNnK4lyjpqPw= X-Google-Smtp-Source: AK7set+JMgbIkXYDaJDktlMUYfeDZX9/dcNxk7iZVOqInR44CFLozlTQ9qCZyvRNvA2NNJrCuHn1Cg== X-Received: by 2002:a05:6000:10e:b0:2c5:58a8:1a89 with SMTP id o14-20020a056000010e00b002c558a81a89mr134050wrx.431.1676883921007; Mon, 20 Feb 2023 01:05:21 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:319b:b0:3dc:5674:6707 with SMTP id s27-20020a05600c319b00b003dc56746707ls272478wmp.2.-pod-canary-gmail; Mon, 20 Feb 2023 01:05:19 -0800 (PST) X-Received: by 2002:a05:600c:43d5:b0:3e2:1d1e:78d0 with SMTP id f21-20020a05600c43d500b003e21d1e78d0mr9061389wmn.22.1676883919551; Mon, 20 Feb 2023 01:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676883919; cv=none; d=google.com; s=arc-20160816; b=AWEYLsm7clbNB7SiMiIntdMkwfY9c60JoMBaKxJ017I0TP0LVoO3T7SbykXrUEH3u7 mSuKoAF+yI7EvsOMv2U5OV/FFpFtfaQv3WuHeT2Bk+of6c0ZeadYdvPD/QzIn4KQeMT3 JtQGTkVhTykqE5tzjsCIoLwm9TBg5N62aM+IkwQczhNuVBExBpve2lqQ7JaUiGwmUKEG Y9jaPIoegBqRjAFTZpKvHp09o0LhvKM2B0RcnBwEYgfcNgwOXomft5apAekCxSA4IDn9 PJD3nUWueYsGvPW1IIvOsBgYfJhN/uiGBwJhTfZOx64VcARanXpx4oe8TNmU2EsTj25M +HEw== 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=31bRiUtkKXRvB8K7qbY7rGTzs1HXPvrc+swbiqjGD4s=; b=pWenF+/gVEWEz+ZnfglUuBr5dkI66Bq2WTM0J+QxtN62RqArb1iS6pt0qCoBCCCL0I J5aU/BPo1QjfU884RCAros7trn0IZmbGDI8YQuM8JQ75ausjyMNb4Wu0UVLGgpTFG5Za hnA5zEDJjsUZ0E0oQd8whWhiNoQX7ldje8JOovW8PSKBOgAlba2PxXt6TEdD/NTqVB5A aC4qIuLPYk99cA41oqs9Uwe51YauzcGAtBVa6xyznisk6i+z2BqVkdMHbptWLVzyoj2X ELXS30ySGGQUEol9Y0cTvq/rz8ywN701CTuXjOuHdGy0ZY1exWMeCbrxtZmbdbZG2Utr pUEw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fANG+0ac; spf=pass (google.com: domain of fm-526363-202302200905194114eb3961370fa1fb-gdacql@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-526363-202302200905194114eb3961370fa1fb-GDacQL@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net. [185.136.65.225]) by gmr-mx.google.com with ESMTPS id o5-20020a05600c510500b003e215309bfcsi5823wms.4.2023.02.20.01.05.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2023 01:05:19 -0800 (PST) Received-SPF: pass (google.com: domain of fm-526363-202302200905194114eb3961370fa1fb-gdacql@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) client-ip=185.136.65.225; Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 202302200905194114eb3961370fa1fb for ; Mon, 20 Feb 2023 10:05:19 +0100 From: Adriaan Schmidt To: isar-users@googlegroups.com Cc: Adriaan Schmidt Subject: [PATCH v2 2/4] add multiarch support Date: Mon, 20 Feb 2023 10:05:09 +0100 Message-Id: <20230220090511.2524881-3-adriaan.schmidt@siemens.com> In-Reply-To: <20230220090511.2524881-1-adriaan.schmidt@siemens.com> References: <20230220090511.2524881-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=fANG+0ac; spf=pass (google.com: domain of fm-526363-202302200905194114eb3961370fa1fb-gdacql@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-526363-202302200905194114eb3961370fa1fb-GDacQL@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 those targets can be used in IMAGE_INSTALL, where they are automatically converted to install the correct debian package: foo-compat -> foo:${COMPAT_DISTRO_ARCH} foo-native -> foo:${HOST_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 --- .../recipes-app/samefile/samefile_2.14.bb | 2 +- meta/classes/compat.bbclass | 46 ++++++++++++++ meta/classes/debianize.bbclass | 2 +- meta/classes/dpkg-base.bbclass | 1 + meta/classes/image.bbclass | 4 +- meta/classes/multiarch.bbclass | 60 +++++++++++++++++++ meta/classes/native.bbclass | 10 ++++ meta/conf/bitbake.conf | 1 + 8 files changed, 123 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..2221bbf7 --- /dev/null +++ b/meta/classes/compat.bbclass @@ -0,0 +1,46 @@ +# 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 +################################################################################ + +# calculate COMPAT_DISTRO_ARCH and ISAR_ENABLE_COMPAT_ARCH +# this must always use the DISTRO_ARCH override (not PACKAGE_ARCH), so needs +# to happen in a modified environment +python() { + distro_arch = d.getVar('DISTRO_ARCH', True) + package_arch = d.getVar('PACKAGE_ARCH', True) + overrides = d.getVar('OVERRIDES', True).split(':') + + localdata = bb.data.createCopy(d) + new_overrides = [distro_arch] + [o for o in overrides if not o == package_arch] + localdata.setVar('OVERRIDES', ':'.join(new_overrides)) + isar_enable_compat_arch = localdata.getVar('ISAR_ENABLE_COMPAT_ARCH', True) + compat_distro_arch = localdata.getVar('COMPAT_DISTRO_ARCH', True) + + 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) + d.setVar('ISAR_ENABLE_COMPAT_ARCH', isar_enable_compat_arch) +} + + +################################################################################ +# 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 ef7d5a2a..ce7c549c 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -79,9 +79,11 @@ image_do_mounts() { buildchroot_do_mounts } +inherit multiarch + 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_multiarch_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..09aaff52 --- /dev/null +++ b/meta/classes/multiarch.bbclass @@ -0,0 +1,60 @@ +# 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" + +# function to convert bitbake targets to installable debian packages, +# e.g., "hello-compat" to "hello:i386". +def isar_multiarch_packages(var, d): + bb_targets = (d.getVar(var, True) or '').split() + packages = [] + compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH', True) + host_arch = d.getVar('HOST_ARCH', True) + for t in bb_targets: + if t.endswith('-compat'): + packages.append(t[:-len('-compat')] + ':' + compat_distro_arch) + elif t.endswith('-native'): + packages.append(t[:-len('-native')] + ':' + host_arch) + else: + packages.append(t) + return ' '.join(packages) 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 05ccb7b8..dd21319a 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 = ""