meta: use build-for in snap.yaml architecture
Metadata
Current evaluation
Merged fix correcting snap.yaml architecture generation. When build-for is set to all, the file now correctly outputs architectures: all instead of the previous incorrect build-on value. Resolves CRAFT-1535.
Suggested action: —
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] Have you successfully run `make lint`?
- [X] Have you successfully run `pytest tests/unit`?
-----
### Details
Previously, using `build-for: all` in a snapcraft project would cause `meta/snap.yaml` to contain the `build-on` architecture, due to [this line](https://github.com/snapcore/snapcraft/blob/2f2d1eac63de39dbd4f9bbfab8ffa5df0ac9ca62/snapcraft/parts/parts.py#L88) from my first implementation of adding support for the `architectures` keyword.
Now, `build-for: all` will cause `meta/snap.yaml` to use `architectures: all`.
### Source
https://bugs.launchpad.net/snapcraft/+bug/1999580
https://forum.snapcraft.io/t/incorrect-architecture-with-snapcraft-7-x-and-build-for-build-on/34130
(CRAFT-1535)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix correcting snap.yaml architecture generation. When build-for is set to all, the file now correctly outputs architectures: all instead of the previous incorrect build-on value. Resolves CRAFT-1535. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Fixed meta/snap.yaml to set architectures: all when build-for: all is used, replacing the incorrect build-on fallback. Resolves bug 1999580. Merged with 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Corrects snap.yaml generation so build-for: all sets architectures: all instead of build-on. Resolves CRAFT-1535 and Launchpad bug #1999580. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3821 meta: architectures | snapcraft | merged | Merged adding build-on and build-for architecture support for core22 snaps. Introduced the SNAPCRAFT_BUILD_FOR environment variable to limit builds. Temporarily drafted to fix a duplicate build regression before final merge. | |
| #335 fix: use `build-for` when evaluating project variables | craft-application | merged | Merged fix for BUILD_FOR variable evaluation by passing the build-for architecture to craft-parts. Resolves snapcraft issue #4770. Approved by two reviewers, passed CI, and merged after rebasing onto the hotfix/2.6 branch. | |
| #1885150 Cannot use --build-on, architecture list is already set in snapcraft.yaml. | snapcraft (launchpad) | closed | Closed without fix due to inactivity. The --build-on CLI flag remains ignored when architectures is defined in snapcraft.yaml, requiring manual YAML edits for architecture-specific builds. | |
| #1379 fix: make snap build on all architectures. (#1377) | charmcraft | closed | Merged to fix snap build failures across multiple architectures. Successfully enabled builds for armhf, arm64, ppc64el, and s390x, resolving issue #1369. | |
| #5335 `build-on` when running snapcraft locally uses stage packages from the wrong architecture | snapcraft | closed | Closed as expected behavior. Snapcraft uses the build-on architecture for stage-packages. Cross-compilation requires suffixing packages with :$CRAFT_ARCH_BUILD_FOR. Correct usage is now documented in the official Snapcraft guides. | |
| #1377 fix: make snap build on all architectures. | charmcraft | merged | Merged to resolve issue #1369 by enabling snap builds across armhf, arm64, ppc64el, and s390x. Approved by two reviewers, the two-file change (+25/-40 lines) updates build configurations for full multi-platform compatibility. |