← Back to issue list

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

View original Github issue

Metadata

Project
snapcraft
Number
#5255
Type
issue
State
open
Author
simondeziel
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Advanced grammar bug: when a list has multiple `- to <arch>` clauses plus `else`, only the last `to` clause is respected, so e.g. armhf still pulls packages meant for other arches. Triaged, tracked upstream at craft-grammar#89, and added to a snapcraft pulse (June 2025) pending scoping; no fix yet.

Suggested action: keep open

Reason: Maintainers have triaged this (Status: Triaged, Type: Bug labels), filed the upstream bug at canonical/craft-grammar#89, and in June 2025 sergiusens asked to get it fixed next pulse and mr-cal confirmed it was added to the pulse pending scoping. The upstream craft-grammar#89 is still open and the current craft-grammar code still processes `to` clauses one at a time with no fix commit found, so the issue remains valid and actively tracked.

Impact: 65 Quick Win: 29.25 Staleness: 45 Complexity: 55 Confidence: 80 Support Request: 5

Issue body

### 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 ```yaml https://github.com/canonical/lxd-pkg-snap/blob/f3327146996d52e66f8726a88766021f678e2575/snapcraft.yaml ``` ### Relevant log output ```shell Running pull phase... Initialising lifecycle Installing build-packages Cannot find package listed in 'build-packages': librbd-dev ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 65
Quick Win: 29.25
Staleness: 45
Complexity: 55
Confidence: 80
Support Request: 5
keep open Advanced grammar bug: when a list has multiple `- to <arch>` clauses plus `else`, only the last `to` clause is respected, so e.g. armhf still pulls packages meant for other arches. Triaged, tracked upstream at craft-grammar#89, and added to a snapcraft pulse (June 2025) pending scoping; no fix yet.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 45
Confidence: 90
Support Request: 5
keep open Bug where multiple `- to <arch>` clauses in build/stage-packages only respect the last one. Triaged, upstream craft-grammar issue created, currently awaiting scoping for next pulse.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 50
Confidence: 90
Support Request: 10
keep open Bug in Snapcraft's advanced grammar where multiple - to <arch> clauses in package lists only respect the last one, causing incorrect package resolution on specific architectures. Currently triaged, with an upstream fix tracked and added to a development pulse for scoping.
qwen3.6-35b-a3b-mtp-q6
Staleness: 15
Complexity: 40
Confidence: 90
Support Request: 0
keep open Snapcraft grammar bug where only the last - to $ARCH: clause is respected, causing incorrect architecture-specific package installation. Triaged,

Update history

No update history recorded yet.

Related work

  • Blocked By: canonical/craft-grammar#89 (confidence 90%)

    mr-cal explicitly filed this upstream bug for the same multiple-`to`-statement behavior; the fix belongs in the craft-grammar parser, so this snapcraft issue is blocked on that work.

Related issues

No related issues found above the similarity threshold.