build provider: clean incompatible build-environments
Metadata
Current evaluation
Merged updates to clean incompatible build environments caused by base mismatches, missing base records, or version differences. Implemented Debian-compliant version comparison and updated test scenarios. Approved and merged.
Suggested action: —
No scores available.
Issue body
1. If base doesn't match, clean the instance. (Existing behavior)
2. If base was not recorded, clean the instance. This should fix
issues where environment was created by legacy snapcraft. (New)
3. If instance was created by newer snapcraft, clean the instance.
This should fix issues where build environment was created by
newer snapcraft versions which makes environment modifications
incompatible with older versions. (New)
- Update test scenarios to cover each compatbility scenario.
- Update SNAP_VERSION fixture to "4.0" for more realistic version.
- Use apt_pkg's version_compare to compare versions using debian
rules.
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 updates to clean incompatible build environments caused by base mismatches, missing base records, or version differences. Implemented Debian-compliant version comparison and updated test scenarios. Approved and merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Cleans build environments when base mismatches, base is unrecorded from legacy snapcraft, or environment was created by a newer version. Adds tests and uses apt_pkg version comparison to ensure compatibility. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged changes to clean incompatible build environments when base mismatches, lacks legacy snapcraft records, or originates from newer versions. Test coverage updated and version comparison uses apt_pkg.version_compare. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3434 build providers: clean environment if project directory is changed | snapcraft | merged | Merged into master. Fixes environment cleanup when project directories are relocated or reused. The build provider now tracks the directory path, verifies compatibility, and automatically cleans the environment on mismatch. Approved and passed CI. | |
| #3216 build providers: tweak environment clean detection and logging | snapcraft | merged | Merged. Updated build environment cleaning detection and logging messages for accuracy and consistency. Refactored checks into a single _check_environment_needs_cleaning() function to consolidate clean_project() calls. Approved and merged by maintainer cjp256. | |
| #2623 build environment: detect base type and use name | snapcraft | merged | Merged. Implements build environment detection for base type and name, introducing build-base configuration to decouple build and runtime bases. Approved, passed CI, and merged following successful local testing and reviewer discussion. | |
| #3202 build providers: fix base change warning message | snapcraft | merged | Merged after approval and passing CI. The pull request fixes the base change warning message in build providers, updating one file with four additions and two deletions. |