From: Srinuvasan Arjunan <srinuvasanasv@gmail.com>
To: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH v1] recipes-devtools/sbuild-chroot: install self-built packages in sbuild flavor
Date: Tue, 2 Jan 2024 23:56:04 -0800 (PST) [thread overview]
Message-ID: <bb24c2f8-bec3-44df-873b-79c931e022efn@googlegroups.com> (raw)
In-Reply-To: <5ff0a12b-831a-44fa-81aa-29cba6a077a6@siemens.com>
[-- Attachment #1.1: Type: text/plain, Size: 9784 bytes --]
On Wednesday, January 3, 2024 at 10:47:54 AM UTC+5:30 Jan Kiszka wrote:
On 03.01.24 05:47, Srinuvasan Arjunan wrote:
>
>
> On Friday, December 15, 2023 at 5:15:50 PM UTC+5:30 Srinuvasan Arjunan
> wrote:
>
> From: srinuvasan <srinuv...@siemens.com>
>
> In some use-cases we need to install custom packages in sbuildchroot
> and
> this can be referred later time during image generation part, hence we
> additionally added the provision to install the custom packages in
> sbuild flavor.
>
> Introduced SBUILD_CHROOT_INSTALL variable, here you can define the
> custom packages that you need to install in sbuild flavor.
>
> Signed-off-by: srinuvasan <srinuv...@siemens.com>
> ---
> .../recipes-app/hello-isar/hello-isar.bb <http://hello-isar.bb> | 2 +-
> meta-isar/recipes-app/libhello/libhello.bb <http://libhello.bb> | 2 +-
> .../recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb> | 3 +
> ...b => sbuild-chroot-host-extra-packages.bb
> <http://sbuild-chroot-host-extra-packages.bb>} | 2 +-
> ...=> sbuild-chroot-target-extra-packages.bb
> <http://sbuild-chroot-target-extra-packages.bb>} | 2 +-
> meta/classes/image.bbclass | 1 +
> ...tall-custom-packages-sbuild-flavor.bbclass | 64 +++++++++++++++++++
> 7 files changed, 72 insertions(+), 4 deletions(-)
> rename
> meta-isar/recipes-devtools/sbuild-chroot/{sbuild-chroot-host-db2m.bb
> <http://sbuild-chroot-host-db2m.bb> =>
> sbuild-chroot-host-extra-packages.bb
> <http://sbuild-chroot-host-extra-packages.bb>} (91%)
> rename
> meta-isar/recipes-devtools/sbuild-chroot/{sbuild-chroot-target-db2m.bb <
http://sbuild-chroot-target-db2m.bb> =>
sbuild-chroot-target-extra-packages.bb <
http://sbuild-chroot-target-extra-packages.bb>} (91%)
> create mode 100644
> meta/classes/install-custom-packages-sbuild-flavor.bbclass
>
> diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb
> <http://hello-isar.bb>
> b/meta-isar/recipes-app/hello-isar/hello-isar.bb <http://hello-isar.bb>
> index 51dac2b7..484e5704 100644
> --- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
> <http://hello-isar.bb>
> +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> <http://hello-isar.bb>
> @@ -23,4 +23,4 @@ SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
> inherit dpkg
>
> # Example of using alternative sbuild chroot
> -SBUILD_FLAVOR="db2m"
> +SBUILD_FLAVOR="extra-packages"
> diff --git a/meta-isar/recipes-app/libhello/libhello.bb
> <http://libhello.bb> b/meta-isar/recipes-app/libhello/libhello.bb
> <http://libhello.bb>
> index 71604bf5..4e6522fe 100644
> --- a/meta-isar/recipes-app/libhello/libhello.bb <http://libhello.bb>
> +++ b/meta-isar/recipes-app/libhello/libhello.bb <http://libhello.bb>
> @@ -16,4 +16,4 @@ SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
> inherit dpkg
>
> # Example of using alternative sbuild chroot
> -SBUILD_FLAVOR="db2m"
> +SBUILD_FLAVOR="extra-packages"
> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> b/meta-isar/recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> index b381d859..d635a3aa 100644
> --- a/meta-isar/recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> +++ b/meta-isar/recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> @@ -10,4 +10,7 @@ LIC_FILES_CHKSUM =
> "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
>
> PV = "1.0"
>
> +SBUILD_FLAVOR = "extra-packages"
> +SBUILD_CHROOT_INSTALL = "hello-isar"
> +
> inherit image
> diff --git
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb <
http://sbuild-chroot-host-db2m.bb>
b/meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-host-extra-packages.bb <
http://sbuild-chroot-host-extra-packages.bb>
> similarity index 91%
> rename from
> meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb
> <http://sbuild-chroot-host-db2m.bb>
> rename to
> meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-host-extra-packages.bb <
http://sbuild-chroot-host-extra-packages.bb>
> index 1795c5a2..b035a926 100644
> ---
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb <
http://sbuild-chroot-host-db2m.bb>
> +++
> b/meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-host-extra-packages.bb <
http://sbuild-chroot-host-extra-packages.bb>
> @@ -8,5 +8,5 @@ DESCRIPTION = "Isar sbuild/schroot filesystem for
> host (docbook-to-man)"
>
> require recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
> <http://sbuild-chroot-host.bb>
>
> -SBUILD_FLAVOR = "db2m"
> +SBUILD_FLAVOR = "extra-packages"
> SBUILD_CHROOT_PREINSTALL_EXTRA ?= "docbook-to-man"
> diff --git
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb <
http://sbuild-chroot-target-db2m.bb>
b/meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-target-extra-packages.bb <
http://sbuild-chroot-target-extra-packages.bb>
> similarity index 91%
> rename from
> meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb <
http://sbuild-chroot-target-db2m.bb>
> rename to
> meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-target-extra-packages.bb <
http://sbuild-chroot-target-extra-packages.bb>
> index e2e10433..80440df2 100644
> ---
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb <
http://sbuild-chroot-target-db2m.bb>
> +++
> b/meta-isar/recipes-devtools/sbuild-chroot/
sbuild-chroot-target-extra-packages.bb <
http://sbuild-chroot-target-extra-packages.bb>
> @@ -8,5 +8,5 @@ DESCRIPTION = "Isar sbuild/schroot filesystem for
> target (docbook-to-man)"
>
> require recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
> <http://sbuild-chroot-target.bb>
>
> -SBUILD_FLAVOR = "db2m"
> +SBUILD_FLAVOR = "extra-packages"
> SBUILD_CHROOT_PREINSTALL_EXTRA ?= "docbook-to-man"
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 73f1d52c..5fea18b0 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -85,6 +85,7 @@ inherit image-tools-extension
> inherit image-postproc-extension
> inherit image-locales-extension
> inherit image-account-extension
> +inherit install-custom-packages-sbuild-flavor
>
> # Extra space for rootfs in MB
> ROOTFS_EXTRA ?= "64"
> diff --git
> a/meta/classes/install-custom-packages-sbuild-flavor.bbclass
> b/meta/classes/install-custom-packages-sbuild-flavor.bbclass
> new file mode 100644
> index 00000000..04650f51
> --- /dev/null
> +++ b/meta/classes/install-custom-packages-sbuild-flavor.bbclass
> @@ -0,0 +1,64 @@
> +# This software is a part of ISAR.
> +# Copyright (C) Siemens AG, 2023
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +# This file extends the image.bbclass to supply tools for futher
> imager functions
> +
> +inherit sbuild
> +
> +SBUILD_FLAVOR = "extra-packages"
> +SBUILD_CHROOT_INSTALL ??= ""
> +
> +SCHROOT_MOUNTS = "${WORKDIR}:${PP_WORK}
> ${IMAGE_ROOTFS}:${PP_ROOTFS} ${DEPLOY_DIR_IMAGE}:${PP_DEPLOY}"
> +SCHROOT_MOUNTS += "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"
> +
> +ROOTFS_INSTALL_COMMAND:prepend = "
> install_custom_packages_sbuild_flavor"
> +
> +install_custom_packages_sbuild_flavor() {
> +
> + schroot_create_configs
> + insert_mounts
> +
> + if [ -n "${SBUILD_CHROOT_INSTALL}" ]; then
> + echo "Installing self built packages: ${SBUILD_CHROOT_INSTALL}"
> +
> + distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
> + if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
> + distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
> + fi
> +
> + # prepare isar-apt
> + sudo -E chroot ${SCHROOT_DIR} sh -c " \
> + mkdir -p '/etc/apt/sources.list.d'
> + echo 'deb [trusted=yes] file:///isar-apt ${DEBDISTRONAME} main' > \
> + '/etc/apt/sources.list.d/isar-apt.list'
> +
> + mkdir -p '/etc/apt/preferences.d'
> + cat << EOF > '/etc/apt/preferences.d/isar-apt'
> +Package: ${SBUILD_CHROOT_INSTALL}
> +Pin: release n=${DEBDISTRONAME}
> +Pin-Priority: 1000
> +EOF"
> +
> + E="${@ isar_export_proxies(d)}"
> + deb_dl_dir_import ${schroot_dir} ${distro}
> + sudo -E chroot ${SCHROOT_DIR} sh -c " \
> + apt-get update \
> + -o Dir::Etc::SourceList='sources.list.d/isar-apt.list' \
> + -o Dir::Etc::SourceParts='-' \
> + -o APT::Get::List-Cleanup='0'
> + apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
> + --allow-unauthenticated --allow-downgrades --download-only install \
> + ${SBUILD_CHROOT_INSTALL}"
> +
> + deb_dl_dir_export ${schroot_dir} ${distro}
> + sudo -E chroot ${SCHROOT_DIR} sh -c " \
> + apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
> + --allow-unauthenticated --allow-downgrades install \
> + ${SBUILD_CHROOT_INSTALL}"
> + fi
> +
> + remove_mounts
> + schroot_delete_configs
> +}
> --
> 2.39.2
>
>
>
> Any improvements needed in this patch , Please provide your thoughts.
>
I still don't get all the complexity here, specificially as I just did
what you did in [1] with just a DEPENDS.
Jan
[1]
https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac95258a622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com
Hmm, Let me try with DEPENDS , but you added the dependencies via
DEPENDS in base sbuild-chroot [target/host], if i add all my dependencies
here it may increases the size of bare-metal sbuild-chroot , i will check
this DEPENDS for sbuild flavor too.
Srinu
--
Siemens AG, Technology
Linux Expert Center
[-- Attachment #1.2: Type: text/html, Size: 18613 bytes --]
next prev parent reply other threads:[~2024-01-03 7:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 9:56 [PATCH] " Srinuvasan Arjunan
2023-12-15 10:34 ` Jan Kiszka
2023-12-15 11:01 ` Srinuvasan Arjunan
2023-12-15 11:45 ` [PATCH v1] " Srinuvasan Arjunan
2024-01-03 4:47 ` Srinuvasan Arjunan
2024-01-03 5:17 ` Jan Kiszka
2024-01-03 7:56 ` Srinuvasan Arjunan [this message]
2024-01-03 10:36 ` Jan Kiszka
2024-01-03 13:11 ` Srinuvasan Arjunan
2024-01-03 16:27 ` Jan Kiszka
2024-01-04 5:43 ` Srinuvasan Arjunan
2024-01-05 12:00 ` Srinuvasan Arjunan
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=bb24c2f8-bec3-44df-873b-79c931e022efn@googlegroups.com \
--to=srinuvasanasv@gmail.com \
--cc=isar-users@googlegroups.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