From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7312758318482587648 Date: Wed, 3 Jan 2024 05:11:09 -0800 (PST) From: Srinuvasan Arjunan To: isar-users Message-Id: In-Reply-To: References: <8b19681f-8237-4cef-9235-b6128a37f457@siemens.com> <20231215114527.567501-1-srinuvasan_a@mentor.com> <10b9175f-cff3-4a43-a4b5-a3095ee81fe4n@googlegroups.com> <5ff0a12b-831a-44fa-81aa-29cba6a077a6@siemens.com> Subject: Re: [PATCH v1] recipes-devtools/sbuild-chroot: install self-built packages in sbuild flavor MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_27793_544370569.1704287469621" X-TUID: f8M35ImiXWb2 ------=_Part_27793_544370569.1704287469621 Content-Type: multipart/alternative; boundary="----=_Part_27794_1145628876.1704287469621" ------=_Part_27794_1145628876.1704287469621 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wednesday, January 3, 2024 at 4:06:20=E2=80=AFPM UTC+5:30 Jan Kiszka wro= te: On 03.01.24 08:56, Srinuvasan Arjunan wrote:=20 >=20 >=20 > On Wednesday, January 3, 2024 at 10:47:54=E2=80=AFAM UTC+5:30 Jan Kiszka = wrote:=20 >=20 > On 03.01.24 05:47, Srinuvasan Arjunan wrote:=20 > >=20 > >=20 > > On Friday, December 15, 2023 at 5:15:50=E2=80=AFPM UTC+5:30 Srinuvasan= =20 > Arjunan=20 > > wrote:=20 > >=20 > > From: srinuvasan =20 > >=20 > > In some use-cases we need to install custom packages in sbuildchroot=20 > > and=20 > > this can be referred later time during image generation part,=20 > hence we=20 > > additionally added the provision to install the custom packages in=20 > > sbuild flavor.=20 > >=20 > > Introduced SBUILD_CHROOT_INSTALL variable, here you can define the=20 > > custom packages that you need to install in sbuild flavor.=20 > >=20 > > Signed-off-by: srinuvasan =20 > > ---=20 > > .../recipes-app/hello-isar/hello-isar.bb =20 > > | 2 +-=20 > > meta-isar/recipes-app/libhello/libhello.bb =20 > > | 2 +-=20 > > .../recipes-core/images/isar-image-base.bb=20 > =20 > > > | 3 +=20 > > ...b =3D> sbuild-chroot-host-extra-packages.bb=20 > =20 > > >} | 2 +-=20 > > ...=3D> sbuild-chroot-target-extra-packages.bb=20 > =20 > > >} | 2 +-=20 > > meta/classes/image.bbclass | 1 +=20 > > ...tall-custom-packages-sbuild-flavor.bbclass | 64=20 > +++++++++++++++++++=20 > > 7 files changed, 72 insertions(+), 4 deletions(-)=20 > > rename=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/{sbuild-chroot-host-db2m.bb=20 > =20 > > > =3D>=20 > > sbuild-chroot-host-extra-packages.bb=20 > =20 > > >} (91%)=20 > > rename=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/{sbuild-chroot-target-db2m.bb < http://sbuild-chroot-target-db2m.bb> > =3D>=20 sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb> < http://sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb>>} (91%)=20 > > create mode 100644=20 > > meta/classes/install-custom-packages-sbuild-flavor.bbclass=20 > >=20 > > diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb=20 > =20 > > >=20 > > b/meta-isar/recipes-app/hello-isar/hello-isar.bb=20 > >=20 > > index 51dac2b7..484e5704 100644=20 > > --- a/meta-isar/recipes-app/hello-isar/hello-isar.bb=20 > =20 > > >=20 > > +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb=20 > =20 > > >=20 > > @@ -23,4 +23,4 @@ SRCREV =3D "a18c14cc11ce6b003f3469e89223cffb4016861d"= =20 > > inherit dpkg=20 > >=20 > > # Example of using alternative sbuild chroot=20 > > -SBUILD_FLAVOR=3D"db2m"=20 > > +SBUILD_FLAVOR=3D"extra-packages"=20 > > diff --git a/meta-isar/recipes-app/libhello/libhello.bb=20 > =20 > > >=20 > b/meta-isar/recipes-app/libhello/libhello.bb =20 > > >=20 > > index 71604bf5..4e6522fe 100644=20 > > --- a/meta-isar/recipes-app/libhello/libhello.bb=20 > >=20 > > +++ b/meta-isar/recipes-app/libhello/libhello.bb=20 > >=20 > > @@ -16,4 +16,4 @@ SRCREV =3D "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"= =20 > > inherit dpkg=20 > >=20 > > # Example of using alternative sbuild chroot=20 > > -SBUILD_FLAVOR=3D"db2m"=20 > > +SBUILD_FLAVOR=3D"extra-packages"=20 > > diff --git a/meta-isar/recipes-core/images/isar-image-base.bb=20 > =20 > > >=20 > > b/meta-isar/recipes-core/images/isar-image-base.bb=20 > =20 > > >=20 > > index b381d859..d635a3aa 100644=20 > > --- a/meta-isar/recipes-core/images/isar-image-base.bb=20 > =20 > > >=20 > > +++ b/meta-isar/recipes-core/images/isar-image-base.bb=20 > =20 > > >=20 > > @@ -10,4 +10,7 @@ LIC_FILES_CHKSUM =3D=20 > > "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=3D751419260=20 > >=20 > > PV =3D "1.0"=20 > >=20 > > +SBUILD_FLAVOR =3D "extra-packages"=20 > > +SBUILD_CHROOT_INSTALL =3D "hello-isar"=20 > > +=20 > > inherit image=20 > > diff --git=20 > >=20 > a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb < http://sbuild-chroot-host-db2m.bb> >=20 b/meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb> < http://sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb>>=20 > > similarity index 91%=20 > > rename from=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb=20 > =20 > > >=20 > > rename to=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb> < http://sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb>>=20 > > index 1795c5a2..b035a926 100644=20 > > ---=20 > >=20 > a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-host-db2m.bb < http://sbuild-chroot-host-db2m.bb> >=20 > > +++=20 > >=20 > b/meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb> < http://sbuild-chroot-host-extra-packages.bb < http://sbuild-chroot-host-extra-packages.bb>>=20 > > @@ -8,5 +8,5 @@ DESCRIPTION =3D "Isar sbuild/schroot filesystem for=20 > > host (docbook-to-man)"=20 > >=20 > > require recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb=20 > =20 > > >=20 > >=20 > > -SBUILD_FLAVOR =3D "db2m"=20 > > +SBUILD_FLAVOR =3D "extra-packages"=20 > > SBUILD_CHROOT_PREINSTALL_EXTRA ?=3D "docbook-to-man"=20 > > diff --git=20 > >=20 > a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb < http://sbuild-chroot-target-db2m.bb> >=20 b/meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb> < http://sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb>>=20 > > similarity index 91%=20 > > rename from=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb < http://sbuild-chroot-target-db2m.bb> >=20 > > rename to=20 > >=20 > meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb> < http://sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb>>=20 > > index e2e10433..80440df2 100644=20 > > ---=20 > >=20 > a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-db2m.bb < http://sbuild-chroot-target-db2m.bb> >=20 > > +++=20 > >=20 > b/meta-isar/recipes-devtools/sbuild-chroot/ sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb> < http://sbuild-chroot-target-extra-packages.bb < http://sbuild-chroot-target-extra-packages.bb>>=20 > > @@ -8,5 +8,5 @@ DESCRIPTION =3D "Isar sbuild/schroot filesystem for=20 > > target (docbook-to-man)"=20 > >=20 > > require recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb=20 > =20 > > >=20 > >=20 > > -SBUILD_FLAVOR =3D "db2m"=20 > > +SBUILD_FLAVOR =3D "extra-packages"=20 > > SBUILD_CHROOT_PREINSTALL_EXTRA ?=3D "docbook-to-man"=20 > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass=20 > > index 73f1d52c..5fea18b0 100644=20 > > --- a/meta/classes/image.bbclass=20 > > +++ b/meta/classes/image.bbclass=20 > > @@ -85,6 +85,7 @@ inherit image-tools-extension=20 > > inherit image-postproc-extension=20 > > inherit image-locales-extension=20 > > inherit image-account-extension=20 > > +inherit install-custom-packages-sbuild-flavor=20 > >=20 > > # Extra space for rootfs in MB=20 > > ROOTFS_EXTRA ?=3D "64"=20 > > diff --git=20 > > a/meta/classes/install-custom-packages-sbuild-flavor.bbclass=20 > > b/meta/classes/install-custom-packages-sbuild-flavor.bbclass=20 > > new file mode 100644=20 > > index 00000000..04650f51=20 > > --- /dev/null=20 > > +++ b/meta/classes/install-custom-packages-sbuild-flavor.bbclass=20 > > @@ -0,0 +1,64 @@=20 > > +# This software is a part of ISAR.=20 > > +# Copyright (C) Siemens AG, 2023=20 > > +#=20 > > +# SPDX-License-Identifier: MIT=20 > > +#=20 > > +# This file extends the image.bbclass to supply tools for futher=20 > > imager functions=20 > > +=20 > > +inherit sbuild=20 > > +=20 > > +SBUILD_FLAVOR =3D "extra-packages"=20 > > +SBUILD_CHROOT_INSTALL ??=3D ""=20 > > +=20 > > +SCHROOT_MOUNTS =3D "${WORKDIR}:${PP_WORK}=20 > > ${IMAGE_ROOTFS}:${PP_ROOTFS} ${DEPLOY_DIR_IMAGE}:${PP_DEPLOY}"=20 > > +SCHROOT_MOUNTS +=3D "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"=20 > > +=20 > > +ROOTFS_INSTALL_COMMAND:prepend =3D "=20 > > install_custom_packages_sbuild_flavor"=20 > > +=20 > > +install_custom_packages_sbuild_flavor() {=20 > > +=20 > > + schroot_create_configs=20 > > + insert_mounts=20 > > +=20 > > + if [ -n "${SBUILD_CHROOT_INSTALL}" ]; then=20 > > + echo "Installing self built packages: ${SBUILD_CHROOT_INSTALL}"=20 > > +=20 > > + distro=3D"${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"=20 > > + if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then=20 > > + distro=3D"${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"=20 > > + fi=20 > > +=20 > > + # prepare isar-apt=20 > > + sudo -E chroot ${SCHROOT_DIR} sh -c " \=20 > > + mkdir -p '/etc/apt/sources.list.d'=20 > > + echo 'deb [trusted=3Dyes] file:///isar-apt ${DEBDISTRONAME} main' > \= =20 > > + '/etc/apt/sources.list.d/isar-apt.list'=20 > > +=20 > > + mkdir -p '/etc/apt/preferences.d'=20 > > + cat << EOF > '/etc/apt/preferences.d/isar-apt'=20 > > +Package: ${SBUILD_CHROOT_INSTALL}=20 > > +Pin: release n=3D${DEBDISTRONAME}=20 > > +Pin-Priority: 1000=20 > > +EOF"=20 > > +=20 > > + E=3D"${@ isar_export_proxies(d)}"=20 > > + deb_dl_dir_import ${schroot_dir} ${distro}=20 > > + sudo -E chroot ${SCHROOT_DIR} sh -c " \=20 > > + apt-get update \=20 > > + -o Dir::Etc::SourceList=3D'sources.list.d/isar-apt.list' \=20 > > + -o Dir::Etc::SourceParts=3D'-' \=20 > > + -o APT::Get::List-Cleanup=3D'0'=20 > > + apt-get -o Debug::pkgProblemResolver=3Dyes --no-install-recommends=20 > -y \=20 > > + --allow-unauthenticated --allow-downgrades --download-only=20 > install \=20 > > + ${SBUILD_CHROOT_INSTALL}"=20 > > +=20 > > + deb_dl_dir_export ${schroot_dir} ${distro}=20 > > + sudo -E chroot ${SCHROOT_DIR} sh -c " \=20 > > + apt-get -o Debug::pkgProblemResolver=3Dyes --no-install-recommends=20 > -y \=20 > > + --allow-unauthenticated --allow-downgrades install \=20 > > + ${SBUILD_CHROOT_INSTALL}"=20 > > + fi=20 > > +=20 > > + remove_mounts=20 > > + schroot_delete_configs=20 > > +}=20 > > --=20 > > 2.39.2=20 > >=20 > >=20 > >=20 > > Any improvements needed in this patch , Please provide your=20 > thoughts.=20 > >=20 >=20 > I still don't get all the complexity here, specificially as I just did=20 > what you did in [1] with just a DEPENDS.=20 >=20 > Jan=20 >=20 > [1]=20 >=20 https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac95258a= 622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com=20 < https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac95258a= 622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com>=20 >=20 >=20 >=20 > Hmm, Let me try with DEPENDS , but you added the dependencies via=20 > DEPENDS in base sbuild-chroot [target/host], if i add all my=20 > dependencies here it may increases the size of bare-metal sbuild-chroot= =20 > , i will check this DEPENDS for sbuild flavor too.=20 >=20 That pattern is not for direct copying. But, as discussed, if you add=20 SBUILD_CHROOT_INSTALL_EXTRA which creates the necessary DEPENDS for the=20 sbuild flavor recipe, it should Just Work from my perspective.=20 Jan=20 --=20 Siemens AG, Technology=20 Linux Expert Center As per your changes in [1]=20 https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac95258a= 622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com < https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac95258a= 622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com > how this DEPENDS is working?, you added keyutils custom package as a=20 dependency in sbuild-chroot recipe, but for building this custom keyutils packages we should need sbuild-chroot-[host/target], then obviously we may= =20 face dependency loop issue. In my case first i need to build all the custom packages first, then based= =20 on the need basis i may install any custom packages in sbuild-chroot flavor= =20 [ the persistent one] during image creation part. what i implemented so far: List out the custom packages that need to be install in sbuild-chroot via= =20 SBUILD_CHROOT_INSTALL_EXTRA or SBUILD_CHROOT_INSTALL analogously=20 IMAGE_[PRE]INSTALL in the image recipe, for this purpose i added the=20 provision to access the isar-apt to install local packages in sbuild-chroot= . Presently isar-apt mount logic available in two places 1. during package=20 build via SBUILD (dpkg.bbclass) and 2. Imager creation part (f.e : wic ) But my requirement is something need to install the custom packages in=20 sbuildchroot to do some postprocess the meta data before image creation,=20 for this reason we introduced another isar-apt mount logic in separate=20 class. Thanks, Srinu ------=_Part_27794_1145628876.1704287469621 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Wednesday, January 3, 2024 at 4:06:20= =E2=80=AFPM UTC+5:30 Jan Kiszka wrote:
On 03.01.24 08:56, Srinuvasan Arjunan wrote:
>=20
>=20
> On Wednesday, January 3, 2024 at 10:47:54=E2=80=AFAM UTC+5:30 Ja= n Kiszka wrote:
>=20
> On 03.01.24 05:47, Srinuvasan Arjunan wrote:
> >
> >
> > On Friday, December 15, 2023 at 5:15:50=E2=80=AFPM UTC+= 5:30 Srinuvasan
> Arjunan
> > wrote:
> >
> > From: srinuvasan <srin= uv...@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 flav= or.
> >
> > Signed-off-by: srinuvasan <srinuv...@siemens.com>
> > ---
> > .../recipes-app/hello-isar/hello-isar.bb <http://hello-isar.bb= >
> <http://hello-isar.bb <http://hello-isar.bb>> | 2 +-
> > meta-isar/recipes-app/libhello/libhello.bb <http://libhello.bb= >
> <http://libhello.bb <http://libhello.bb>> | 2 +-
> > .../recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> > <http://isar-image-base.bb <http://isar-image-bas= e.bb>> | 3 +
> > ...b =3D> sbuild-chroot-host-extra-p= ackages.bb
> <http://sbuild-chroot-host-extra-packages= .bb>
> > <http://sbuild-chroot-host-extra-pac= kages.bb
> <http://sbuild-chroot-host-extra-packages= .bb>>} | 2 +-
> > ...=3D> sbuild-chroot-target-extra= -packages.bb
> <http://sbuild-chroot-target-extra-pack= ages.bb>
> > <http://sbuild-chroot-target-extra= -packages.bb
> <http://sbuild-chroot-target-extra-pack= ages.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-chroo= t-host-db2m.bb
> <http://sbuild-chroot-host-db2m.bb>
> > <http://sbuild-chroot-host-db2m.bb
> <http://sbuild-chroot-host-db2m.bb>> =3D&= gt;
> > sbuild-chroot-host-extra-packages.bb
> <
http://sbuild-chroot-host-extra-packages= .bb>
> > <http://sbuild-chroot-host-extra-pac= kages.bb
> <http://sbuild-chroot-host-extra-packages= .bb>>} (91%)
> > rename
> >
> meta-isar/recipes-devtools/sbuild-chroot/{sbuild-chr= oot-target-db2m.bb <http://sbuild-chroot-target-db2m.bb&= gt; <http://sbuild-chroot-target-db2m.bb <http://= sbuild-chroot-target-db2m.bb>> =3D> sbuild-c= hroot-target-extra-packages.bb <http://sbuild-chro= ot-target-extra-packages.bb> <http://sbuild-chr= oot-target-extra-packages.bb <http://sbuild-chroot= -target-extra-packages.bb>>} (91%)
> > create mode 100644
> > meta/classes/install-custom-packages-sbuild-flavor.bbcl= ass
> >
> > diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb<= /a>
> <
http://hello-isar.bb>
> > <http://hello-isar.bb <http://hello-isar.bb>>
> > b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> <http://hello-isar.bb> <http://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>
> > <http://hello-isar.bb <http://hello-isar.bb>>
> > +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> <http://hello-isar.bb>
> > <http://hello-isar.bb <http://hello-isar.bb>>
> > @@ -23,4 +23,4 @@ SRCREV =3D "a18c14cc11ce6b003f3469e89= 223cffb4016861d"
> > inherit dpkg
> >
> > # Example of using alternative sbuild chroot
> > -SBUILD_FLAVOR=3D"db2m"
> > +SBUILD_FLAVOR=3D"extra-packages"
> > diff --git a/meta-isar/recipes-app/libhello/libhello.bb
> <http://libhello.bb>
> > <http://libhello.bb <http://libhello.bb>>
> b/meta-isar/recipes-app/libhello/libhello.bb <http://libhello.bb>= ;
> > <http://libhello.bb <http://libhello.bb>>
> > index 71604bf5..4e6522fe 100644
> > --- a/meta-isar/recipes-app/libhello/libhello.bb
> <http://libhello.bb> <http://libhello.bb <http://libhello.bb>= ;>
> > +++ b/meta-isar/recipes-app/libhello/libhello.bb
> <http://libhello.bb> <http://libhello.bb <http://libhello.bb>= ;>
> > @@ -16,4 +16,4 @@ SRCREV =3D "98f2e41e7d05ab8d19b0c5d16= 0b104b725c8fd93"
> > inherit dpkg
> >
> > # Example of using alternative sbuild chroot
> > -SBUILD_FLAVOR=3D"db2m"
> > +SBUILD_FLAVOR=3D"extra-packages"
> > diff --git a/meta-isar/recipes-core/images/isar-image-bas= e.bb
> <http://isar-image-base.bb>
> > <http://isar-image-base.bb <http://isar-image-bas= e.bb>>
> > b/meta-isar/recipes-core/images/isar-image-base.bb
> <http://isar-image-base.bb>
> > <http://isar-image-base.bb <http://isar-image-bas= e.bb>>
> > index b381d859..d635a3aa 100644
> > --- a/meta-isar/recipes-core/images/isar-image-base.bb
> <
http://isar-image-base.bb>
> > <http://isar-image-base.bb <http://isar-image-bas= e.bb>>
> > +++ b/meta-isar/recipes-core/images/isar-image-base.bb
> <
http://isar-image-base.bb>
> > <http://isar-image-base.bb <http://isar-image-bas= e.bb>>
> > @@ -10,4 +10,7 @@ LIC_FILES_CHKSUM =3D
> > "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=3D7= 51419260
> >
> > PV =3D "1.0"
> >
> > +SBUILD_FLAVOR =3D "extra-packages"
> > +SBUILD_CHROOT_INSTALL =3D "hello-isar"
> > +
> > inherit image
> > diff --git
> >
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chro= ot-host-db2m.bb <http://sbuild-chroot-host-db2m.bb> <= ;http://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> <http://= 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>
> > <http://sbuild-chroot-host-db2m.bb
> <http://sbuild-chroot-host-db2m.bb>>
> > rename to
> >
> meta-isar/recipes-devtools/sbuild-chroot/sbu= ild-chroot-host-extra-packages.bb <http://sbuild-chr= oot-host-extra-packages.bb> <http://sbuild-chroot= -host-extra-packages.bb <http://sbuild-chroot-host-e= xtra-packages.bb>>
> > index 1795c5a2..b035a926 100644
> > ---
> >
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chro= ot-host-db2m.bb <http://sbuild-chroot-host-db2m.bb> <= ;http://sbuild-chroot-host-db2m.bb <http://sbuild-chroot= -host-db2m.bb>>
> > +++
> >
> b/meta-isar/recipes-devtools/sbuild-chroot/s= build-chroot-host-extra-packages.bb <http://sbuild-c= hroot-host-extra-packages.bb> <http://sbuild-chro= ot-host-extra-packages.bb <http://sbuild-chroot-host= -extra-packages.bb>>
> > @@ -8,5 +8,5 @@ DESCRIPTION =3D "Isar sbuild/schroot fi= lesystem for
> > host (docbook-to-man)"
> >
> > require recipes-devtools/sbuild-chroot/sbuild-chroot-h= ost.bb
> <http://sbuild-chroot-host.bb>
> > <http://sbuild-chroot-host.bb <http://sbuil= d-chroot-host.bb>>
> >
> > -SBUILD_FLAVOR =3D "db2m"
> > +SBUILD_FLAVOR =3D "extra-packages"
> > SBUILD_CHROOT_PREINSTALL_EXTRA ?=3D "docbook-to-man"
> > diff --git
> >
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-ch= root-target-db2m.bb <http://sbuild-chroot-target-db2m.bb= > <http://sbuild-chroot-target-db2m.bb <http:/= /sbuild-chroot-target-db2m.bb>> b/meta-isar/recipes-devtools/sbui= ld-chroot/sbuild-chroot-target-extra-packages.bb <= ;http://sbuild-chroot-target-extra-packages.bb> &l= t;http://sbuild-chroot-target-extra-packages.bb <<= a href=3D"http://sbuild-chroot-target-extra-packages.bb" target=3D"_blank" = rel=3D"nofollow">http://sbuild-chroot-target-extra-packages.bb>>
> > similarity index 91%
> > rename from
> >
> meta-isar/recipes-devtools/sbuild-chroot/sbuild-chro= ot-target-db2m.bb <http://sbuild-chroot-target-db2m.bb&g= t; <http://sbuild-chroot-target-db2m.bb <http://s= build-chroot-target-db2m.bb>>
> > rename to
> >
> meta-isar/recipes-devtools/sbuild-chroot/s= build-chroot-target-extra-packages.bb <http://sbui= ld-chroot-target-extra-packages.bb> <http://sbu= ild-chroot-target-extra-packages.bb <http://sbuild= -chroot-target-extra-packages.bb>>
> > index e2e10433..80440df2 100644
> > ---
> >
> a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-ch= root-target-db2m.bb <http://sbuild-chroot-target-db2m.bb= > <http://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://sb= uild-chroot-target-extra-packages.bb> <http://s= build-chroot-target-extra-packages.bb <http://sbui= ld-chroot-target-extra-packages.bb>>
> > @@ -8,5 +8,5 @@ DESCRIPTION =3D "Isar sbuild/schroot fi= lesystem for
> > target (docbook-to-man)"
> >
> > require recipes-devtools/sbuild-chroot/sbuild-chroot= -target.bb
> <http://sbuild-chroot-target.bb>
> > <http://sbuild-chroot-target.bb <http= ://sbuild-chroot-target.bb>>
> >
> > -SBUILD_FLAVOR =3D "db2m"
> > +SBUILD_FLAVOR =3D "extra-packages"
> > SBUILD_CHROOT_PREINSTALL_EXTRA ?=3D "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 ?=3D "64"
> > diff --git
> > a/meta/classes/install-custom-packages-sbuild-flavor.bb= class
> > b/meta/classes/install-custom-packages-sbuild-flavor.bb= class
> > new file mode 100644
> > index 00000000..04650f51
> > --- /dev/null
> > +++ b/meta/classes/install-custom-packages-sbuild-flavo= r.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 =3D "extra-packages"
> > +SBUILD_CHROOT_INSTALL ??=3D ""
> > +
> > +SCHROOT_MOUNTS =3D "${WORKDIR}:${PP_WORK}
> > ${IMAGE_ROOTFS}:${PP_ROOTFS} ${DEPLOY_DIR_IMAGE}:${PP_D= EPLOY}"
> > +SCHROOT_MOUNTS +=3D "${REPO_ISAR_DIR}/${DISTRO}:/isar-= apt"
> > +
> > +ROOTFS_INSTALL_COMMAND:prepend =3D "
> > 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=3D"${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
> > + if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
> > + distro=3D"${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=3Dyes] file:///isar-apt ${DEBDISTR= ONAME} main' > \
> > + '/etc/apt/sources.list.d/isar-apt.list'
> > +
> > + mkdir -p '/etc/apt/preferences.d'
> > + cat << EOF > '/etc/apt/preferences.d/isar-ap= t'
> > +Package: ${SBUILD_CHROOT_INSTALL}
> > +Pin: release n=3D${DEBDISTRONAME}
> > +Pin-Priority: 1000
> > +EOF"
> > +
> > + E=3D"${@ 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=3D'sources.list.d/isar-apt.li= st' \
> > + -o Dir::Etc::SourceParts=3D'-' \
> > + -o APT::Get::List-Cleanup=3D'0'
> > + apt-get -o Debug::pkgProblemResolver=3Dyes --no-insta= ll-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=3Dyes --no-insta= ll-recommends
> -y \
> > + --allow-unauthenticated --allow-downgrades install \
> > + ${SBUILD_CHROOT_INSTALL}"
> > + fi
> > +
> > + remove_mounts
> > + schroot_delete_configs
> > +}
> > --
> > 2.39.2
> >
> >
> >
> > =C2=A0 =C2=A0 Any improvements needed in this patch , P= lease provide your
> thoughts.
> >
>=20
> I still don't get all the complexity here, specificially as = I just did
> what you did in [1] with just a DEPENDS.
>=20
> Jan
>=20
> [1]
> https://groups.google.com/d/msgid/isa= r-users/c1e5d483ee4fae79645d69ac95258a622c9b5a7d.1704190109.git.jan.kiszka%= 40siemens.com <https://groups.google.com/d/ms= gid/isar-users/c1e5d483ee4fae79645d69ac95258a622c9b5a7d.1704190109.git.jan.= kiszka%40siemens.com>
>=20
>=20
>=20
> =C2=A0 =C2=A0Hmm, Let me try with DEPENDS , but you added the de= pendencies 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.
>=20

That pattern is not for direct copying. But, as discussed, if you add
SBUILD_CHROOT_INSTALL_EXTRA which creates the necessary DEPENDS for t= he
sbuild flavor recipe, it should Just Work from my perspective.

Jan

--=20
Siemens AG, Technology
Linux Expert Center


=C2=A0 =C2=A0 =C2=A0 As per your changes in [1]=C2=A0https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae79645d69ac952= 58a622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com=C2=A0<https://groups.google.com/d/msgid/isar-users/c1e5d483ee4fae= 79645d69ac95258a622c9b5a7d.1704190109.git.jan.kiszka%40siemens.com><= /div>
how this DEPENDS is working?, you added keyutils custom package a= s a dependency in sbuild-chroot recipe, but for building this custom keyuti= ls
packages we should need sbuild-chroot-[host/target], then obvi= ously we may face dependency loop issue.

In my c= ase first i need to build all the custom packages first, then based on the = need basis i may install any custom packages in sbuild-chroot flavor [ the = persistent one] during image creation part.

what= i implemented so far:

List out the custom packa= ges that need to be install in sbuild-chroot via SBUILD_CHROOT_INSTALL_EXTR= A or SBUILD_CHROOT_INSTALL analogously IMAGE_[PRE]INSTALL in the image reci= pe, for this purpose i added=C2=A0 the provision to access the isar-apt to = install local packages in sbuild-chroot.

Present= ly isar-apt mount logic available in two places 1. during package build via= SBUILD (dpkg.bbclass) and 2. Imager creation part (f.e : wic )
<= br />
But my requirement is something need to install the custom = packages in sbuildchroot to do some postprocess the meta data before image = creation, for this reason we introduced another isar-apt mount logic in sep= arate class.


Thanks,
= Srinu
------=_Part_27794_1145628876.1704287469621-- ------=_Part_27793_544370569.1704287469621--