Skip to content

tool-cache._getOsVersion should improve to detect RHEL compatible Linux distro version. #1493

@ganadist

Description

@ganadist

Describe the enhancement

tool-cache._getOsVersion() had been using /etc/lsb-release to detect Linux OS versions, but recently, it was improved to use /etc/os-release from systemd : #594

But it used VERSION_ID only, and it does not process Linux distro information.

IMHO, the purpose of tool-cache._getOsVersion() is to distinguish the ABI of the OS.
So, I propose to improve it as follows.

  • Return PLATFORM_ID first if it is available from /etc/os-release

    • RHEL based Linux distros provides PLATFORM_ID which OS is compatible.
      • RHEL 8.x, CentOS 8.x, and Rocky Linux 8.x have same PLATFORM_ID=platform:el8
  • Return old behavior (VERSION_ID from /etc/os-release) if PLATFORM_ID is not available.

    • This can keep compatiblity with current behavior.

Code Snippet
If applicable, add a code snippet to show the api enhancement.

Additional information
Add any other context about the feature here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions