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 2/2] dpkg-source: Build source package only once
Date: Mon, 6 May 2024 08:11:01 +0000	[thread overview]
Message-ID: <d126d6e3c13becb96c2fe70ceb3f7d16c58ac4b2.camel@siemens.com> (raw)
In-Reply-To: <1fe26da1-b3db-4b06-95ff-4b7996d318ee@siemens.com>

On Sun, 2024-05-05 at 22:32 +0200, Jan Kiszka 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"
> +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 ''}"
Thanks. For the linux-custom build the linux-....tar.gz sources are
created not only for linux-native but also for linux-kbuildtarget...

Stefan
-- 
Stefan Koch
Siemens AG
www.siemens.com

  parent reply	other threads:[~2024-05-06  8:11 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 [this message]
2024-05-06  9:06     ` Jan Kiszka
2024-05-13 12:04   ` Anton Mikanovich
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=d126d6e3c13becb96c2fe70ceb3f7d16c58ac4b2.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