public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Koch, Stefan" <stefan-koch@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"Kiszka, Jan" <jan.kiszka@siemens.com>
Cc: "Schmidt, Adriaan" <adriaan.schmidt@siemens.com>
Subject: Re: [PATCH] dpkg: Add support for building packages also for multi archs
Date: Mon, 16 Jan 2023 11:50:46 +0000	[thread overview]
Message-ID: <0b769b28b175d32a801ede0e0fa8ef5aa6dacb7c.camel@siemens.com> (raw)
In-Reply-To: <5963a56f-d89c-1318-a8b5-4d00fa00799e@siemens.com>

Sounds principally good. Thanks.

For the kbuild case I have submitted a similar patch:
[PATCH v2 3/5] dpkg: Add support for additional target and host builds
(Tue, 20 Dec 2022 18:09:19 +0100)

It modifies dpkg-base.bbclass instead of dpkg.bbclass

It uses the SBUILD_HOST variable for the same purpose as this patch
fulfills with the new PACKAGE_ARCH(S) variable. Migration from
SBUILD_HOST to PACKAGE_ARCHS should be possible. But I have not tested
this yet.

My patch will additionally set SCHROOT_DIR depending on
ISAR_CROSS_COMPILE to SCHROOT_TARGET_DIR or SCHROOT_HOST_DIR. That's
what I have not found inside this patch. Since my patch does it in the
dpkg-base.bbclass the schroot configuration is written before running
dpkg_runbuild with the correct SCHROOT_DIR. Doing this in dpkg.bbclass
would need a bit more code - it's not impossible I think.

Best regards

Stefan

On Wed, 2023-01-11 at 21:05 +0100, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This adds an interface to build packages not only for the target but
> also for the build host and/or the compat arch. All it takes for a
> recipe is to extend the new PACKAGE_ARCHS (note the plural) variable
> with the desired architectures.
> 
> The convenience variables PACKAGE_HOST_ARCH and PACKAGE_COMPAT_ARCH
> are
> introduced that fall back to empty strings if the cross-build or
> compat-arch features are disabled.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> This was too easy to be done already. Even ssbuild seems to work fine
> (Adriaan, please check as well).
> 
> I'm currently testing it very successfully to fix/improve our openssl
> patching needs, but I think this can also help in the kbuild
> scenario.
> The only thing missing for that is a nice idea how to define per-arch
> DEB_BUILD_OPTIONS so that the kernel tool builds can be mapped on
> build
> option, avoiding full builds for only getting those.
> 
>  meta/classes/dpkg.bbclass | 34 +++++++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index 7822b14d..7a48aaa7 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -5,6 +5,12 @@ inherit dpkg-base
>  
>  PACKAGE_ARCH ?= "${DISTRO_ARCH}"
>  
> +PACKAGE_ARCHS = "${PACKAGE_ARCH}"
> +
> +PACKAGE_HOST_ARCH = "${@d.getVar('HOST_ARCH') if
> d.getVar('ISAR_CROSS_COMPILE') == '1' else '' }"
> +PACKAGE_COMPAT_ARCH = ""
> +PACKAGE_COMPAT_ARCH_compat-arch = "${COMPAT_DISTRO_ARCH}"
> +
>  DPKG_PREBUILD_ENV_FILE="${WORKDIR}/dpkg_prebuild.env"
>  
>  # bitbake variables that should be passed into sbuild env
> @@ -101,19 +107,21 @@ dpkg_runbuild() {
>      sh -c "cd ${WORKDIR}; dpkg-source -q -b ${PPS}"
>      DSC_FILE=$(find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -
> print)
>  
> -    sbuild -A -n -c ${SBUILD_CHROOT} --extra-
> repository="${ISAR_APT_REPO}" \
> -        --host=${PACKAGE_ARCH} --build=${SBUILD_HOST_ARCH}
> ${profiles} \
> -        --no-run-lintian --no-run-piuparts --no-run-autopkgtest --
> resolve-alternatives \
> -        --no-apt-update \
> -        --chroot-setup-commands="echo \"Package: *\nPin: release
> n=${DEBDISTRONAME}\nPin-Priority: 1000\" >
> /etc/apt/preferences.d/isar-apt" \
> -        --chroot-setup-commands="echo \"APT::Get::allow-downgrades
> 1;\" > /etc/apt/apt.conf.d/50isar-apt" \
> -        --chroot-setup-commands="rm -f /var/log/dpkg.log" \
> -        --chroot-setup-commands="cp -n --no-preserve=owner
> ${ext_deb_dir}/*.deb -t ${deb_dir}/ || :" \
> -        --finished-build-commands="rm -f ${deb_dir}/sbuild-build-
> depends-main-dummy_*.deb" \
> -        --finished-build-commands="cp -n --no-preserve=owner
> ${deb_dir}/*.deb -t ${ext_deb_dir}/ || :" \
> -        --finished-build-commands="cp /var/log/dpkg.log
> ${ext_root}/dpkg_partial.log" \
> -        --debbuildopts="--source-option=-I" \
> -        --build-dir=${WORKDIR} --dist="isar" ${DSC_FILE}
> +    for arch in ${PACKAGE_ARCHS}; do
> +        sbuild -A -n -c ${SBUILD_CHROOT} --extra-
> repository="${ISAR_APT_REPO}" \
> +            --host=$arch --build=${SBUILD_HOST_ARCH} ${profiles} \
> +            --no-run-lintian --no-run-piuparts --no-run-autopkgtest
> --resolve-alternatives \
> +            --no-apt-update \
> +            --chroot-setup-commands="echo \"Package: *\nPin: release
> n=${DEBDISTRONAME}\nPin-Priority: 1000\" >
> /etc/apt/preferences.d/isar-apt" \
> +            --chroot-setup-commands="echo \"APT::Get::allow-
> downgrades 1;\" > /etc/apt/apt.conf.d/50isar-apt" \
> +            --chroot-setup-commands="rm -f /var/log/dpkg.log" \
> +            --chroot-setup-commands="cp -n --no-preserve=owner
> ${ext_deb_dir}/*.deb -t ${deb_dir}/ || :" \
> +            --finished-build-commands="rm -f ${deb_dir}/sbuild-
> build-depends-main-dummy_*.deb" \
> +            --finished-build-commands="cp -n --no-preserve=owner
> ${deb_dir}/*.deb -t ${ext_deb_dir}/ || :" \
> +            --finished-build-commands="cp /var/log/dpkg.log
> ${ext_root}/dpkg_partial.log" \
> +            --debbuildopts="--source-option=-I" \
> +            --build-dir=${WORKDIR} --dist="isar" ${DSC_FILE}
> +    done
>  
>      sbuild_dpkg_log_export "${WORKDIR}/rootfs/dpkg_partial.log"
>      deb_dl_dir_export "${WORKDIR}/rootfs" "${distro}"

-- 
Stefan Koch
Siemens AG
www.siemens.com

  reply	other threads:[~2023-01-16 11:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 20:05 Jan Kiszka
2023-01-16 11:50 ` Koch, Stefan [this message]
2023-01-16 13:09   ` 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=0b769b28b175d32a801ede0e0fa8ef5aa6dacb7c.camel@siemens.com \
    --to=stefan-koch@siemens.com \
    --cc=adriaan.schmidt@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