public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2 8/9] dpkg: Use a specific export function in pre-build tasks
Date: Tue, 25 Jan 2022 13:32:18 +0100	[thread overview]
Message-ID: <20220125123219.32395-9-ubely@ilbers.de> (raw)
In-Reply-To: <20220125123219.32395-1-ubely@ilbers.de>

Build system like sbuild may not use the system environment, so direct
shell export won't work.

This introduces dpkg_build_export function that may be overloaded in
sbuild or other build systems to be implemented in Isar.

Use it in some recipes like optee-os-stm32mp15x as an alternative
of passing TEE_IMPL_VERSION variable through template mechanism.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta-isar/recipes-app/hello/hello.bb                     | 2 +-
 .../recipes-bsp/optee-os/optee-os-stm32mp15x_3.11.0.bb   | 2 +-
 meta/classes/dpkg-base.bbclass                           | 9 +++++++++
 meta/classes/dpkg.bbclass                                | 2 +-
 meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb        | 2 +-
 meta/recipes-kernel/linux/linux-custom.inc               | 2 +-
 6 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/meta-isar/recipes-app/hello/hello.bb b/meta-isar/recipes-app/hello/hello.bb
index d6bdf9bb..dfeea6e9 100644
--- a/meta-isar/recipes-app/hello/hello.bb
+++ b/meta-isar/recipes-app/hello/hello.bb
@@ -25,6 +25,6 @@ do_prepare_build() {
 
 dpkg_runbuild_prepend() {
 	if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
-		export DEB_BUILD_OPTIONS="nocheck"
+		dpkg_build_export DEB_BUILD_OPTIONS "nocheck"
 	fi
 }
diff --git a/meta-isar/recipes-bsp/optee-os/optee-os-stm32mp15x_3.11.0.bb b/meta-isar/recipes-bsp/optee-os/optee-os-stm32mp15x_3.11.0.bb
index 0fa2005d..00b92707 100644
--- a/meta-isar/recipes-bsp/optee-os/optee-os-stm32mp15x_3.11.0.bb
+++ b/meta-isar/recipes-bsp/optee-os/optee-os-stm32mp15x_3.11.0.bb
@@ -21,5 +21,5 @@ OPTEE_BINARIES = "tee-header_v2.stm32 tee-pageable_v2.stm32 tee-pager_v2.stm32"
 # Set version manually to PV, the tarball does not contain any hint.
 # Alternative: pull from git and add git as build dependency.
 dpkg_runbuild_prepend() {
-    export TEE_IMPL_VERSION=${PV}
+    dpkg_build_export TEE_IMPL_VERSION ${PV}
 }
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 2add0b22..76b1290a 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -196,6 +196,15 @@ dpkg_undo_mounts() {
     sudo rmdir ${BUILDROOT}
 }
 
+# Basic export implementation supporting multiword values
+dpkg_build_export() {
+    var=$1
+    shift
+    value=$@
+
+    export $var="$value"
+}
+
 # Placeholder for actual dpkg_runbuild() implementation
 dpkg_runbuild() {
     die "This should never be called, overwrite it in your derived class"
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 27fe84f4..e8c7e2eb 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -33,7 +33,7 @@ addtask devshell after do_install_builddeps
 dpkg_runbuild() {
     E="${@ isar_export_proxies(d)}"
     E="${@ isar_export_ccache(d)}"
-    export PARALLEL_MAKE="${PARALLEL_MAKE}"
+    dpkg_build_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..9cdbb366 100644
--- a/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb
+++ b/meta/recipes-bsp/libubootenv/libubootenv_0.3-3.bb
@@ -21,5 +21,5 @@ S = "${WORKDIR}/git"
 
 
 dpkg_runbuild_prepend() {
-	export DEB_BUILD_OPTIONS="nocheck"
+	dpkg_build_export DEB_BUILD_OPTIONS "nocheck"
 }
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index ed89aa09..72706f23 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -180,6 +180,6 @@ dpkg_runbuild_prepend() {
 	if [ "${KERNEL_LIBC_DEV_DEPLOY}" != "1" ]; then
 		profiles="${profiles} nolibcdev"
 	fi
-	export DEB_BUILD_PROFILES="${profiles}"
+	dpkg_build_export DEB_BUILD_PROFILES "${profiles}"
 	dpkg_configure_kernel
 }
-- 
2.20.1


  parent reply	other threads:[~2022-01-25 12:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 12:32 [PATCH v2 0/9] Avoid using shell environment during the build Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 1/9] template: Copy template attributes on transform Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 2/9] linux-module: Do not use shell environment Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 3/9] u-boot: " Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 4/9] trusted-firmware: " Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 5/9] optee-os: " Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 6/9] kselftest: " Uladzimir Bely
2022-01-25 12:32 ` [PATCH v2 7/9] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
2022-01-25 12:32 ` Uladzimir Bely [this message]
2022-01-25 12:32 ` [PATCH v2 9/9] linux-custom: Move cfg fragments applying " Uladzimir Bely
2022-01-25 13:29 ` [PATCH v2 0/9] Avoid using shell environment during the build Jan Kiszka
2022-01-25 13:51   ` Uladzimir Bely
2022-01-25 13:55     ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220125123219.32395-9-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox