oeqa.utils.metadata: re-organise distro information
Use the same format, based on /etc/os-release, as for host distro information. [YOCTO #10590] (From OE-Core rev: 0156ef46ccf5334ee72f0202f1089249c62af37b) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
8d51f62cd4
commit
df8c0540e4
|
@ -10,9 +10,7 @@ from collections.abc import MutableMapping
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
from xml.etree.ElementTree import Element, tostring
|
from xml.etree.ElementTree import Element, tostring
|
||||||
|
|
||||||
from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars
|
from oeqa.utils.commands import runCmd, get_bb_vars
|
||||||
|
|
||||||
metadata_vars = ['MACHINE', 'DISTRO', 'DISTRO_VERSION']
|
|
||||||
|
|
||||||
def get_os_release():
|
def get_os_release():
|
||||||
"""Get info from /etc/os-release as a dict"""
|
"""Get info from /etc/os-release as a dict"""
|
||||||
|
@ -35,9 +33,14 @@ def metadata_from_bb():
|
||||||
info_dict = OrderedDict()
|
info_dict = OrderedDict()
|
||||||
hostname = runCmd('hostname')
|
hostname = runCmd('hostname')
|
||||||
info_dict['hostname'] = hostname.output
|
info_dict['hostname'] = hostname.output
|
||||||
data_dict = get_bb_vars(metadata_vars)
|
data_dict = get_bb_vars()
|
||||||
for var in metadata_vars:
|
|
||||||
info_dict[var.lower()] = data_dict[var]
|
info_dict['machine'] = data_dict['MACHINE']
|
||||||
|
|
||||||
|
# Distro information
|
||||||
|
info_dict['distro'] = {'id': data_dict['DISTRO'],
|
||||||
|
'version_id': data_dict['DISTRO_VERSION'],
|
||||||
|
'pretty_name': '%s %s' % (data_dict['DISTRO'], data_dict['DISTRO_VERSION'])}
|
||||||
|
|
||||||
# Host distro information
|
# Host distro information
|
||||||
os_release = get_os_release()
|
os_release = get_os_release()
|
||||||
|
@ -47,7 +50,7 @@ def metadata_from_bb():
|
||||||
if key in os_release:
|
if key in os_release:
|
||||||
info_dict['host_distro'][key] = os_release[key]
|
info_dict['host_distro'][key] = os_release[key]
|
||||||
|
|
||||||
info_dict['layers'] = get_layers(get_bb_var('BBLAYERS'))
|
info_dict['layers'] = get_layers(data_dict['BBLAYERS'])
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
def metadata_from_data_store(d):
|
def metadata_from_data_store(d):
|
||||||
|
|
|
@ -632,8 +632,8 @@ def main():
|
||||||
for layer, values in metadata['layers'].items():
|
for layer, values in metadata['layers'].items():
|
||||||
layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer,
|
layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer,
|
||||||
values['branch'], values['revision'])
|
values['branch'], values['revision'])
|
||||||
msg = 'Selftest for build %s of %s %s for machine %s on %s\n\n%s' % (
|
msg = 'Selftest for build %s of %s for machine %s on %s\n\n%s' % (
|
||||||
log_prefix[12:], metadata['distro'], metadata['distro_version'],
|
log_prefix[12:], metadata['distro']['pretty_name'],
|
||||||
metadata['machine'], metadata['hostname'], layer_info)
|
metadata['machine'], metadata['hostname'], layer_info)
|
||||||
|
|
||||||
log.debug('Commiting results to local repository')
|
log.debug('Commiting results to local repository')
|
||||||
|
|
Loading…
Reference in New Issue