repo: fix for multi-arch stage-package scenario
Metadata
Current evaluation
Merged in commit 4a75be6ec, fixing multi-arch stage-package dependency resolution with architecture-aware package lookup.
Resolution: closed resolved
Reason: PR #3080 was approved and merged as commit 4a75be6ec. It replaced ambiguous dependency target versions with or_dependencies and target-architecture lookup; follow-up #3083 reverted the deb_arch lookup after dpkg-architecture availability was flagged.
Evaluated by: mr-cal-bot
No scores available.
Issue body
When enabling multiple architectures, python-apt's BaseDependency
may yield target_versions for a package which are for the unintended
architecture when coming across a package with ':all' architecture.
For example: python3-pip has a dependency on "python3:any". On AMD64
it may point to the i386 package, when having i386 architectures
enabled:
```
>>> apt.Cache()["python3-pip"].candidate.dependencies[-1].target_versions
[
<Version: package:'python3:i386' version:'3.6.7-1~18.04'>,
<Version: package:'python3' version:'3.6.7-1~18.04'>,
<Version: package:'python3:i386' version:'3.6.5-3'>,
<Version: package:'python3' version:'3.6.5-3'>]
]
```
Instead, we'll look at python-apt's `or_dependencies` list, which is
used to calculate the allowable target_versions:
```
>>> apt.Cache()["python3-pip"].candidate.dependencies[-1].or_dependencies
<Dependency: [<BaseDependency: name:'python3:any' relation:'>=' version:'3.4~' rawtype:'Depends'>]>
```
apt.package.Dependency will provide us with the 'name', e.g.
'python3:any', and we can use this name to fetch the correct
dependencies.
To support installing the correct architecture, we now will pass
target_arch to _mark_package_dependencies() and
_get_resolved_package(). _get_resolved_package() will use the
now-introduced _get_package_for_arch() method to find the correct
package for the intended architecture:
1. First trying `<package-name>:<target-arch>`.
2. Then trying `<package-name>:all` in case it's a no-arch package.
3. Finally trying `<package-name>`, but logging a warning that
it may be the incorrect architecture. This shouldn't happen,
but the warning is there just so we'll know about it if there
is a case we didn't consider.
Update unit tests, cleaning out some old cruft left behind and
passing without purpose.
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged in commit 4a75be6ec, fixing multi-arch stage-package dependency resolution with architecture-aware package lookup. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3080 (commit 4a75be6ec) to fix multi-arch stage-package dependency resolution using or_dependencies and explicit target-architecture selection. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for multi-arch stage-package dependency resolution. Uses python-apt's or_dependencies to resolve architectures correctly, passes target_arch internally, and adds fallback logic. Approved and merged after test updates. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for multi-arch stage-package dependency resolution. Corrected python-apt dependency resolution for :all packages using or_dependencies and target_arch-aware lookup. Fixed unit test failures by updating FakeAptPackage mocks. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#3083
(confidence 95%)
Immediate follow-up that reverted the deb_arch lookup logic.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1050 repo: add multiarch support for stage packages. | snapcraft | merged | Merged #1050 added multiarch stage-package support via name:arch syntax, resolving LP #1655797 in commit 298f2fe85. | |
| #876 repo: allow for architecture-specific stage-packages | snapcraft | merged | Merged as 9d6f953a1 with package:arch support for stage-packages; the change was later reverted by #898 in 5ac55528f. | |
| #3084 repo: fix for multi-arch virtual-packages | snapcraft | merged | Merged PR #3084 as caf0e0ca5, fixing multi-architecture virtual-package resolution by checking provider architecture, restoring target_versions, and correcting the apt architecture API. | |
| #3459 repo: account for arch & version when filtering stage packages | snapcraft | closed | Closed unmerged and superseded by #3461, merged as commit 0bf7a2e66 to remove architecture and version qualifiers from stage-package filters. | |
| #3416 repo: default to target arch for stage package cache | snapcraft | merged | Merged #3416, defaulting stage package caches to the target architecture and adding Spread coverage; landed as commit 8f418e3d9. | |
| #3461 repo: account for arch & version when filtering stage packages | snapcraft | merged | Merged in snapcraft#3461 via commit 0bf7a2e66, adding DebPackage-based filtering so architecture and version qualifiers are excluded from package-name filters. | |
| #3740 repo: enable package repository architectures | snapcraft | merged | Merged PR #3740 via merge commit 7b848f76d; implementation 7e0403d runs dpkg --add-architecture for package-repository architectures. | |
| #136 fix: add multi-arch to package and control models | debcraft | merged | Merged PR #136 in commit 0777283, adding validated Debian Multi-Arch support to package and binary control models and fixing #125. |