← 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

PR #3646 (CRAFT-845) merged into snapcraft/7.0 as commit dcee4f58, forward-porting commit a25cfcc from #1636: added snapcraft/os_release.py with an OsRelease class for graceful /etc/os-release parsing and codename fallbacks.

Resolution: closed resolved

Reason: The PR itself was merged: commit dcee4f585 'Merge pull request #3646 from cmatsuoka/craft-845/os-release-from-legacy' added snapcraft/os_release.py with unit tests (tests/unit/test_os_release.py), and Codecov reported 100% diff coverage. It forward-ports the earlier merged #1636 (commit a25cfcc).

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved PR #3646 (CRAFT-845) merged into snapcraft/7.0 as commit dcee4f58, forward-porting commit a25cfcc from #1636: added snapcraft/os_release.py with an OsRelease class for graceful /etc/os-release parsing and codename fallbacks.
stealth/space-bunny-alpha — closed resolved Merged #3646 into snapcraft/7.0, forward-porting #1636 to add robust /etc/os-release host OS detection with graceful handling of missing VERSION_CODENAME.
stealth/space-bunny-alpha — closed resolved Merged into snapcraft/7.0 as dcee4f585 (#3646), adding an /etc/os-release parser with graceful host OS detection when VERSION_CODENAME is unset.
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.

Update history

No update history recorded yet.

Related work

  • Superseded By: canonical/snapcraft#1636 (confidence 90%)

    The body states this is a forward port of commit a25cfcc (PR #1636, 'internal: more gracefully determine host OS'), which already added the same OsRelease class to the legacy branch.

Related issues

Issue Project State Summary Similarity
#1722650 snapcraft requires optional VERSION_ID in os-release snapcraft (launchpad) closed Fixed by merged PR snapcore/snapcraft#1623 (commit b335ed471), removing the required os-release VERSION_ID; PR #1636 further improved host OS detection.
74%
#1636 internal: more gracefully determine host OS snapcraft merged Merged #1636 (a25cfcc12), adding graceful /etc/os-release parsing, Trusty codename fallbacks, and clearer errors for unsupported distributions.
73%