← Back to issue list

grammar: make on statement work with host arch

View original Github issue

Metadata

Project
snapcraft
Number
#1857
Type
pull request
State
merged
Author
kalikiana
Labels
—
Created
Updated
Closed

Current evaluation

Merged as b451f48fc: package selectors now distinguish host architecture with on, target architecture with to, and combined on-to cases.

Resolution: closed resolved

Reason: PR #1857 was approved and merged as commit b451f48fc. It implemented host/target architecture-qualified build and stage packages, combined selectors, and updated tests.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- This is changing the "on" statement [as discussed in the forum](https://forum.snapcraft.io/t/specifying-architecture-on-cross-compilations/1641/20) to work with the host architecture. This PR implements the **bold items**. 1. The existing “on <arch>:” syntax will be accepted under build-packages as well 2. The default architecture for packages under “on <arch>” is the one from the build machine 3. **Packages under “on <arch>:” are installed only when the build machine has that architecture** 4. A new “to <arch>:” statement will be supported in build-packages and stage-packages 5. The default architecture for packages under “to <arch>:” is the target architecture 6. Packages under “to <arch>:” are installed only when the target architecture is the one listed, which includes both a cross-compilation towards that architecture and a native build on that architecture 7. The two statements may be used together as “on <arch> to <arch>:” to precisely specify the case of a particular cross-compilation 8. The default architecture for packages under “on <arch> to <arch>:” is the target architecture Test cases are updated to reflect the new semantics.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as b451f48fc: package selectors now distinguish host architecture with on, target architecture with to, and combined on-to cases.
stealth/space-bunny-alpha — closed resolved Merged as b451f48fc, adding host/target architecture qualifiers for build- and stage-packages, combined on/to matching, and updated tests.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1857 via b451f48fc, making on match the host architecture and adding target to qualifiers for build and stage packages.
stealth/space-bunny-alpha — closed resolved Merged as commit b451f48fc "grammar: make on statement use host architecture (#1857)": adds host/target arch qualifiers ("on", new "to", combined "on X to Y") for build-packages/stage-packages, plus updated tests.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#1857 (b451f48fc), adding host/target architecture qualifiers for build and stage packages, combined on/to matching and updated tests.
qwen/qwen3.6-35b-a3b — — Merged. Updates Snapcraft grammar to support on and to statements for build and stage packages, enabling precise host and target architecture matching for cross-compilation. Approved by two reviewers, passed CI, and includes updated tests.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Updates grammar to support host and target architecture for build and stage packages. Introduces on, to, and combined on...to statements to conditionally install packages based on the build machine or target architecture. Tests passed.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#1639 (confidence 90%)

    Earlier work introduced the target-architecture to statement extended by this PR.

Related issues

Issue Project State Summary Similarity
#1639 grammar: to statement snapcraft merged Merged in canonical/snapcraft#1639 via f5e82e550, adding “to <arch>:” selectors and target-architecture defaults. Compound “on <arch> to <arch>:” support followed in #2088.
78%
#2088 grammar: support compound on..to statement snapcraft merged Merged PR #2088 in commit d81e0fa38, adding compound on <arch> to <arch> grammar and defaulting packages to the target architecture; fixes #1689.
76%
#3831 project: use correct host arch when target arch is set snapcraft merged Merged as commit 33088d59d: Project now tracks host Debian architecture separately, so --target-arch no longer overwrites it.
71%