project: always set target arch even if not cross compiling
Metadata
Current evaluation
Merged a change that always sets the target architecture, even during native builds. This avoids special-casing None in apt_cache and ensures SNAPCRAFT_TARGET_ARCH is consistently defined. Approved by one reviewer and passed CI checks.
Suggested action: —
No scores available.
Issue body
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged a change that always sets the target architecture, even during native builds. This avoids special-casing None in apt_cache and ensures SNAPCRAFT_TARGET_ARCH is consistently defined. Approved by one reviewer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. The target architecture is now always explicitly set, even for native builds. This removes special-case None handling in apt_cache by consistently applying the architecture across all code paths, including SNAPCRAFT_TARGET_ARCH. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. The change always sets the target architecture, even for native builds. This removes special-case None handling in apt_cache and SNAPCRAFT_TARGET_ARCH by consistently writing the correct architecture to the build tree. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4332 environment: error when build-for arch variable cannot be evaluated | snapcraft | merged | 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. | |
| #3416 repo: default to target arch for stage package cache | snapcraft | merged | Merged into master following approval and passing CI. The change defaults the stage package cache to the target architecture, updates 22 files, and adds spread tests to verify the behavior. | |
| #1813634 not reliable way to detect target architecture | snapcraft (launchpad) | open | Snapcraft 3.0.1: project.target_arch and SNAPCRAFT_ARCH_TRIPLET give inconsistent values for target arch across native, cross, and multi-arch (build-on/run-on) builds. No maintainer response, no labels, inactive ~7 years. | |
| #3831 project: use correct host arch when target arch is set | snapcraft | merged | Merged a fix introducing a dedicated property to store the host deb architecture. This prevents incorrect architecture assignment when --target-arch is specified, resolving singleton conversion issues. | |
| #532 environment: add build-on and build-for architectures | craft-parts | merged | Merged following approval and CI checks. Introduces CRAFT_ARCH_BUILD_ON and CRAFT_ARCH_BUILD_FOR environment variables to standardize architecture naming, deprecating CRAFT_TARGET_ARCH and CRAFT_ARCH_TRIPLET. Resolves #514. |