public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	isar-users <isar-users@googlegroups.com>
Cc: "Schmidt, Adriaan" <adriaan.schmidt@siemens.com>,
	Stefan Koch <stefan-koch@siemens.com>
Subject: Re: [PATCH 2/2] dpkg-source: Build source package only once
Date: Mon, 13 May 2024 15:04:49 +0300	[thread overview]
Message-ID: <8cc271c6-bf89-4244-86b1-961ae074515e@ilbers.de> (raw)
In-Reply-To: <1fe26da1-b3db-4b06-95ff-4b7996d318ee@siemens.com>

05/05/2024 23:32, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Avoid building the source package multiple times, possibly even
> inconsistently. This is achieved by delegating this task to to the base
> package and installing the source package from isar-apt in the native
> and compat package variants.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>   meta/classes/dpkg-source.bbclass | 44 ++++++++++++++++++++++++++++++--
>   1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass
> index 005eafbe..7161641f 100644
> --- a/meta/classes/dpkg-source.bbclass
> +++ b/meta/classes/dpkg-source.bbclass
> @@ -13,7 +13,7 @@ do_dpkg_source() {
>       find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -maxdepth 1 -delete
>       sh -c "cd ${WORKDIR}; dpkg-source ${DPKG_SOURCE_EXTRA_ARGS} -b ${PPS}"
>   }
> -addtask dpkg_source after do_prepare_build before do_dpkg_build
> +addtask dpkg_source after do_prepare_build
>   
>   do_deploy_source[depends] += "isar-apt:do_cache_config"
>   do_deploy_source[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
> @@ -28,4 +28,44 @@ do_deploy_source() {
>               "${package}"
>       done
>   }
> -addtask deploy_source after do_dpkg_source before do_dpkg_build
> +addtask deploy_source after do_dpkg_source
> +
> +do_dpkg_build[depends] += "${BPN}:do_deploy_source"
> +
> +SCHROOT_MOUNTS = "${WORKDIR}:/work ${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"
> +
> +do_fetch_common_source[depends] += "${BPN}:do_deploy_source"
As do_fetch_common_source is the first task which use schroot it should also
have ${SCHROOT_DEP} in depends flag.
Simple test case to reproduce the issue with missing schroot: build
mc:qemuarm64-bullseye:libhello-compat (with ISAR_ENABLE_COMPAT_ARCH enabled)
> +do_fetch_common_source[network] = "${TASK_USE_SUDO}"
> +do_fetch_common_source() {
> +    schroot_create_configs
> +    insert_mounts
> +
> +    session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
> +    echo "Started session: ${session_id}"
> +
> +    schroot_cleanup() {
> +        schroot -q -f -e -c ${session_id} > /dev/null 2>&1
> +        remove_mounts > /dev/null 2>&1
> +        schroot_delete_configs
> +    }
> +    trap 'exit 1' INT HUP QUIT TERM ALRM USR1
> +    trap 'schroot_cleanup' EXIT
> +
> +    schroot -r -c ${session_id} -d / -u root -- \
> +        apt-get update -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" -o Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0"
> +    schroot -r -c ${session_id} -d / -- \
> +        sh -c '
> +            cd /work
> +            apt-get -y --download-only --only-source -o Acquire::Source-Symlinks="false" source ${BPN}'
> +
> +    schroot -e -c ${session_id}
> +    remove_mounts
> +    schroot_delete_configs
> +}
> +addtask fetch_common_source after do_unpack
> +
> +def is_native_or_compat(d):
> +    overrides = d.getVar('OVERRIDES').split(':')
> +    return 'class-native' in overrides or 'class-compat' in overrides
> +
> +do_dpkg_build[depends] += "${@'${PN}:do_fetch_common_source' if is_native_or_compat(d) else ''}"



  parent reply	other threads:[~2024-05-13 12:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-05 20:32 [PATCH 1/2] dpkg-source: Fix source deployment Jan Kiszka
2024-05-05 20:32 ` [PATCH 2/2] dpkg-source: Build source package only once Jan Kiszka
2024-05-06  6:29   ` Schmidt, Adriaan
2024-05-06  6:33     ` Jan Kiszka
2024-05-06  8:11   ` Koch, Stefan
2024-05-06  9:06     ` Jan Kiszka
2024-05-13 12:04   ` Anton Mikanovich [this message]
2024-05-13 12:08     ` Jan Kiszka
2024-05-10 17:32 ` [PATCH 1/2] dpkg-source: Fix source deployment Jan Kiszka
2024-05-10 17:55   ` Jan Kiszka
2024-05-13  7:29     ` Jan Kiszka
2024-05-13  6:56   ` Jan Kiszka
2024-05-13  7:01     ` 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=8cc271c6-bf89-4244-86b1-961ae074515e@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=adriaan.schmidt@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=stefan-koch@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