summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/lsb.py
AgeCommit message (Collapse)Author
2017-05-16oe.lsb: add get_os_release()Markus Lehtonen
Move get_os_release() from oeqa.utils.metadata to oe.lsb, merging the code with release_dict_osr() from oe.lsb. This removes some code duplication and makes get_os_release() more robust. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-23lib/oe/lsb: better handle missing fieldsJoshua Lock
Some rolling release distros, such as Arch Linux, don't include a VERSION_ID field in their os-release file. Change release_dict_osr() to better handle this optional field being absent. Further improve the resilience of the release_dict_*() methods by always returning a dict and using dict.get() in distro_identifier() to supply a default, empty string, value when then key is missing. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15lib/oe/lsb: attempt to ensure consistent distro id regardless of sourceJoshua Lock
The LSB Distributor ID and os-release NAME differ for most of the distributions tested by the Yocto Project (CentOS, Debian, Fedora, openSUSE and Ubuntu) however for all but openSUSE the os-release ID matches the LSB Distributor ID when both are lowered before comparison. Therefore, in order to improve the consistency of identification of a distribution, switch to using the os-release ID and converting the ID value to lowercase. Table showing comparison of LSB Distributor ID to os-release fields NAME and ID for current Yocto Project supported host distributions: 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 | [YOCTO #10591] Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15lib/oe/lsb: prefer /etc/os-release for distribution dataJoshua Lock
os-release(5) is an increasingly standard source of operating system identification and more likely to be present on modern OS deployments, i.e. many container variants of common distros include os-release and not the lsb_release tool. Therefore we should favour parsing /etc/os-release in distro_identifier(), try lsb_release when that fails and finally fall back on various distro specific sources of OS identification. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15lib/oe/lsb: make the release dict keys consistent regardless of sourceJoshua Lock
Rather than have the distro_identifier method look for different keys in the dict depending on the source ensure that each function for retrieving release data uses the same key names in the returned dict. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-13lib/oe/lsb: sanitise the distro identifierRoss Burton
The distribution identifier is often used to create filenames, so it needs to be safe to use as a filename. Whilst most distributions have e.g. Fedora or Debian as their name, it is possible that the name contains special characters. To ensure this doesn't cause a problem strip out any non-alphanumerics from the distribution name before returning it. [ YOCTO #9443 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-22lib/oe/lsb.py: Prioritize parsing of /etc/os-releaseEd Bartosh
Moved parsing of /etc/os-release before parsing of /etc/SuSE-release as /etc/SuSE-release is deprecated in recent releases of OpenSuSE. Here is the quote from /etc/SuSE-release: /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14lib/oe/lsb.py: Fix up for dashSaul Wold
Remove the leading -e when using dash which does not use -e with echo Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2013-07-02lib/oe/lsb.py: fall back to /etc/os-release for host distro IDPaul Eggleton
The new standard for host distribution identification [1] is /etc/os-release, and a number of newer distributions provide this file, so add support for this in order to pick up more distributions. Additionally, handle "rolling release" style distributions that don't report a version number, e.g. Arch Linux. With this change we can identify the most common distributions, so this should satisfy [YOCTO #4271]. Note that this doesn't imply support for these distros as build hosts, just that we can identify them. [1] http://www.freedesktop.org/software/systemd/man/os-release.html Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-03-29meta/lib/oe/lsb.py: extract only the needed info from lsb-releaseCristian Iorga
Instead of running lsb_release -a, a lsb_release -ir will be run. This will prevent issue with distros that don't have all the needed info in /etc/lsb-release file, in which case lsb_release won't generate an error code. Partial fix for [YOCTO #4071] Signed-off-by: Cristian Iorga <cristian.iorga@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-29meta/lib/oe/lsb.py: fix data extraction from /etc/lsb-releaseCristian Iorga
In some cases, /etc/lsb-release file is used to extract info about poky build host machine. But the strings are not stripped of end of line special characters. As such, when this info is concatenated and used as a directory entry in sstate_cache, this is an issue. Usually, this issue is masked by the fact that distro related info is extracted from the output of lsb_release command. In case of Yocto Linux, running "lsb_release -a" will give an error code because CODENAME info is not present. As such, bitbake will extract the info from /etc/lsb-release, running into the above issue. Consequence is that building under BA will crash. Partial fix for [YOCTO #4071] Signed-off-by: Cristian Iorga <cristian.iorga@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-12lib/oe/lsb: enable getting distro ID when lsb_release is not installedPaul Eggleton
If lsb_release is not installed (as it may not be on headless/minimal installations on distros whose LSB package has a long list of dependencies) we need to gather the information directly from files in /etc. Fixes [YOCTO #4012]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-27distro_identifier: replace slash with hyphenMihai Lindner
Use "-" instead of "/" in "n/a" strings ("Distributor ID" and/or "Release"), provided by `lsb_release`. This leads to directories and subdirectories created in ./sstate-cache/ e.g. Distro-n/a/ where "Distro-n" is dir and "a" is subdir. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-31lib/oe/lsb.py: Map unknown distributions to 'Unknown'Richard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-27lib/oe/lsb: Add basic LSB functionsRichard Purdie
This code was written by Christopher Larson <chris_larson@mentor.com> and allows generation of the LSB release data based upon the lsb_release command. It also includes a helper function to generate a string representing a given distribution. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Saul Wold <sgw@linux.intel.com>