From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057909071463055360 X-Received: by 2002:a05:6512:b23:: with SMTP id w35mr3048333lfu.653.1643297512055; Thu, 27 Jan 2022 07:31:52 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:651c:556:: with SMTP id q22ls1093826ljp.1.gmail; Thu, 27 Jan 2022 07:31:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJy24T0yu3nkmFdzKtLMvjL0GycgyZTDJw2Wn4YGX96SjxQ7Wb6jjbgF3MquvYlmF6mP1+b8 X-Received: by 2002:a2e:7a06:: with SMTP id v6mr3142880ljc.301.1643297511094; Thu, 27 Jan 2022 07:31:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643297511; cv=pass; d=google.com; s=arc-20160816; b=clK/EEc+aMeuHQpzmHuNFJINF2NXDvvq3NLxCrJ0TW5u0Y+7Med0KeYA15AvmSX8ZX V98gGRyYWCb/f495mEVVGMzM2nj7sUCn5Qea5MudavGbhL7I6XvhtNuC7qy9YlyP8rmJ hZHgPXG6FpWSfsIvzvBZ2EP/ggNck+ZxotBRdnsFaHFcAdH7hriTdeVsOgRX3UeVF1qW aViFJoJWCDgAKqXJwwRfi5MC77GSZgnv2K7FPl7wBa6xYMdTuNtAEkEd1CQC6T3n4X57 dpYjUtwmH10VhKPbzQ51iI8Gi71+6tnXwx8vSqq2fJQ/mNpG7Y8O8KZaLtcmR0LTW/wX oV1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=nVXoLUdBH4mRUvHEwocQKWD9qYdZkbTDpnJQzLG/pxs=; b=vSXfJ+huq+wP7x73iDwrR3l9y23lK0gM1vk7uRxROsaSJGTbjC7roHIp9mFjEW8AM8 r/ffLHtmJnUJWlGogkyiD5yiO6v9CE+59gRbAE0pBHyyMKe72eUaAXRb6DGnArVVfVSs JQifxDnTEpdHCMvGnO/W2oIqlyZQSvU3W12k12ie7lAW1WJUXHNG9lWhf51VFmsijBOd x9yVpte8Fa1gImUEiOPEUuKxhNsqcVNyiAv8BC5K+7PW+p/DANuxBp2mk2JAbpIWPHOJ YHpRjYs2WXrl/7KDvnsur9YZ1V1tVPLUokup2YUxVfAJpT6jzjz7mizaxlkczRLRbVn4 tnYw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=J5llwAPH; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of felix.moessbauer@siemens.com designates 40.107.1.53 as permitted sender) smtp.mailfrom=felix.moessbauer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10053.outbound.protection.outlook.com. [40.107.1.53]) by gmr-mx.google.com with ESMTPS id bp40si104075lfb.0.2022.01.27.07.31.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jan 2022 07:31:50 -0800 (PST) Received-SPF: pass (google.com: domain of felix.moessbauer@siemens.com designates 40.107.1.53 as permitted sender) client-ip=40.107.1.53; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=J5llwAPH; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of felix.moessbauer@siemens.com designates 40.107.1.53 as permitted sender) smtp.mailfrom=felix.moessbauer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNurf568ZYBBi+lzzc0XnIPMo+VzlQblhUgmURwmR9JAIDmXGj3u2hpVHmlB20Oz/2pCG+SHnAv+PrPzTFYWxxQoz29IO9j4rQH1DtBabFQpV2xEvm4itd8mR/9I04VMWYrT/K12jmKWCKUl15pMrDfNlYBAKIcctyzkZvEm5/ONnj2mmuYs2cZvdlYVAfFcj2FinzHiKR0PocXBvAAIL6h+PVk7XGIDqty9DWeihip2JH0/mlOt/28uYF1PigOWr93zS0gYUQ8Mdg10IxOETA26ivYPYd07dFkigEMdlrkFaM36VPAkDQiH6CSzFdbND0T5ASeEDxCCi2fq0aYLfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nVXoLUdBH4mRUvHEwocQKWD9qYdZkbTDpnJQzLG/pxs=; b=iGYIsPzPLE6NxNRymwR9Sv/T57iVDoSpBQ2FMszFOc4y7J9gCsQAi0uMDFhtirMRJ1W/Uck5jagDxRZmgDYs6Ilv8eqZP1RukvA9pJ8s5DzD7UtJc2ZqzAOD/tbQ07j9N/CZGNiaA8cln4+z69RZFm1ojfYih+BKaTWHQBMFYLMGIAt54RXeyp8T9z/GeSi0qbOiypF01m6EE/pOeIYzAPhbKkHxdggBBCqx13z8GDblqnZVnWIA9LrhnO1f8aOzMjeK8sIr/5V3Zb/Eh8nDl0X3C1hBN+DuQi8VqegpWVdzAwcwi/zjUfs+T1oPEse9Ra6kamk4LJiFtwulkC1zhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.73) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nVXoLUdBH4mRUvHEwocQKWD9qYdZkbTDpnJQzLG/pxs=; b=J5llwAPHqWywOabX5QsJUg5HWqSeeYTf2hnFjTN3Yyd+5qwHWmL6eAJv+G60iHcNlpKUHqtv7q2/7Oz8PE7gRJKqNW1tONtZ4KdiKvkdgLnHXi3w1CyPufViImMcSbdl8AJ3eaUcL6S5HvYvFyeFOnGQLxo+heKcmPzKzIAc4wGDBmJRff0RS92LANNQ6uPP/iCz6zn6VpzQJNIwAXTMjTthndmyvR/vbAz5ZyS0y9yKP8P11GTDIp9/WKdNaa049/CcORryEIB2JG7e6VQiXGds6BBl74QxxQmge/dJfgk303ttsIMkxirn/2VeIEJU2nBue6gBBUg8CMGi1QYj1w== Received: from SV0P279CA0020.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:12::7) by VI1PR1001MB1278.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:e1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17; Thu, 27 Jan 2022 15:31:49 +0000 Received: from HE1EUR01FT061.eop-EUR01.prod.protection.outlook.com (2603:10a6:f10:12:cafe::4e) by SV0P279CA0020.outlook.office365.com (2603:10a6:f10:12::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Thu, 27 Jan 2022 15:31:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.73) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.73 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.73; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.73) by HE1EUR01FT061.mail.protection.outlook.com (10.152.1.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4930.15 via Frontend Transport; Thu, 27 Jan 2022 15:31:48 +0000 Received: from DEMCHDC8A1A.ad011.siemens.net (139.25.226.107) by DEMCHDC9SNA.ad011.siemens.net (194.138.21.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Thu, 27 Jan 2022 16:31:47 +0100 Received: from MD1T0KAC-VM.ad001.siemens.net (139.25.68.224) by DEMCHDC8A1A.ad011.siemens.net (139.25.226.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 27 Jan 2022 16:31:47 +0100 From: Felix Moessbauer To: CC: , , "Felix Moessbauer" Subject: [PATCH v6 1/1] add support for debian build profiles and options Date: Thu, 27 Jan 2022 16:31:26 +0100 Message-ID: <20220127153126.882929-2-felix.moessbauer@siemens.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127153126.882929-1-felix.moessbauer@siemens.com> References: <20220127153126.882929-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: felix.moessbauer@siemens.com X-Originating-IP: [139.25.68.224] X-ClientProxiedBy: DEMCHDC89YA.ad011.siemens.net (139.25.226.104) To DEMCHDC8A1A.ad011.siemens.net (139.25.226.107) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57f9c92d-ca05-4d3f-54d6-08d9e1aa225a X-MS-TrafficTypeDiagnostic: VI1PR1001MB1278:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AmRGBke5OlKguzL1jF3qAv6PATb0Bx3zpI+tUX367rccCY+O7hyuFJMv53Hkb8L0KrGh6+uvHTDRd+MF3LRcaf0Bx64QaTTXON6wNjkK9mTV9sxmPGpNdVmv7ChLTH+gsMgG8Y8IQ73bKe+2Ts2D8IOX9e6VD7aaInr0e984wTK0ZCsIE8mLnkqqMh6kRvhrZs+jjMk43CHVowbuoOTlmg1U0hQ74b0TQ8L8NZoOcWgu2RKBnBLfKWL9Aivui93EhHFEbgcxsV5nheW3z43Y06y8bpQnmL4AN71FDISH+69jYMSfdseseledKreaDOM9zoesS7Kj/cb1LCSybCEu7qT9BFcWOWwkFAhYWCmEJYDYy7VuNBLYC7GioGenfpcaIADU+ff+TaAlJrX6FiAlQOYKeDwEwgGwXZoOTMS3COqGb8xwWW3oz7eCb1yvPCr+ZK7UwaeqFrD1fwce6k+IASL87K9ovsdUSnrzE0I6Ij7jWb/x/qxLa9i/PWh1SV+QHZUkW7KcgWBa9vDYoRXUW4mIfCMnx1q4zExQ48uZ5TMslnsIhaVaHskYh/Vtn7KpXz9Cg02zqEPON6L/cjABdyhXb+NsfYHM6KYqCxb4DYMj1E0gdeFRlFRboj1jHXAiwlS2+4BwM2KxlqWfwl3nwRVmgMoEf/lAJ1eHvxbjztWC6qzECpFsE6XSxd4hVn0Ty3nqmHNXxU0KOPlTtYH810o0A1gYvUKfgpZ7CwODAjG5khbiCKWPy+2eZ2mORHTGszuWb9rVokzIpdimxTsttzfgVFzxXo6PUXu8caPvy7M= X-Forefront-Antispam-Report: CIP:194.138.21.73;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(40470700004)(36840700001)(82960400001)(36860700001)(86362001)(54906003)(5660300002)(508600001)(107886003)(316002)(81166007)(47076005)(356005)(26005)(186003)(336012)(2906002)(70586007)(6916009)(44832011)(6666004)(70206006)(8936002)(8676002)(82310400004)(4326008)(1076003)(83380400001)(36756003)(2616005)(956004)(16526019)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 15:31:48.5847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57f9c92d-ca05-4d3f-54d6-08d9e1aa225a X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.73];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT061.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR1001MB1278 X-TUID: jPdbCjo830// This patch adds the bitbake variables DEB_BUILD_PROFILES and DEB_BUILD_OPTIONS. These are used to define the respective environment variables. When cross-compiling, "cross" is added to the DEB_BUILD_PROFILES environment variable. As this introduces a breaking change, we update the ISAR example recipes as well: - refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support - Use DEB_BUILD_OPTIONS bb variable in hello.bb example Signed-off-by: Felix Moessbauer --- RECIPE-API-CHANGELOG.md | 8 ++++++++ meta-isar/recipes-app/hello/hello.bb | 8 ++------ meta/classes/dpkg-base.bbclass | 19 +++++++++++++++++++ meta/classes/dpkg.bbclass | 7 ++++++- .../libubootenv/libubootenv_0.3-3.bb | 5 +---- meta/recipes-kernel/linux/linux-custom.inc | 13 ++++++++----- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md index 3bbb42a9..39a1616b 100644 --- a/RECIPE-API-CHANGELOG.md +++ b/RECIPE-API-CHANGELOG.md @@ -314,3 +314,11 @@ The "NAME" used to be rather static and the TAG was always "latest", now the val ### Renamed variable CONTAINER_FORMATS to CONTAINER_IMAGE_FORMATS The meaning remains the same, just the name changed. +### Introduce debian build profiles + +All recipes that inherit from dpkg and dpkg-base can utilize the variables `DEB_BUILD_PROFILES` and `DEB_BUILD_OPTIONS`. +The bitbake variable defines the respective environment variable which is available in `do_install_builddeps` and `do_dpkg_build`. +When cross compiling, `cross` is added to the `DEB_BUILD_PROFILES` environment variable. +Please note, that manually exported versions of the variables are overwritten. + +For a list of well-known Debian build profiles and common practices, we refer to Debian's BuildProfileSpec. diff --git a/meta-isar/recipes-app/hello/hello.bb b/meta-isar/recipes-app/hello/hello.bb index d6bdf9bb..acf8ed73 100644 --- a/meta-isar/recipes-app/hello/hello.bb +++ b/meta-isar/recipes-app/hello/hello.bb @@ -15,6 +15,8 @@ SRC_URI = "apt://${PN}" MAINTAINER = "isar-users " CHANGELOG_V = "+isar" +DEB_BUILD_OPTIONS += "${@ 'nocheck' if d.getVar('ISAR_CROSS_COMPILE') == '1' else '' }" + do_prepare_build() { deb_add_changelog # this seems to be a build dep missing in the upstream control file @@ -22,9 +24,3 @@ do_prepare_build() { sed -i -e 's/Build-Depends:/Build-Depends: texinfo,/g' ${S}/debian/control fi } - -dpkg_runbuild_prepend() { - if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then - export DEB_BUILD_OPTIONS="nocheck" - fi -} diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index cb5ce4a9..202cc115 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -13,6 +13,8 @@ inherit deb-dl-dir DEPENDS ?= "" DEPENDS_append_riscv64 = "${@' crossbuild-essential-riscv64' if d.getVar('ISAR_CROSS_COMPILE', True) == '1' and d.getVar('PN') != 'crossbuild-essential-riscv64' else ''}" +DEB_BUILD_PROFILES ?= "" +DEB_BUILD_OPTIONS ?= "" python do_adjust_git() { import subprocess @@ -201,6 +203,22 @@ dpkg_runbuild() { die "This should never be called, overwrite it in your derived class" } +def isar_deb_build_profiles(d): + deb_build_profiles = d.getVar('DEB_BUILD_PROFILES', True) + if d.getVar("ISAR_CROSS_COMPILE") == "1": + deb_build_profiles += ' cross' + return deb_build_profiles.strip() + +def isar_deb_build_options(d): + deb_build_options = d.getVar('DEB_BUILD_OPTIONS', True) + return deb_build_options.strip() + +# use with caution: might contaminate multiple tasks +def isar_export_build_settings(d): + import os + os.environ['DEB_BUILD_OPTIONS'] = isar_deb_build_options(d) + os.environ['DEB_BUILD_PROFILES'] = isar_deb_build_profiles(d) + python do_dpkg_build() { lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock", shared=True) @@ -279,6 +297,7 @@ python do_devshell() { isar_export_proxies(d) isar_export_ccache(d) + isar_export_build_settings(d) buildchroot = d.getVar('BUILDCHROOT_DIR') pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS')) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index 27fe84f4..320102ba 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -9,10 +9,13 @@ PACKAGE_ARCH ?= "${DISTRO_ARCH}" do_install_builddeps() { dpkg_do_mounts E="${@ isar_export_proxies(d)}" + export DEB_BUILD_OPTIONS="${@ isar_deb_build_options(d)}" + export DEB_BUILD_PROFILES="${@ isar_deb_build_profiles(d)}" distro="${DISTRO}" if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then - distro="${HOST_DISTRO}" + distro="${HOST_DISTRO}" fi + deb_dl_dir_import "${BUILDCHROOT_DIR}" "${distro}" sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \ ${PP}/${PPS} ${PACKAGE_ARCH} --download-only @@ -33,6 +36,8 @@ addtask devshell after do_install_builddeps dpkg_runbuild() { E="${@ isar_export_proxies(d)}" E="${@ isar_export_ccache(d)}" + export DEB_BUILD_OPTIONS="${@ isar_deb_build_options(d)}" + export DEB_BUILD_PROFILES="${@ isar_deb_build_profiles(d)}" export PARALLEL_MAKE="${PARALLEL_MAKE}" sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \ /isar/build.sh ${PP}/${PPS} ${PACKAGE_ARCH} diff --git a/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb b/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb index 68a55003..9af01aa7 100644 --- a/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb +++ b/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb @@ -19,7 +19,4 @@ SRCREV = "a1a3504e5cda1883928a8747a0bedc56afff6910" S = "${WORKDIR}/git" - -dpkg_runbuild_prepend() { - export DEB_BUILD_OPTIONS="nocheck" -} +DEB_BUILD_OPTIONS += "nocheck" diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index ed89aa09..59d42c84 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -117,6 +117,14 @@ def config_fragments(d): fragments.append(local) return fragments +def get_additional_build_profiles(d): + profiles = d.getVar('BASE_DISTRO', True) + if d.getVar('KERNEL_LIBC_DEV_DEPLOY', True) != '1': + profiles += ' nolibcdev' + return profiles + +DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}" + do_prepare_build_prepend() { # copy meta-data over to source tree rm -rf ${S}/debian @@ -176,10 +184,5 @@ dpkg_configure_kernel() { } dpkg_runbuild_prepend() { - profiles="${BASE_DISTRO}" - if [ "${KERNEL_LIBC_DEV_DEPLOY}" != "1" ]; then - profiles="${profiles} nolibcdev" - fi - export DEB_BUILD_PROFILES="${profiles}" dpkg_configure_kernel } -- 2.30.2