build providers: tweak environment clean detection and logging
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Requires #3215
This error is often incorrect:
f"Build environment was created with unknown snapcraft version {built_by!r}, cleaning."
Update to more accurately describe that we simply don't know its state:
"Build environment is in unknown state, cleaning first."
For consistency, also reword the following by specifying "first":
(2) f"Project base changed from {provider_base!r} to {build_base!r}, cleaning build instance."
-> f"Project base changed from {provider_base!r} to {build_base!r}, cleaning first."
(3) f"Build environment was created with newer snapcraft version {built_by!r}, cleaning."
-> f"Build environment was created with newer snapcraft version {built_by!r}, cleaning first."
Pull these checks into new function '_check_environment_needs_cleaning()',
so there is only one call to clean_project().
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updated build environment cleaning detection and logging for accuracy and consistency. Refactored checks into _check_environment_needs_cleaning() to consolidate clean_project() calls. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updated build environment cleaning detection messages for accuracy and consistency. Refactored checks into _check_environment_needs_cleaning() to consolidate clean_project() calls. |
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. | |
| #3105 build provider: clean incompatible build-environments | snapcraft | merged | 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. | |
| #410 providers: introduce clean_project_environments() (CRAFT-314) | charmcraft | merged | Merged to introduce clean_project_environments(), providing an interface for an upcoming clean command that removes all environments for a given project. Approved by two reviewers, adding 106 lines across two files. |