build providers: setup initial apt source configuration
Metadata
Current evaluation
Merged refactoring centralizing snapcraft initialization in the base provider and adding apt source configuration via environment flags. Fixed a file permission error and streamlined installation. Approved and merged after CI checks.
Suggested action: —
No scores available.
Issue body
To move this into base provider nicely, some minor refactoring
included:
- _setup_snapcraft() is no longer responsibility of setup_environment,
instead invoked on all launched instances.
- snapcraft refresh is no longer responsibility of setup_snapcraft(),
instead invoked on all launched instances. This will ensure the
cache is always up-to-date.
- refactor _setup_snapcraft_files -> install_file(), modifying the
use of NamedTemporaryFile to set the suffix as the file's basename,
which is handy for testing.
- refactor list of dictionary of files into successive calls of
install_file().
- add apt sources configuration, using
SNAPCRAFT_BUILD_ENVIRONMENT_PRIMARY_MIRROR and
SNAPCRAFT_BUILD_ENVIRONMENT_SECURITY_MIRROR flags
- move _get_code_name_from_build_base() from lxd to base provider
as it's now required for all providers.
- fixes errorneous mode 06444 set for sources.list.
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 refactoring centralizing snapcraft initialization in the base provider and adding apt source configuration via environment flags. Fixed a file permission error and streamlined installation. Approved and merged after CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged refactoring that centralizes snapcraft initialization, adds apt source configuration via environment flags, moves code name detection to the base provider, and fixes file permissions in the build providers module. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged by cjp256. Refactored snapcraft environment setup, moved helper functions to the base provider, and added initial apt source configuration via environment flags. Fixed an erroneous 06444 file permission mode for sources.list. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2507 build providers: improve handling in snap logic | snapcraft | merged | Merged. Improved snap provider logic by cleaning up channel warnings, removing unnecessary sudo calls, and silencing noisy refresh hold commands. Approved, passed CI, and modified 5 files (+131/-73 lines). | |
| #2309 snap: improve early base detection logic | snapcraft | merged | Merged. Resolved early base detection failure in build providers by updating logic to account for snapcraft's non-project directory execution. Approved by reviewer, passed CI, and merged with minimal changes. | |
| #2174 build_providers: inject snaps when running from a snap | snapcraft | merged | Merged. Updates build providers to inject snapcraft and its base from the host when running inside the snapcraft snap, ensuring parity with non-snap environments. Approved by reviewer and passed CI checks. | |
| #2773 build providers: inject snapd snap for latest feature availability | snapcraft | merged | Merged changes that inject the snapd snap into build providers instead of core, improving feature availability and reducing size. Approved by reviewer, passed CI, and modified 4 files (+59/-12 lines). | |
| #3146 build providers: snap sw to channels if injecting | snapcraft | merged | Merged fix that prevents automatic channel switching to latest/stable when injecting snaps with revision assertions during build provider setup. Approved by reviewer, passed CI, and integrated. | |
| #8 feat: support build-packages | snapcraft-rocks | merged | Merged a feature adding a wrapper script to run apt update before Snapcraft, resolving an empty Apt cache issue in the base Ubuntu image. Approved by reviewers and rebased to pass tests before merge. | |
| #4462 build(deps): bump craft-providers to 1.20.1 | snapcraft | merged | Merged update bumping craft-providers to 1.20.1. Fixes a bug where improperly set-up base instances cause snapcraft failures by updating base compatibility tags and adding auto-cleanup for inactive instances. Approved and passed CI. | |
| #2281 build providers: re-exec as root | snapcraft | merged | Merged changes to re-execute snapcraft as root when invoked from a managed-host environment, resolving Launchpad bug #1791977. Approved by a reviewer, passed CI checks, and modified one file with 13 additions. | |
| #2509 build providers: initial support for LXD | snapcraft | merged | Merged initial LXD build provider support for snapcraft, enabling the --use-lxd flag for lifecycle steps and cleaning. Passes CI. Reviewers noted minor dependency and container setup edge cases, which were clarified or deferred. | |
| #2394 build providers: fix osx non base and injection | snapcraft | merged | Merged fix for macOS build provider non-base and injection issues. Approved by one reviewer, passed CI, and updated five files to resolve SNAPCRAFT-78, SNAPCRAFT-7A, and Launchpad bug 1801965. |