environment: error when build-for arch variable cannot be evaluated
Metadata
Current evaluation
Merged PR #4332 (48bd0632f) now errors on unevaluable core20 SNAPCRAFT_ARCH_BUILD_FOR and SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR variables instead of producing "None".
Resolution: closed resolved
Reason: PR #4332 was merged as commit 48bd0632f and explicitly resolves #4314. It adds validation for build-for architecture variables that cannot be evaluated.
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] Have you successfully run `make lint`?
- [x] Have you successfully run `pytest tests/unit`?
-----
For core20 snaps, if the project variable `SNAPCRAFT_ARCH_BUILD_FOR` or `SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR` cannot be determined and is used in a snapcraft.yaml file, then an error is raised.
cc @cmatsuoka - this may be a good reference for https://github.com/canonical/craft-parts/issues/514
Resolves #4314
(CRAFT-1963)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #4332 (48bd0632f) now errors on unevaluable core20 SNAPCRAFT_ARCH_BUILD_FOR and SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR variables instead of producing "None". | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #4332 in commit 48bd0632f, resolving #4314 by rejecting unevaluable core20 build-for architecture variables instead of producing the literal "None". | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Resolves #4314 by raising an error instead of silently evaluating to None when SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR cannot be determined for core20 snaps. Approved by three reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to main. Resolves #4314. Fixes core20 builds where SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR could not be evaluated. Previously, None values became the string None; the fix now raises an explicit error instead. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
snapcore/snapcraft#4314
(confidence 100%)
PR #4332 explicitly resolves this issue.
-
Related To:
canonical/craft-parts#514
(confidence 90%)
Referenced as prior art for build-on and build-for environment variables.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1997752 base core20: wrong arch triplet | snapcraft (launchpad) | closed | Wrong SNAPCRAFT_ARCH_TRIPLET for core20 build-on/run-on builds fixed by adding SNAPCRAFT_ARCH_BUILD_ON/BUILD_FOR and *_TRIPLET_BUILD_FOR envvars (PR #4313, commit 93a9d8170); follow-up #4332 (48bd0632f) errors on unevaluable multi-arch cases. | |
| #4313 environment: add build-on and build-for envvars for core20 | snapcraft | merged | Merged PR #4313 as 93a9d8170, adding core20 SNAPCRAFT build-on/build-for architecture and triplet environment variables plus tests. | |
| #4314 Raise error when using `BUILD_FOR` envvars on multi-arch and unknown builds | snapcraft | closed | Fixed by PR #4332 (commit 48bd0632f), which makes Snapcraft error when BUILD_FOR architecture variables cannot be evaluated for multi-arch or unknown-architecture builds. | |
| #3414 project loader: export SNAPCRAFT_TARGET_ARCH in build environment | snapcraft | merged | Merged PR #3414 (commit ff2cd96bb) added SNAPCRAFT_TARGET_ARCH to the global build environment in set_global_environment() for core22, alongside SNAPCRAFT_ARCH_TRIPLET. | |
| #3568 cli: enable SNAPCRAFT_TARGET_ARCH envvar matching --target-arch | snapcraft | closed | Closed unmerged after maintainers rejected expanding environment-variable support for CLI options; SNAPCRAFT_TARGET_ARCH was not accepted as an alternative to --target-arch. | |
| #4486 $CRAFT_ARCH_TRIPLET_BUILD_FOR doesn't work on core22 | snapcraft | closed | Fixed in Snapcraft 8: core22 app environment blocks now expand CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET. |