[v2,0/4] multiarch support

Message ID 20230220090511.2524881-1-adriaan.schmidt@siemens.com
Headers show
Series multiarch support | expand

Message

Schmidt, Adriaan Feb. 20, 2023, 9:05 a.m. UTC
This adds `<package>-compat` and `<package>-native` bitbake
targets to all recipes inheriting dpkg-base.

The new -compat build variant replaces the old compat mechanism.
Note that `ISAR_ENABLE_COMPAT_ARCH="1"` is still required to
ensure that the bootstrap and buildchroot is prepared correctly.

Adriaan

changes since v1:
- fixed an issue that prevented arch overrides of
  ISAR_ENABLE_COMPAT_ARCH, which is used in testsuite
- added `-native` expansion to contents of IMAGE_INSTALL
- documentation in user_manual

Adriaan Schmidt (4):
  bitbake.conf: use PACKAGE_ARCH in overrides
  add multiarch support
  remove obsolete compat-arch override
  doc: add compat/native targets to user manual

 doc/user_manual.md                            | 19 +++--
 .../recipes-app/hello-isar/hello-isar.bb      |  3 -
 meta-isar/recipes-app/libhello/libhello.bb    |  3 -
 .../recipes-app/samefile/samefile_2.14.bb     |  2 +-
 meta/classes/compat.bbclass                   | 46 ++++++++++++
 meta/classes/debianize.bbclass                |  2 +-
 meta/classes/dpkg-base.bbclass                |  1 +
 meta/classes/image.bbclass                    |  4 +-
 meta/classes/multiarch.bbclass                | 71 +++++++++++++++++++
 meta/classes/native.bbclass                   | 10 +++
 meta/conf/bitbake.conf                        |  6 +-
 .../isar-bootstrap/isar-bootstrap.inc         |  2 +
 .../sbuild-chroot/sbuild-chroot.inc           | 14 ++--
 testsuite/cibuilder.py                        |  2 +
 14 files changed, 160 insertions(+), 25 deletions(-)
 create mode 100644 meta/classes/compat.bbclass
 create mode 100644 meta/classes/multiarch.bbclass
 create mode 100644 meta/classes/native.bbclass

Comments

Uladzimir Bely Feb. 22, 2023, 1:40 p.m. UTC | #1
In the email from Monday, 20 February 2023 12:05:07 +03 user Adriaan Schmidt 
wrote:
> This adds `<package>-compat` and `<package>-native` bitbake
> targets to all recipes inheriting dpkg-base.
> 
> The new -compat build variant replaces the old compat mechanism.
> Note that `ISAR_ENABLE_COMPAT_ARCH="1"` is still required to
> ensure that the bootstrap and buildchroot is prepared correctly.
> 
> Adriaan
> 
> changes since v1:
> - fixed an issue that prevented arch overrides of
>   ISAR_ENABLE_COMPAT_ARCH, which is used in testsuite
> - added `-native` expansion to contents of IMAGE_INSTALL
> - documentation in user_manual
> 
> Adriaan Schmidt (4):
>   bitbake.conf: use PACKAGE_ARCH in overrides
>   add multiarch support
>   remove obsolete compat-arch override
>   doc: add compat/native targets to user manual
> 
>  doc/user_manual.md                            | 19 +++--
>  .../recipes-app/hello-isar/hello-isar.bb      |  3 -
>  meta-isar/recipes-app/libhello/libhello.bb    |  3 -
>  .../recipes-app/samefile/samefile_2.14.bb     |  2 +-
>  meta/classes/compat.bbclass                   | 46 ++++++++++++
>  meta/classes/debianize.bbclass                |  2 +-
>  meta/classes/dpkg-base.bbclass                |  1 +
>  meta/classes/image.bbclass                    |  4 +-
>  meta/classes/multiarch.bbclass                | 71 +++++++++++++++++++
>  meta/classes/native.bbclass                   | 10 +++
>  meta/conf/bitbake.conf                        |  6 +-
>  .../isar-bootstrap/isar-bootstrap.inc         |  2 +
>  .../sbuild-chroot/sbuild-chroot.inc           | 14 ++--
>  testsuite/cibuilder.py                        |  2 +
>  14 files changed, 160 insertions(+), 25 deletions(-)
>  create mode 100644 meta/classes/compat.bbclass
>  create mode 100644 meta/classes/multiarch.bbclass
>  create mode 100644 meta/classes/native.bbclass

Didn't look too deeply into the problem, but CI completely fails with the 
patchset, producing multiple errors like:

16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta-isar/recipes-
app/cowsay/cowsay_git.bb: armhf does not have a compat arch
16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta/recipes-
support/sshd-regen-keys/sshd-regen-keys_0.4.bb: i386 does not have a compat 
arch
Schmidt, Adriaan Feb. 22, 2023, 5:27 p.m. UTC | #2
Uladzimir Bely <ubely@ilbers.de>, Mittwoch, 22. Februar 2023 14:41
> In the email from Monday, 20 February 2023 12:05:07 +03 user Adriaan Schmidt
> wrote:
> > This adds `<package>-compat` and `<package>-native` bitbake
> > targets to all recipes inheriting dpkg-base.
> >
> > The new -compat build variant replaces the old compat mechanism.
> > Note that `ISAR_ENABLE_COMPAT_ARCH="1"` is still required to
> > ensure that the bootstrap and buildchroot is prepared correctly.
> >
> > Adriaan
> >
> > changes since v1:
> > - fixed an issue that prevented arch overrides of
> >   ISAR_ENABLE_COMPAT_ARCH, which is used in testsuite
> > - added `-native` expansion to contents of IMAGE_INSTALL
> > - documentation in user_manual
> >
> > Adriaan Schmidt (4):
> >   bitbake.conf: use PACKAGE_ARCH in overrides
> >   add multiarch support
> >   remove obsolete compat-arch override
> >   doc: add compat/native targets to user manual
> >
> >  doc/user_manual.md                            | 19 +++--
> >  .../recipes-app/hello-isar/hello-isar.bb      |  3 -
> >  meta-isar/recipes-app/libhello/libhello.bb    |  3 -
> >  .../recipes-app/samefile/samefile_2.14.bb     |  2 +-
> >  meta/classes/compat.bbclass                   | 46 ++++++++++++
> >  meta/classes/debianize.bbclass                |  2 +-
> >  meta/classes/dpkg-base.bbclass                |  1 +
> >  meta/classes/image.bbclass                    |  4 +-
> >  meta/classes/multiarch.bbclass                | 71 +++++++++++++++++++
> >  meta/classes/native.bbclass                   | 10 +++
> >  meta/conf/bitbake.conf                        |  6 +-
> >  .../isar-bootstrap/isar-bootstrap.inc         |  2 +
> >  .../sbuild-chroot/sbuild-chroot.inc           | 14 ++--
> >  testsuite/cibuilder.py                        |  2 +
> >  14 files changed, 160 insertions(+), 25 deletions(-)
> >  create mode 100644 meta/classes/compat.bbclass
> >  create mode 100644 meta/classes/multiarch.bbclass
> >  create mode 100644 meta/classes/native.bbclass
> 
> Didn't look too deeply into the problem, but CI completely fails with the
> patchset, producing multiple errors like:
> 
> 16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta-isar/recipes-
> app/cowsay/cowsay_git.bb: armhf does not have a compat arch
> 16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta/recipes-
> support/sshd-regen-keys/sshd-regen-keys_0.4.bb: i386 does not have a compat
> arch

Ah yes, of course I only tested the cases where a compat arch exists...

I looked into this, and this error (or the check that prints it) happens at
parse time. That's not good, because `*-compat` variants of recipes are
always parsed, whether someone wants to build them or not.

I have found two ways of solving this:

1. If compat cannot be built (either because ISAR_ENABLE_COMPAT_ARCH is not set,
or because there is no COMPAT_DISTRO_ARCH), don't provide the `*-compat` build targets.
Then a `bitbake hello-compat` would fail with:
===
builder@022f45995a49:/build$ bitbake hello-compat
Loading cache: 100% |####################################################################################| Time: 0:00:00
Loaded 113 entries from dependency cache.
Parsing recipes: 100% |##################################################################################| Time: 0:00:00
Parsing of 45 .bb files complete (6 cached, 39 parsed). 80 targets, 0 skipped, 0 masked, 0 errors.
ERROR: Nothing PROVIDES 'hello-compat'
===

2. Alternatively, I can check when actually starting the build. The best I could find
is prepending `do_fetch`, and then we would fail like this:
===
builder@022f45995a49:/build$ bitbake hello-compat
Loading cache: 100% |####################################################################################| Time: 0:00:00
Loaded 113 entries from dependency cache.
Parsing recipes: 100% |##################################################################################| Time: 0:00:00
Parsing of 45 .bb files complete (8 cached, 37 parsed). 113 targets, 0 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |###############################################################################| Time: 0:00:00
Sstate summary: Wanted 1 Local 0 Mirrors 0 Missed 1 Current 2 (0% match, 66% complete)
NOTE: Executing Tasks
ERROR: hello-compat-1.0-r0 do_fetch: i386 does not have a compat arch
ERROR: Logfile of failure stored in: /build/tmp/work/debian-bullseye-i386/hello-compat/1.0-r0/temp/log.do_fetch.83315
ERROR: Task (virtual:compat:/build/../repo/meta-isar/recipes-app/hello/hello.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 21 tasks of which 19 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  virtual:compat:/build/../repo/meta-isar/recipes-app/hello/hello.bb:do_fetch
Summary: There was 1 ERROR message, returning a non-zero exit code.
===

I strongly prefer (1.) because it fails earlier, before any tasks start running.
The downside is that we can't give a more detailed explanation why we're failing.

Any preferences?

Adriaan
Uladzimir Bely Feb. 22, 2023, 6:01 p.m. UTC | #3
In the email from Wednesday, 22 February 2023 20:27:28 +03 user Schmidt, Adriaan wrote:
> Uladzimir Bely <ubely@ilbers.de>, Mittwoch, 22. Februar 2023 14:41
> > In the email from Monday, 20 February 2023 12:05:07 +03 user Adriaan Schmidt
> > wrote:
> > > This adds `<package>-compat` and `<package>-native` bitbake
> > > targets to all recipes inheriting dpkg-base.
> > >
> > > The new -compat build variant replaces the old compat mechanism.
> > > Note that `ISAR_ENABLE_COMPAT_ARCH="1"` is still required to
> > > ensure that the bootstrap and buildchroot is prepared correctly.
> > >
> > > Adriaan
> > >
> > > changes since v1:
> > > - fixed an issue that prevented arch overrides of
> > >   ISAR_ENABLE_COMPAT_ARCH, which is used in testsuite
> > > - added `-native` expansion to contents of IMAGE_INSTALL
> > > - documentation in user_manual
> > >
> > > Adriaan Schmidt (4):
> > >   bitbake.conf: use PACKAGE_ARCH in overrides
> > >   add multiarch support
> > >   remove obsolete compat-arch override
> > >   doc: add compat/native targets to user manual
> > >
> > >  doc/user_manual.md                            | 19 +++--
> > >  .../recipes-app/hello-isar/hello-isar.bb      |  3 -
> > >  meta-isar/recipes-app/libhello/libhello.bb    |  3 -
> > >  .../recipes-app/samefile/samefile_2.14.bb     |  2 +-
> > >  meta/classes/compat.bbclass                   | 46 ++++++++++++
> > >  meta/classes/debianize.bbclass                |  2 +-
> > >  meta/classes/dpkg-base.bbclass                |  1 +
> > >  meta/classes/image.bbclass                    |  4 +-
> > >  meta/classes/multiarch.bbclass                | 71 +++++++++++++++++++
> > >  meta/classes/native.bbclass                   | 10 +++
> > >  meta/conf/bitbake.conf                        |  6 +-
> > >  .../isar-bootstrap/isar-bootstrap.inc         |  2 +
> > >  .../sbuild-chroot/sbuild-chroot.inc           | 14 ++--
> > >  testsuite/cibuilder.py                        |  2 +
> > >  14 files changed, 160 insertions(+), 25 deletions(-)
> > >  create mode 100644 meta/classes/compat.bbclass
> > >  create mode 100644 meta/classes/multiarch.bbclass
> > >  create mode 100644 meta/classes/native.bbclass
> > 
> > Didn't look too deeply into the problem, but CI completely fails with the
> > patchset, producing multiple errors like:
> > 
> > 16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta-isar/recipes-
> > app/cowsay/cowsay_git.bb: armhf does not have a compat arch
> > 16:29:04 ERROR: /workspace/build/isar_ub_devel_2_fast/125/meta/recipes-
> > support/sshd-regen-keys/sshd-regen-keys_0.4.bb: i386 does not have a compat
> > arch
> 
> Ah yes, of course I only tested the cases where a compat arch exists...
> 
> I looked into this, and this error (or the check that prints it) happens at
> parse time. That's not good, because `*-compat` variants of recipes are
> always parsed, whether someone wants to build them or not.
> 
> I have found two ways of solving this:
> 
> 1. If compat cannot be built (either because ISAR_ENABLE_COMPAT_ARCH is not set,
> or because there is no COMPAT_DISTRO_ARCH), don't provide the `*-compat` build targets.
> Then a `bitbake hello-compat` would fail with:
> ===
> builder@022f45995a49:/build$ bitbake hello-compat
> Loading cache: 100% |####################################################################################| Time: 0:00:00
> Loaded 113 entries from dependency cache.
> Parsing recipes: 100% |##################################################################################| Time: 0:00:00
> Parsing of 45 .bb files complete (6 cached, 39 parsed). 80 targets, 0 skipped, 0 masked, 0 errors.
> ERROR: Nothing PROVIDES 'hello-compat'
> ===
> 
> 2. Alternatively, I can check when actually starting the build. The best I could find
> is prepending `do_fetch`, and then we would fail like this:
> ===
> builder@022f45995a49:/build$ bitbake hello-compat
> Loading cache: 100% |####################################################################################| Time: 0:00:00
> Loaded 113 entries from dependency cache.
> Parsing recipes: 100% |##################################################################################| Time: 0:00:00
> Parsing of 45 .bb files complete (8 cached, 37 parsed). 113 targets, 0 skipped, 0 masked, 0 errors.
> NOTE: Resolving any missing task queue dependencies
> Initialising tasks: 100% |###############################################################################| Time: 0:00:00
> Sstate summary: Wanted 1 Local 0 Mirrors 0 Missed 1 Current 2 (0% match, 66% complete)
> NOTE: Executing Tasks
> ERROR: hello-compat-1.0-r0 do_fetch: i386 does not have a compat arch
> ERROR: Logfile of failure stored in: /build/tmp/work/debian-bullseye-i386/hello-compat/1.0-r0/temp/log.do_fetch.83315
> ERROR: Task (virtual:compat:/build/../repo/meta-isar/recipes-app/hello/hello.bb:do_fetch) failed with exit code '1'
> NOTE: Tasks Summary: Attempted 21 tasks of which 19 didn't need to be rerun and 1 failed.
> 
> Summary: 1 task failed:
>   virtual:compat:/build/../repo/meta-isar/recipes-app/hello/hello.bb:do_fetch
> Summary: There was 1 ERROR message, returning a non-zero exit code.
> ===
> 
> I strongly prefer (1.) because it fails earlier, before any tasks start running.
> The downside is that we can't give a more detailed explanation why we're failing.
> 
> Any preferences?
> 
> Adriaan
> 

It seems (2.) also fails early enough, but we have to wait for debootstrap parallel tasks finished. So I'm for (1.).