summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-01-13 15:12:38 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-19 22:47:22 +0000
commitdf8c0540e4b3d01fa1dcb4a569b1b1282686d60a (patch)
treeeb2377138f8cbc8fdb60c7b897d47c0a3030d50b
parent8d51f62cd4933013b11b6812f7585810cc035fbd (diff)
downloadpoky-df8c0540e4b3d01fa1dcb4a569b1b1282686d60a.tar.gz
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>
-rw-r--r--meta/lib/oeqa/utils/metadata.py17
-rwxr-xr-xscripts/oe-selftest4
2 files changed, 12 insertions, 9 deletions
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index 2316841e0f..df6ed91052 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -10,9 +10,7 @@ from collections.abc import MutableMapping
10from xml.dom.minidom import parseString 10from xml.dom.minidom import parseString
11from xml.etree.ElementTree import Element, tostring 11from xml.etree.ElementTree import Element, tostring
12 12
13from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars 13from oeqa.utils.commands import runCmd, get_bb_vars
14
15metadata_vars = ['MACHINE', 'DISTRO', 'DISTRO_VERSION']
16 14
17def get_os_release(): 15def get_os_release():
18 """Get info from /etc/os-release as a dict""" 16 """Get info from /etc/os-release as a dict"""
@@ -35,9 +33,14 @@ def metadata_from_bb():
35 info_dict = OrderedDict() 33 info_dict = OrderedDict()
36 hostname = runCmd('hostname') 34 hostname = runCmd('hostname')
37 info_dict['hostname'] = hostname.output 35 info_dict['hostname'] = hostname.output
38 data_dict = get_bb_vars(metadata_vars) 36 data_dict = get_bb_vars()
39 for var in metadata_vars: 37
40 info_dict[var.lower()] = data_dict[var] 38 info_dict['machine'] = data_dict['MACHINE']
39
40 # Distro information
41 info_dict['distro'] = {'id': data_dict['DISTRO'],
42 'version_id': data_dict['DISTRO_VERSION'],
43 'pretty_name': '%s %s' % (data_dict['DISTRO'], data_dict['DISTRO_VERSION'])}
41 44
42 # Host distro information 45 # Host distro information
43 os_release = get_os_release() 46 os_release = get_os_release()
@@ -47,7 +50,7 @@ def metadata_from_bb():
47 if key in os_release: 50 if key in os_release:
48 info_dict['host_distro'][key] = os_release[key] 51 info_dict['host_distro'][key] = os_release[key]
49 52
50 info_dict['layers'] = get_layers(get_bb_var('BBLAYERS')) 53 info_dict['layers'] = get_layers(data_dict['BBLAYERS'])
51 return info_dict 54 return info_dict
52 55
53def metadata_from_data_store(d): 56def metadata_from_data_store(d):
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index 120a6c2de8..c3c491f20a 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -632,8 +632,8 @@ def main():
632 for layer, values in metadata['layers'].items(): 632 for layer, values in metadata['layers'].items():
633 layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer, 633 layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer,
634 values['branch'], values['revision']) 634 values['branch'], values['revision'])
635 msg = 'Selftest for build %s of %s %s for machine %s on %s\n\n%s' % ( 635 msg = 'Selftest for build %s of %s for machine %s on %s\n\n%s' % (
636 log_prefix[12:], metadata['distro'], metadata['distro_version'], 636 log_prefix[12:], metadata['distro']['pretty_name'],
637 metadata['machine'], metadata['hostname'], layer_info) 637 metadata['machine'], metadata['hostname'], layer_info)
638 638
639 log.debug('Commiting results to local repository') 639 log.debug('Commiting results to local repository')