public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 0/2] add support for debian build profiles
@ 2022-01-04 10:02 Felix Moessbauer
  2022-01-04 10:02 ` [PATCH v2 1/2] " Felix Moessbauer
  2022-01-04 10:02 ` [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support Felix Moessbauer
  0 siblings, 2 replies; 6+ messages in thread
From: Felix Moessbauer @ 2022-01-04 10:02 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, vijaikumar.kanagarajan, Felix Moessbauer

Changes since v1:

- fix erronous code removal reported by Vijai
- only use value of DEB_BUILD_PROFILES_CROSS when cross-compiling (no combination of values)
- improve API changelog docs
- rebased onto next
- use DEB_BUILD_PROFILES infrastructure in linux-custom.inc


Felix Moessbauer (2):
  add support for debian build profiles
  refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support

 RECIPE-API-CHANGELOG.md                    |  9 +++++++++
 meta/classes/dpkg-base.bbclass             | 13 +++++++++++++
 meta/classes/dpkg.bbclass                  |  4 +++-
 meta/recipes-kernel/linux/linux-custom.inc | 14 +++++++++-----
 4 files changed, 34 insertions(+), 6 deletions(-)

-- 
2.30.2


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

* [PATCH v2 1/2] add support for debian build profiles
  2022-01-04 10:02 [PATCH v2 0/2] add support for debian build profiles Felix Moessbauer
@ 2022-01-04 10:02 ` Felix Moessbauer
  2022-01-04 11:24   ` Jan Kiszka
  2022-01-04 12:13   ` vijai kumar
  2022-01-04 10:02 ` [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support Felix Moessbauer
  1 sibling, 2 replies; 6+ messages in thread
From: Felix Moessbauer @ 2022-01-04 10:02 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, vijaikumar.kanagarajan, 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        |  9 +++++++++
 meta/classes/dpkg-base.bbclass | 13 +++++++++++++
 meta/classes/dpkg.bbclass      |  4 +++-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 3bbb42a9..1f3a19b4 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -314,3 +314,12 @@ 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_PROFILES_CROSS.
+These variables define the DEB_BUILD_PROFILES environment variable which is available in do_install_builddeps and do_dpkg_build.
+When cross compiling, the values in DEB_BUILD_PROFILES_CROSS (default: "cross") are used to define the environment variable.
+
+For a list of well-known Debian build profiles and common practices, we refer to Debian's BuildProfileSpec.
+
+
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index cb5ce4a9..05c1cbd3 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,17 @@ 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 ''
+    if d.getVar("ISAR_CROSS_COMPILE") == "1":
+        deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES_CROSS', True)
+    else:
+        deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES', 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)
@@ -279,6 +291,7 @@ python do_devshell() {
 
     isar_export_proxies(d)
     isar_export_ccache(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 27fe84f4..68f63f93 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -9,10 +9,12 @@ 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}"
+        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] 6+ messages in thread

* [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support
  2022-01-04 10:02 [PATCH v2 0/2] add support for debian build profiles Felix Moessbauer
  2022-01-04 10:02 ` [PATCH v2 1/2] " Felix Moessbauer
@ 2022-01-04 10:02 ` Felix Moessbauer
  2022-01-04 11:25   ` Jan Kiszka
  1 sibling, 1 reply; 6+ messages in thread
From: Felix Moessbauer @ 2022-01-04 10:02 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, vijaikumar.kanagarajan, Felix Moessbauer

This patch replaces the manual setup of the DEB_BUILD_PROFILES
environment variable in the linux-custom.inc recipe.
Instead, the recently introduced DEB_BUILD_PROFILES infrastructure
of ISAR is used.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/recipes-kernel/linux/linux-custom.inc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index ed89aa09..5ac08487 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -117,6 +117,15 @@ 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)}"
+DEB_BUILD_PROFILES_CROSS += "${@get_additional_build_profiles(d)}"
+
 do_prepare_build_prepend() {
 	# copy meta-data over to source tree
 	rm -rf ${S}/debian
@@ -176,10 +185,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


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

* Re: [PATCH v2 1/2] add support for debian build profiles
  2022-01-04 10:02 ` [PATCH v2 1/2] " Felix Moessbauer
@ 2022-01-04 11:24   ` Jan Kiszka
  2022-01-04 12:13   ` vijai kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2022-01-04 11:24 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users; +Cc: vijaikumar.kanagarajan

On 04.01.22 11:02, Felix Moessbauer wrote:
> 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.

This interface is clearly a step backward compared to v1.

I still don't see the use case why someone would want to avoid that Isar
auto-injects "cross" into the build profile list when doing cross
compilation, thus the use case for a configurable variable.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux

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

* Re: [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support
  2022-01-04 10:02 ` [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support Felix Moessbauer
@ 2022-01-04 11:25   ` Jan Kiszka
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2022-01-04 11:25 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users; +Cc: vijaikumar.kanagarajan

On 04.01.22 11:02, Felix Moessbauer wrote:
> This patch replaces the manual setup of the DEB_BUILD_PROFILES
> environment variable in the linux-custom.inc recipe.
> Instead, the recently introduced DEB_BUILD_PROFILES infrastructure
> of ISAR is used.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/recipes-kernel/linux/linux-custom.inc | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index ed89aa09..5ac08487 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -117,6 +117,15 @@ 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)}"
> +DEB_BUILD_PROFILES_CROSS += "${@get_additional_build_profiles(d)}"
> +

As said on patch 1: Having to set two vars in recipes is needless
boilerplate logic.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux

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

* Re: [PATCH v2 1/2] add support for debian build profiles
  2022-01-04 10:02 ` [PATCH v2 1/2] " Felix Moessbauer
  2022-01-04 11:24   ` Jan Kiszka
@ 2022-01-04 12:13   ` vijai kumar
  1 sibling, 0 replies; 6+ messages in thread
From: vijai kumar @ 2022-01-04 12:13 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, Jan Kiszka

On Tue, Jan 4, 2022 at 3:33 PM Felix Moessbauer
<felix.moessbauer@siemens.com> wrote:
>
> 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        |  9 +++++++++
>  meta/classes/dpkg-base.bbclass | 13 +++++++++++++
>  meta/classes/dpkg.bbclass      |  4 +++-
>  3 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 3bbb42a9..1f3a19b4 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -314,3 +314,12 @@ 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_PROFILES_CROSS.
> +These variables define the DEB_BUILD_PROFILES environment variable which is available in do_install_builddeps and do_dpkg_build.
> +When cross compiling, the values in DEB_BUILD_PROFILES_CROSS (default: "cross") are used to define the environment variable.
> +
> +For a list of well-known Debian build profiles and common practices, we refer to Debian's BuildProfileSpec.
> +
> +
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index cb5ce4a9..05c1cbd3 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,17 @@ 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 ''
> +    if d.getVar("ISAR_CROSS_COMPILE") == "1":
> +        deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES_CROSS', True)

Still trying to understand the need for the extra variable. Maybe an
example will help me understand better.
It could just be DEB_BUILD_PROFILES += "cross"

> +    else:
> +        deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES', 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)
> @@ -279,6 +291,7 @@ python do_devshell() {
>
>      isar_export_proxies(d)
>      isar_export_ccache(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 27fe84f4..68f63f93 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -9,10 +9,12 @@ 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}"
> +        distro="${HOST_DISTRO}"

Probably an unwanted indent change.

Thanks,
Vijai Kumar K

>      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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 10:02 [PATCH v2 0/2] add support for debian build profiles Felix Moessbauer
2022-01-04 10:02 ` [PATCH v2 1/2] " Felix Moessbauer
2022-01-04 11:24   ` Jan Kiszka
2022-01-04 12:13   ` vijai kumar
2022-01-04 10:02 ` [PATCH v2 2/2] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support Felix Moessbauer
2022-01-04 11:25   ` Jan Kiszka

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