sources: only add "compatible" architectures
Metadata
Current evaluation
Merged fix correcting dpkg parameter order and restricting architecture addition to compatible pairs (amd64/i386, arm64/armhf) to prevent system breaks. Approved, passed CI, and achieved 100% diff coverage.
Suggested action: —
No scores available.
Issue body
This commit both fixes the order of the parameters in the call to "dpkg --add-architecture" (the parser is picky) and updates the logic to only make said call if the target architecture (that is, the one coming from the package-repository definition) is "compatible" with the host architecture (that is, the architecture of the system running the code).
This is necessary because incompatible mixes typically break the system. For example, adding "armhf" on an "amd64" system breaks subsequent calls to "apt update" because apt will try to fetch package listings for the "armhf" architecture on the default Ubuntu archives, which don't have them.
Therefore, only the following pairs result in adding the target arch:
- host amd64, target i386;
- host arm64, target armhf.
- [ ] Have you followed the guidelines for contributing?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `tox`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix correcting dpkg parameter order and restricting architecture addition to compatible pairs (amd64/i386, arm64/armhf) to prevent system breaks. Approved, passed CI, and achieved 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix correcting dpkg --add-architecture parameter order and restricting architecture additions to compatible pairs (amd64/i386, arm64/armhf) to prevent system breaks. Merged into main with 100% diff coverage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3740 repo: enable package repository architectures | snapcraft | merged | Merged into main. Enables package repository architectures by running dpkg --add-architecture for listed architectures, resolving Launchpad bug #1973213. Approved and passed CI with full coverage. | |
| #255 fix: don't add armhf as a compatible arch for 25.10 and higher | craft-archives | merged | Merged fix for #230. Stops auto-adding armhf as a compatible architecture for arm64 on Ubuntu 25.10+. Users must manually configure ports.ubuntu.com via package-repositories. Includes a regression test and passed all CI checks. | |
| #3084 repo: fix for multi-arch virtual-packages | snapcraft | merged | Merged fix for multi-arch virtual package resolution. Correctly handles architecture tags, reverts or_dependencies to target_versions, and fixes an apt.Package.architectures method call. Approved and passed CI. |