← 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

Open, triaged Snapcraft bug: multiple advanced-grammar `to` clauses do not behave correctly, causing architecture-inappropriate packages and armhf build failures. Upstream craft-grammar#89 remains open.

Suggested action: keep open

Reason: The report provides a concrete multi-architecture reproducer, Snapcraft 8.6.1 environment, affected YAML, exact librbd-dev failure, and an inversion experiment confirming the ordering-dependent behavior. A maintainer marked the issue triaged, filed upstream craft-grammar#89, and added it to the pulse while noting that scoping is still needed; no resolving fix is identified.

Evaluated by: mr-cal-bot

Impact: 55 Quick Win: 18 Complexity: 62 Confidence: 92 Actionability: 84

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
stealth/space-bunny-alpha
Impact: 55
Quick Win: 18
Complexity: 62
Confidence: 92
Actionability: 84
keep open Open, triaged Snapcraft bug: multiple advanced-grammar `to` clauses do not behave correctly, causing architecture-inappropriate packages and armhf build failures. Upstream craft-grammar#89 remains open.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 27
Complexity: 45
Confidence: 80
Actionability: 75
keep open Multiple `- to $ARCH:` clauses in build-packages/stage-packages only respect the last one, causing wrong packages on multi-arch builds. Upstream bug filed in craft-grammar#89.
qwen/qwen3.8-27b
Impact: 65
Quick Win: 29
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.

Update history

No update history recorded yet.

Related work

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

    A maintainer explicitly filed this upstream bug for the unexpected behavior of multiple `to` statements; that issue remains open.

Related issues

Issue Project State Summary Similarity
#6064 Extend advanced grammer to all keys of snapcraft snapcraft open Advanced grammar remains limited to selected keys, limiting clean architecture-specific apps, part omission, and plugin parameters. The feature is untriaged; plugin-parameter support is tracked in craft-application #985.
71%