Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With the advanced grammar, only the last - to clause is respected #5255

Open
simondeziel opened this issue Feb 11, 2025 · 0 comments
Open

With the advanced grammar, only the last - to clause is respected #5255

simondeziel opened this issue Feb 11, 2025 · 0 comments

Comments

@simondeziel
Copy link
Member

Bug Description

In the LXD snap, we have some parts that are meant to be supported on some arches only. For example, we don't want to ship QEMU for armhf nor riscv64. As such, the qemu part is constructed to avoid installing the build-packages and the stage-packages when building for armhf/riscv64:

  qemu:
    build-packages:
      - to armhf:
        - cmake      # placeholder pkg (actually used by lxd part) to avoid installing build-packages on unsupported arches
      - to riscv64:
        - cmake      # placeholder pkg (actually used by lxd part) to avoid installing build-packages on unsupported arches
      - else:
        - bison
        - ...
        - librbd-dev
    stage-packages:
      - to armhf:
        - acl      # placeholder pkg (actually used by lxd part) to avoid installing stage-packages on unsupported arches
      - to riscv64:
        - acl      # placeholder pkg (actually used by lxd part) to avoid installing stage-packages on unsupported arches
      - else:
        - genisoimage
        - ...
        - qemu-system-data # This is needed due to --disable-install-blobs.
  ...

However, only the last - to $ARCH: clause seems to be respected as on armhf, the builds on LP builders always fail complaining that librbd-dev is not available. librbd-dev is indeed not available for armhf which is the whole reason why we try to exclude it with the - to/- else clauses.

The exclusion works for the - to riscv64: as neither librbd-dev nor qemu-system-data are found in the riscv64 build logs.

important: Inverting the - to armhf: and - to riscv64: made the armhf build work as it then stops trying to pull librbd-dev

To Reproduce

snapcraft remote-build --platform amd64,armhf,riscv64 on a cloned repo from https://github.com/canonical/lxd-pkg-snap

Environment

$ snap list snapcraft
Name       Version  Rev    Tracking       Publisher   Notes
snapcraft  8.6.1    13459  latest/stable  canonical✓  classic

snapcraft.yaml

https://github.com/canonical/lxd-pkg-snap/blob/f3327146996d52e66f8726a88766021f678e2575/snapcraft.yaml

Relevant log output

Running pull phase...
Initialising lifecycle
Installing build-packages
Cannot find package listed in 'build-packages': librbd-dev

Additional context

No response

simondeziel added a commit to simondeziel/lxd-pkg-snap that referenced this issue Feb 12, 2025
Only one `- to` clause is supported.

canonical/snapcraft#5255

Signed-off-by: Simon Deziel <[email protected]>
tomponline added a commit to canonical/lxd-pkg-snap that referenced this issue Feb 12, 2025
Due to canonical/snapcraft#5255, only one `-
to` clause is supported in `build-packages` and `stage-packages`.

Many of our parts would need exclusions for both `armhf` and `riscv64`
but since only one `- to` clause can be used, `armhf` was selected as it
has some packages that are not even installable (not available in
Noble/core24) while they are for `riscv64`.

This means `riscv64` will install some packages for no reasons but at
least it will work.

Another thing worth noting in this PR is the removal of the LXD docs
from the `armhf` build due to some Python wheels being missing for this
arch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant