public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Moessbauer, Felix" <felix.moessbauer@siemens.com>
To: Uladzimir Bely <ubely@ilbers.de>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>
Subject: RE: [PATCH v8 04/16] sbuild: Introduce a class for another build method
Date: Thu, 17 Mar 2022 15:31:59 +0000	[thread overview]
Message-ID: <AM9PR10MB4869C9A126993D7BA00DE33D89129@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20220317045021.4018-5-ubely@ilbers.de>

Hi,

> -----Original Message-----
> From: isar-users@googlegroups.com <isar-users@googlegroups.com> On
> Behalf Of Uladzimir Bely
> Sent: Thursday, March 17, 2022 5:50 AM
> To: isar-users@googlegroups.com
> Subject: [PATCH v8 04/16] sbuild: Introduce a class for another build method
> 
> This also adds mounts for base-apt inside schroot and adds import/export deb
> files to/from schroot. So that it becomes possible to run second  `cached` build
> from local base-apt repo.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  meta/classes/sbuild.bbclass | 160 ++++++++++++++++++++++++++++++++++++
>  meta/conf/bitbake.conf      |   2 +
>  2 files changed, 162 insertions(+)
>  create mode 100644 meta/classes/sbuild.bbclass
> 
> diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass new file
> mode 100644 index 00000000..e4341a6f
> --- /dev/null
> +++ b/meta/classes/sbuild.bbclass
> @@ -0,0 +1,160 @@
> +# This software is a part of ISAR.
> +# Copyright (C) 2021 ilbers GmbH
> +
> +SCHROOT_CONF ?= "/etc/schroot"
> +
> +SCHROOT_MOUNTS ?= ""
> +
> +python __anonymous() {
> +    import pwd
> +    d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
> +    d.setVar('SCHROOT_USER_HOME', pwd.getpwuid(os.geteuid()).pw_dir)
> +
> +    mode = d.getVar('ISAR_CROSS_COMPILE', True)
> +    distro_arch = d.getVar('DISTRO_ARCH')
> +    if mode == "0" or d.getVar('HOST_ARCH') ==  distro_arch or \
> +       (d.getVar('HOST_DISTRO') == "debian-stretch" and distro_arch == "i386"):
> +        d.setVar('SBUILD_HOST_ARCH', distro_arch)
> +        d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_TARGET_DIR'))
> +        dep = "sbuild-chroot-target:do_build"
> +    else:
> +        d.setVar('SBUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
> +        d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_HOST_DIR'))
> +        dep = "sbuild-chroot-host:do_build"
> +    d.setVar('SCHROOT_DEP', dep)
> +}
> +
> +SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-
> ${@os.getpid()}"
> +SBUILD_CHROOT_RW ?= "${SBUILD_CHROOT}-rw"
> +
> +SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}"
> +SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}"
> +SCHROOT_CONF_FILE_RW ?=
> "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}-rw"
> +
> +schroot_create_configs() {

Can we split this function into at least one per target file?
Having this large "cat" here is hard to maintain.

> +    sudo -s <<'EOSUDO'
> +        set -e
> +
> +        cat << EOF > "${SCHROOT_CONF_FILE}"
> +[${SBUILD_CHROOT}]
> +type=directory
> +directory=${SCHROOT_DIR}
> +profile=${SBUILD_CHROOT}
> +users=${SCHROOT_USER}
> +groups=root,sbuild
> +root-users=${SCHROOT_USER}
> +root-groups=root,sbuild
> +source-root-users=${SCHROOT_USER}
> +source-root-groups=root,sbuild
> +union-type=overlay
> +preserve-environment=true
> +EOF
> +
> +        cat << EOF > "${SCHROOT_CONF_FILE_RW}"
> +[${SBUILD_CHROOT_RW}]
> +type=directory
> +directory=${SCHROOT_DIR}
> +profile=${SBUILD_CHROOT}
> +users=${SCHROOT_USER}
> +groups=root,sbuild
> +root-users=${SCHROOT_USER}
> +root-groups=root,sbuild
> +preserve-environment=true
> +EOF
> +
> +        mkdir -p "${SCHROOT_DIR}/etc/apt/preferences.d"
> +        cat << EOF > "${SCHROOT_DIR}/etc/apt/preferences.d/isar-apt"

Outside sbuild, we have some other apt preferences that are relevant as well.
An example is the apt-retry patch, added in d349b76140482997a595ef33da6407e041113a8f

We should either duplicate them here, or better copy from buildchroot.

Felix

  reply	other threads:[~2022-03-17 15:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  4:50 [PATCH v8 00/16] Sbuild/Schroot migration Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 01/16] dpkg-gbp: Use separate command to export tarball Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 02/16] dpkg-gbp: Use host tools for dsc preparation Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 03/16] sbuild: Add recipes for host and target rootfs to run sbuild Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 04/16] sbuild: Introduce a class for another build method Uladzimir Bely
2022-03-17 15:31   ` Moessbauer, Felix [this message]
2022-03-17  4:50 ` [PATCH v8 05/16] dpkg: Build packages with sbuild Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 06/16] sbuild: Support of DEB_BUILD_PROFILES Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 07/16] sbuild: Support of shell exports from dpkg_runbuild_prepend Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 08/16] dpkg: Remove builddeps install task Uladzimir Bely
2022-04-08  9:11   ` Moessbauer, Felix
2022-03-17  4:50 ` [PATCH v8 09/16] sbuild: Add ccache support Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 10/16] dpkg-base: Switch devshell to use schroot Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 11/16] dpkg-base: Switch apt_fetch and apt_unpack " Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 12/16] doc: Add sbuild-related documentation Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 13/16] sbuild: Use .dsc file instead of source directory Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 14/16] sbuild: Fixed proxy support Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 15/16] sbuild: Fix debsrc_download for packages dependencies Uladzimir Bely
2022-03-17  4:50 ` [PATCH v8 16/16] fix: support build of packages with epoch version Uladzimir Bely
2022-04-07  9:32 ` [PATCH v8 00/16] Sbuild/Schroot migration Anton Mikanovich
2022-04-07 10:15   ` Moessbauer, Felix
2022-05-04  8:56 ` Anton Mikanovich

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=AM9PR10MB4869C9A126993D7BA00DE33D89129@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM \
    --to=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=ubely@ilbers.de \
    /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