public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: vijai kumar <vijaikumar.kanagarajan@gmail.com>
To: Felix Moessbauer <felix.moessbauer@siemens.com>
Cc: isar-users <isar-users@googlegroups.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH v3 1/3] add support for debian build profiles and options
Date: Mon, 10 Jan 2022 13:29:59 +0530	[thread overview]
Message-ID: <CALLGG_KCgJsw7xaYGYkTQZ5qZMNW1btPvnEbCPTrVO0i3Ph8kQ@mail.gmail.com> (raw)
In-Reply-To: <20220104130130.777924-2-felix.moessbauer@siemens.com>

On Tue, Jan 4, 2022 at 6:31 PM Felix Moessbauer
<felix.moessbauer@siemens.com> wrote:
>
> 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.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md        |  9 +++++++++
>  meta/classes/dpkg-base.bbclass | 16 ++++++++++++++++
>  meta/classes/dpkg.bbclass      |  4 +++-
>  3 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 3bbb42a9..65a1d9e4 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_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.
> +
> +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..ebf67ebc 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,7 +203,20 @@ dpkg_runbuild() {
>      die "This should never be called, overwrite it in your derived class"
>  }
>
> +def isar_export_build_settings(d):
> +    import os
> +    deb_build_profiles = os.environ['DEB_BUILD_PROFILES'] if 'DEB_BUILD_PROFILES' in os.environ else ''

Like said in the previous thread. If this is eventually going to be
dropped, a warning to the user would be needed so that he could notice
and migrate to the DEB_BUILD_PROFILES/OPTIONS variable instead of a
manual export.

Thanks,
Vijai Kumar K

> +    deb_build_profiles += ' ' + d.getVar('DEB_BUILD_PROFILES', True)
> +    if d.getVar("ISAR_CROSS_COMPILE") == "1":
> +        deb_build_profiles += ' cross'
> +    os.environ['DEB_BUILD_PROFILES'] = deb_build_profiles.strip()
> +
> +    deb_build_options = os.environ['DEB_BUILD_OPTIONS'] if 'DEB_BUILD_OPTIONS' in os.environ else ''
> +    deb_build_options += ' ' + d.getVar('DEB_BUILD_OPTIONS', True)
> +    os.environ['DEB_BUILD_OPTIONS'] = deb_build_options.strip()
> +
>  python do_dpkg_build() {
> +    isar_export_build_settings(d)
>      lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock",
>                               shared=True)
>      bb.build.exec_func("dpkg_do_mounts", d)
> @@ -279,6 +294,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..67d63813 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_settings(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
>

  reply	other threads:[~2022-01-10  8:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 13:01 [PATCH v3 0/3] add support for debian build profiles Felix Moessbauer
2022-01-04 13:01 ` [PATCH v3 1/3] add support for debian build profiles and options Felix Moessbauer
2022-01-10  7:59   ` vijai kumar [this message]
2022-01-04 13:01 ` [PATCH v3 2/3] refactor linux-custom.inc to use ISAR's DEB_BUILD_PROFILES support Felix Moessbauer
2022-01-04 13:01 ` [PATCH v3 3/3] Use DEB_BUILD_OPTIONS bb variable in hello.bb example Felix Moessbauer

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=CALLGG_KCgJsw7xaYGYkTQZ5qZMNW1btPvnEbCPTrVO0i3Ph8kQ@mail.gmail.com \
    --to=vijaikumar.kanagarajan@gmail.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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