Bug 10591 - oe.lsb.distro_identifier() doesn't always return the same value for CentOS 7
Summary: oe.lsb.distro_identifier() doesn't always return the same value for CentOS 7
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.3
Assignee: Joshua Lock
QA Contact:
URL:
Whiteboard:
: 10577 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-11-03 10:34 UTC by Joshua Lock
Modified: 2016-11-23 21:05 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Lock 2016-11-03 10:34:06 UTC
If you have lsb_release available distro identifier is parsed from the output of `lsb_release -ir` and returned as as "CentOS", however if you don't have lsb_release installed (certainly common in CentOS Docker containers) we fall back to reading os-release or redhat-release and the value parsed out of those files is "CentOSLinux".

We should likely favour os-release, which resolves this issue in practice.
Comment 1 Bas Mevissen 2016-11-03 12:59:14 UTC
As a side note, a possible reason of having lsb_release installed is by having the Google Chrome browser installed which requires lsb >= 4.0.
Comment 2 Joshua Lock 2016-11-03 15:23:50 UTC
*** Bug 10577 has been marked as a duplicate of this bug. ***
Comment 3 Joshua Lock 2016-11-07 13:48:55 UTC
We can make this even less likely to be an issue if we also switch to using the ID field from os-release, rather than NAME, and returning a lowercase identifier from the distro_identifier() function.

For each host distribution supported by the Yocto Project, other than openSUSE, this would result in the same identifier being returned regardless of whether it was the source was os-release or lsb_release.

 Distribution | Version | Distributor ID   | NAME             | ID       |
 -------------------------------------------------------------------------
 CentOS       | 7       | CentOS           | CentOS Linux     | centos   |
 Debian       | 8       | Debian           | Debian GNU/Linux | debian   |
 Fedora       | 23      | Fedora           | Fedora           | fedora   |
 Fedora       | 24      | Fedora           | Fedora           | fedora   |
 openSUSE     | 13.2    | openSUSE project | openSUSE         | opensuse |
 openSUSE     | 42.1    | SUSE LINUX       | openSUSE Leap    | opensuse |
 Ubuntu       | 14.04   | Ubuntu           | Ubuntu           | ubuntu   |
 Ubuntu       | 16.04   | Ubuntu           | Ubuntu           | ubuntu   |
Comment 4 Joshua Lock 2016-11-07 22:51:09 UTC
Patches submitted to oe-core to improve the distro reporting mechanism:
http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128496.html

and to meta-yocto to adapt to these changes:
https://lists.yoctoproject.org/pipermail/poky/2016-November/010789.html
Comment 5 Joshua Lock 2016-11-08 14:57:28 UTC
v2 series submitted to oe-core to better handle some of the variations in os-release format:

http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128528.html