public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] add support for debian build profiles
@ 2021-12-21 19:06 Felix Moessbauer
  2021-12-21 20:54 ` vijai kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Felix Moessbauer @ 2021-12-21 19:06 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, Felix Moessbauer

This patch adds the bitbake variables DEB_BUILD_PROFILES and
DEB_BUILD_PROFILES_CROSS.
The values of these variables are used to define the DEB_BUILD_PROFILES
environment variable.

When cross-compiling, the DEB_BUILD_PROFILES_CROSS variable is defaulted
to "cross", to be consistent with upstream debian.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 RECIPE-API-CHANGELOG.md        |  8 ++++++++
 meta/classes/dpkg-base.bbclass | 12 ++++++++++++
 meta/classes/dpkg.bbclass      |  5 ++---
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 55836258..f95f7db5 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -306,3 +306,11 @@ When using the plugins it is advised to name the partition "/boot" and to exclud
 
 The variable is renamed to get closer to OE/Poky variables naming. The old naming
 will still also work, but with deprecation warning shown.
+
+### Introduce debian build profiles
+
+All recipes that inherit from dpkg and dpkg-base can utilize the variables DEB_BUILD_PROFILES and DEB_BUILD_PROFILES_CROSS.
+These variables define the DEB_BUILD_PROFILES environment variable which is available in do_install_builddeps and do_dpkg_build.
+The DEB_BUILD_PROFILES_CROSS bitbake variable is set to "cross" when cross compiling.
+
+
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 6704385b..c1588528 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_PROFILES_CROSS ?= "cross"
 
 python do_adjust_git() {
     import subprocess
@@ -201,7 +203,16 @@ dpkg_runbuild() {
     die "This should never be called, overwrite it in your derived class"
 }
 
+def isar_export_build_profiles(d):
+    import os
+    deb_build_profiles = os.environ['DEB_BUILD_PROFILES'] if 'DEB_BUILD_PROFILES' in os.environ else ''
+    deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES', True)
+    if d.getVar("ISAR_CROSS_COMPILE") == "1":
+        deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES_CROSS', True)
+    os.environ['DEB_BUILD_PROFILES'] = deb_build_profiles.strip()
+
 python do_dpkg_build() {
+    isar_export_build_profiles(d)
     lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock",
                              shared=True)
     bb.build.exec_func("dpkg_do_mounts", d)
@@ -278,6 +289,7 @@ python do_devshell() {
     bb.build.exec_func('dpkg_do_mounts', d)
 
     isar_export_proxies(d)
+    isar_export_build_profiles(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 7da73341..8e5626e8 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -9,10 +9,9 @@ PACKAGE_ARCH ?= "${DISTRO_ARCH}"
 do_install_builddeps() {
     dpkg_do_mounts
     E="${@ isar_export_proxies(d)}"
+    E="${@ isar_export_build_profiles(d)}"
     distro="${DISTRO}"
-    if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
-       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
-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-04 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 19:06 [PATCH 1/1] add support for debian build profiles Felix Moessbauer
2021-12-21 20:54 ` vijai kumar
2021-12-31 11:23   ` Moessbauer, Felix
2022-01-03  7:19     ` Jan Kiszka
2022-01-04 12:05     ` vijai kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox