repo: restore marked-install strategy for apt-cache
Metadata
Current evaluation
Merged after approval and CI. Restores the marked-install strategy for apt-cache by refactoring AptCache for safe cache handling. Fixes a primed-stage-packages parsing bug and improves stage package dependency management.
Suggested action: —
No scores available.
Issue body
Re-introduce refactored AptCache to wrap apt-cache usage.
Use it in read-only mode for working with the host cache
for use with build-packages, and use it to create a new
transient cache for use with handling stage packages. It
will symlink the host /etc/apt configuration so it matches
the host configuration, but allow for an empty cache to mark
packages and dependencies for fetching.
The strategy of marking stage packages ourselves was more
complicated than it appeared, and this achieves a far better
result with less risk of affecting existing snaps.
Additionally this fixes primed-stage-packages, which mistakenly
was using a `:` instead of `=` to split the name and version.
TODO: unit tests and a spread test for the manifest
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 after approval and CI. Restores the marked-install strategy for apt-cache by refactoring AptCache for safe cache handling. Fixes a primed-stage-packages parsing bug and improves stage package dependency management. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Restores apt-cache marked-install strategy by refactoring AptCache to safely manage host and transient caches for stage packages. Fixes a primed-stage-packages parsing bug that incorrectly used a colon instead of an equals sign. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Restores the marked-install strategy for apt-cache by refactoring AptCache for read-only host and transient stage package caching. Fixes a parsing bug in primed-stage-packages that incorrectly used a colon instead of an equals sign for name-version splitting. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3411 repo: only install build packages marked for installation | snapcraft | merged | Merged a fix updating apt_cache.get_marked_packages() to exclude packages marked for deletion. The function now only returns packages intended for installation, letting apt handle removals. Approved and merged after passing CI. | |
| #3030 repo: drop _AptCache and add migrate to install_stage_packages() | snapcraft | merged | Merged refactoring removing _AptCache and consolidating repo logic into install_stage_packages(). Uses system apt cache for performance, updates tests, and migrates ROS plugins. Approved; +490/-1009 lines across 18 files. | |
| #1446 fix(apt_cache): set all candidate versions before marking packages | craft-parts | merged | Merged a fix for apt_cache splitting mark_packages into two passes. Pass one sets candidate versions, pass two marks packages, preventing resolver failures when dependency candidates differ. Resolves #1444. Approved and passed CI. | |
| #43 packages: add support to apt cache operations | craft-parts | merged | Merged PR adding apt cache operations for package retrieval. Approved by two reviewers and passed CI. Follows snapcraft standards and is planned for future migration to a separate project. | |
| #3177 repo: consider virtual pkgs for cache invalidation | snapcraft | merged | Merged. Updates cache invalidation to include virtual packages, adding a warning to discourage their use for deterministic builds. Refactors AptCache logic for better separation of concerns. Approved by one reviewer and passed CI. | |
| #1468 fix(deb): refresh apt cache before marking packages | craft-parts | merged | Merged a fix refreshing the apt cache before package marking to prevent BuildPackageNotFound errors from stale caches. Approved by three reviewers and merged after CI flakiness was confirmed as environment-related. | |
| #118 packages/apt: use host state for apt cache (CRAFT-487) | craft-parts | merged | Merged. Replaces split stage apt cache with host cache at /var/lib/apt, removing update() and making refresh_stage_packages_list() a noop. Approved by two reviewers with passing CI. Compatible with snapcraft and craft-providers workflows. |