internal: more gracefully determine host OS
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
- [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/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Currently snapcraft just reads the `/etc/os-release` file into a dict and accesses keys everywhere without caring whether or not they exist. This leads to difficult-to-diagnose errors on distros where e.g. the `VERSION_CODENAME` isn't set. That particular example includes Trusty, where we can use the VERSION_ID as a fallback to determine the codename.
Create a class around parsing `/etc/os-release` so we can gracefully fallback as appropriate. This allows the snapcraft snap to be used on Trusty, and also makes the errors when running on an unsupported distro more friendly.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged an update to gracefully parse /etc/os-release with fallbacks for host OS detection, enabling Ubuntu Trusty compatibility and improving error messages. The maintainer deferred exposing the parser publicly to a follow-up PR. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged graceful /etc/os-release parsing with fallbacks for host OS detection, enabling Trusty compatibility and friendlier errors. Maintainer approved and suggested future refactoring to a public API. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3646 utils: gracefully determine host os (CRAFT-845) | snapcraft | merged | 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. |