On Thu, 2016-12-01 at 09:37 -0600, mariano.lo...@linux.intel.com wrote: > From: Mariano Lopez <mariano.lo...@linux.intel.com> > > Adds functions to get metadata from the host running the tests. > > [YOCTO #9954] > > Signed-off-by: Mariano Lopez <mariano.lo...@linux.intel.com> > --- > meta/lib/oeqa/utils/metadata.py | 83 > +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > create mode 100644 meta/lib/oeqa/utils/metadata.py > > diff --git a/meta/lib/oeqa/utils/metadata.py > b/meta/lib/oeqa/utils/metadata.py > new file mode 100644 > index 0000000..ecbe763 > --- /dev/null > +++ b/meta/lib/oeqa/utils/metadata.py > @@ -0,0 +1,83 @@ > +# Copyright (C) 2016 Intel Corporation > +# > +# Released under the MIT license (see COPYING.MIT) > +# > +# Functions to get metadata from the testing host used > +# for analytics of test results. > + > +from git import Repo, InvalidGitRepositoryError, NoSuchPathError
We introduce a dependency on GitPython(?) If we do this, it should at least be mentioned somewhere as a new required dependency. There is also oeqa.utils.git which could be used (and extended). > +from collections import OrderedDict > +from collections.abc import MutableMapping > +from xml.dom.minidom import parseString > +from xml.etree.ElementTree import Element, tostring > + > +from oe.lsb import distro_identifier > +from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars > + > +metadata_vars = ['MACHINE', 'DISTRO', 'DISTRO_VERSION'] > + > +def metadata_from_bb(): > + """ Returns test's metadata as OrderedDict. > + > + Data will be gathered using bitbake -e thanks to get_bb_vars. > + """ > + > + info_dict = OrderedDict() > + hostname = runCmd('hostname') > + info_dict['hostname'] = hostname.output > + data_dict = get_bb_vars(metadata_vars) > + for var in metadata_vars: > + info_dict[var.lower()] = data_dict[var] > + host_distro= distro_identifier() > + host_distro, _, host_distro_release = host_distro.partition('-') > + info_dict['host_distro'] = host_distro > + info_dict['host_distro_release'] = host_distro_release > + info_dict['layers'] = get_layers(get_bb_var('BBLAYERS')) > + return info_dict I think it would be better to have a distro revision (i.e. the "main revision" or "revision of the main repository", for example oe-core or poky) and only list additional layers that are not included in the main repository. Thanks, Markus -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core