public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anton Mikanovich <amikan@ilbers.de>, isar-users@googlegroups.com
Cc: Uladzimir Bely <ubely@ilbers.de>
Subject: Re: [PATCH v12 05/21] dpkg: Build packages with sbuild
Date: Wed, 11 Jan 2023 21:59:05 +0100	[thread overview]
Message-ID: <7515b359-4ebf-7214-074c-b258078efbd0@siemens.com> (raw)
In-Reply-To: <20220628064913.27938-6-amikan@ilbers.de>

On 28.06.22 08:48, Anton Mikanovich wrote:
> Use previously exported to schroot rootfs to build the package with
> sbuild tool. Provide isar-apt as extra repository to be automatically
> add to apt sources.
> 
> Also added /home/.git-downloads mount while it's used
> as git alternates location.
> 
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  meta/classes/dpkg-base.bbclass | 31 ++++++++++++++++---------------
>  meta/classes/dpkg-gbp.bbclass  |  2 ++
>  meta/classes/dpkg.bbclass      | 10 ++++++++--
>  meta/classes/sbuild.bbclass    |  4 ++--
>  4 files changed, 28 insertions(+), 19 deletions(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 7e032ba..dbe35f4 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -4,6 +4,7 @@
>  #
>  # SPDX-License-Identifier: MIT
>  
> +inherit sbuild
>  inherit buildchroot
>  inherit debianize
>  inherit terminal
> @@ -16,6 +17,8 @@ DEPENDS_append_riscv64 = "${@' crossbuild-essential-riscv64' if d.getVar('ISAR_C
>  DEB_BUILD_PROFILES ?= ""
>  DEB_BUILD_OPTIONS ?= ""
>  
> +ISAR_APT_REPO ?= "deb [trusted=yes] file:///home/builder/${PN}/isar-apt/${DISTRO}-${DISTRO_ARCH}/apt/${DISTRO} ${DEBDISTRONAME} main"
> +
>  python do_adjust_git() {
>      import subprocess
>  
> @@ -175,6 +178,7 @@ addtask prepare_build after do_patch do_transform_template before do_dpkg_build
>  # If Isar recipes depend on each other, they typically need the package
>  # deployed to isar-apt
>  do_prepare_build[deptask] = "do_deploy_deb"
> +do_prepare_build[depends] = "${SCHROOT_DEP}"
>  
>  BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
>  
> @@ -200,6 +204,15 @@ dpkg_undo_mounts() {
>      sudo rmdir ${BUILDROOT}
>  }
>  
> +do_prepare_build_append() {
> +    # Make a local copy of isar-apt repo that is not affected by other parallel builds
> +    mkdir -p ${WORKDIR}/isar-apt/${DISTRO}-${DISTRO_ARCH}
> +    rm -rf ${WORKDIR}/isar-apt/${DISTRO}-${DISTRO_ARCH}/*
> +    cp -Rl ${REPO_ISAR_DIR} ${WORKDIR}/isar-apt/${DISTRO}-${DISTRO_ARCH}
> +}
> +
> +do_prepare_build[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
> +
>  # Placeholder for actual dpkg_runbuild() implementation
>  dpkg_runbuild() {
>      die "This should never be called, overwrite it in your derived class"
> @@ -222,14 +235,11 @@ def isar_export_build_settings(d):
>      os.environ['DEB_BUILD_PROFILES'] = isar_deb_build_profiles(d)
>  
>  python do_dpkg_build() {
> -    lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock",
> -                             shared=True)
> -    bb.build.exec_func("dpkg_do_mounts", d)
> +    bb.build.exec_func('schroot_create_configs', d)
>      try:
>          bb.build.exec_func("dpkg_runbuild", d)
>      finally:
> -        bb.build.exec_func("dpkg_undo_mounts", d)
> -        bb.utils.unlockfile(lock)
> +        bb.build.exec_func('schroot_delete_configs', d)
>  }
>  
>  addtask dpkg_build
> @@ -259,7 +269,7 @@ python do_dpkg_build_setscene() {
>  addtask dpkg_build_setscene
>  do_dpkg_build_setscene[dirs] += "${S}/.."
>  
> -KEEP_INSTALLED_ON_CLEAN ?= "0"
> +do_dpkg_build[depends] = "${SCHROOT_DEP}"
>  
>  CLEANFUNCS += "deb_clean"
>  
> @@ -269,15 +279,6 @@ deb_clean() {
>          for d in ${DEBS}; do
>              repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
>                  "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
> -            if [ "${KEEP_INSTALLED_ON_CLEAN}" = "1" ]; then
> -                continue;
> -            fi
> -            package=$(basename "${d}")
> -            package_remove="/usr/bin/apt-get remove -y ${package%%_*}"
> -            sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
> -            if [ "${BUILDCHROOT_DIR}" != "${BUILDCHROOT_TARGET_DIR}" ]; then
> -                    sudo -E chroot ${BUILDCHROOT_TARGET_DIR} ${package_remove} || true
> -            fi
>          done
>      fi
>  }
> diff --git a/meta/classes/dpkg-gbp.bbclass b/meta/classes/dpkg-gbp.bbclass
> index 2b0b818..68172b3 100644
> --- a/meta/classes/dpkg-gbp.bbclass
> +++ b/meta/classes/dpkg-gbp.bbclass
> @@ -11,6 +11,8 @@ PATCHTOOL ?= "git"
>  
>  GBP_EXTRA_OPTIONS ?= "--git-pristine-tar"
>  
> +SCHROOT_MOUNTS = "${WORKDIR}:${PP} ${GITDIR}:/home/.git-downloads"
> +

This was always (at least in-tree) dead code because insert_mounts() was
never invoked. What was this setting here supposed to achieve?

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


  reply	other threads:[~2023-01-11 20:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28  6:48 [PATCH v12 00/21] Sbuild/Schroot migration Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 01/21] dpkg-gbp: Use separate command to export tarball Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 02/21] dpkg-gbp: Use host tools for dsc preparation Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 03/21] sbuild: Add recipes for host and target rootfs to run sbuild Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 04/21] sbuild: Introduce a class for another build method Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 05/21] dpkg: Build packages with sbuild Anton Mikanovich
2023-01-11 20:59   ` Jan Kiszka [this message]
2023-01-12  8:01     ` Uladzimir Bely
2022-06-28  6:48 ` [PATCH v12 06/21] sbuild: Support of DEB_BUILD_PROFILES Anton Mikanovich
2022-06-28  6:48 ` [PATCH v12 07/21] sbuild: Support of shell exports from dpkg_runbuild_prepend Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 08/21] dpkg: Remove builddeps install task Anton Mikanovich
2022-07-19 14:55   ` Henning Schild
2022-06-28  6:49 ` [PATCH v12 09/21] sbuild: Add ccache support Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 10/21] dpkg-base: Switch devshell to use schroot Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 11/21] dpkg-base: Switch apt_fetch and apt_unpack " Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 12/21] doc: Add sbuild-related documentation Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 13/21] sbuild: Use .dsc file instead of source directory Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 14/21] sbuild: Fixed proxy support Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 15/21] sbuild: Fix debsrc_download for packages dependencies Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 16/21] fix: support build of packages with epoch version Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 17/21] always create apt-cache dirs in deb_dl_dir_import Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 18/21] avoid absolute SCHROOT_* paths to improve caching Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 19/21] dpkg-base: Cleanup on schroot fail Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 20/21] locate generated binary package in WORKDIR Anton Mikanovich
2022-06-28  6:49 ` [PATCH v12 21/21] sbuild: Add changelog entry Anton Mikanovich
2022-06-28  6:57 ` [PATCH v12 00/21] Sbuild/Schroot migration Anton Mikanovich
2022-06-28  7:24   ` Moessbauer, Felix
2022-06-28  9:10     ` Baurzhan Ismagulov
2022-06-29 12:47 ` 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=7515b359-4ebf-7214-074c-b258078efbd0@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=amikan@ilbers.de \
    --cc=isar-users@googlegroups.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