← Back to issue list

utils: gracefully determine host os (CRAFT-845)

View original Github issue

Metadata

Project
snapcraft
Number
#3646
Type
pull request
State
merged
Author
cmatsuoka
Labels
Created
Updated
Closed

Current evaluation

Merged into snapcraft/7.0. Adds a class to parse /etc/os-release for graceful host OS detection and fallback when VERSION_CODENAME is unset. Forward-ported from prior work, approved, passed CI, and achieved 100% diff coverage.

Suggested action:

No scores available.

Issue body

Create a class around parsing `/etc/os-release` so we can gracefully fallback as appropriate when e.g. `VERSION_CODENAME` isn't set. This is a forward port of a25cfcc (PR #1636) by Kyle Fazzari. Co-authored-by: Kyle Fazzari <kyrofa@ubuntu.com> Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com> - [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] 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 into snapcraft/7.0. Adds a class to parse /etc/os-release for graceful host OS detection and fallback when VERSION_CODENAME is unset. Forward-ported from prior work, approved, passed CI, and achieved 100% diff coverage.
qwen3.6-35b-a3b-mtp-q6 Merged a forward port implementing graceful host OS detection by parsing /etc/os-release with fallbacks for missing fields like VERSION_CODENAME. Integrated into the 7.0 branch with 100% diff coverage.
qwen3.6-35b-a3b-mtp-q6 Merged into snapcraft/7.0. Implements graceful host OS detection by parsing /etc/os-release with fallbacks for missing fields. Forward port of PR #1636. Achieved 100% diff coverage.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3707 repo: get host architecture using non-legacy code snapcraft merged Merged into snapcraft/7.0. Replaced the legacy host architecture detection hook with the OsPlatform class. Approved by reviewer, passed CI, and modified two files with a net reduction of five lines.
75%
#1636 internal: more gracefully determine host OS snapcraft merged Merged a refactoring that replaces direct /etc/os-release parsing with a robust class handling missing keys and fallbacks, enabling Ubuntu Trusty support and improving error messages. A follow-up PR will expose the API publicly.
74%
#1527 repo: Use os-release(5) to detect supported Linux distributions snapcraft merged Merged after replacing the deprecated platform.linux_distribution method with /etc/os-release for Linux detection. Refactored into snapcraft/internal/common.py per reviewer feedback, approved by three reviewers, passed CI, and modified 10 files.
71%