Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: mariano.lopez@linux.intel.com, openembedded-core@lists.openembedded.org
Subject: Re: [PATCHv2 2/3] oeqa/utils/metadata.py: Add metadata library
Date: Mon, 05 Dec 2016 11:35:07 +0200	[thread overview]
Message-ID: <1480930507.13463.35.camel@linux.intel.com> (raw)
In-Reply-To: <fe5c6f63b0523cb18bb8a8ce4988895c82a063c4.1480525452.git.mariano.lopez@linux.intel.com>

On Thu, 2016-12-01 at 09:37 -0600, mariano.lopez@linux.intel.com wrote:
> From: Mariano Lopez <mariano.lopez@linux.intel.com>
> 
> Adds functions to get metadata from the host running the tests.
> 
> [YOCTO #9954]
> 
> Signed-off-by: Mariano Lopez <mariano.lopez@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


  reply	other threads:[~2016-12-05  9:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 15:37 [PATCHv2 0/3] Add communication mechanism for sending test results mariano.lopez
2016-12-01 15:37 ` [PATCHv2 1/3] oeqa/utils/commands.py: Make a copy of variables in get_bb_vars mariano.lopez
2016-12-01 15:37 ` [PATCHv2 2/3] oeqa/utils/metadata.py: Add metadata library mariano.lopez
2016-12-05  9:35   ` Markus Lehtonen [this message]
2016-12-01 15:37 ` [PATCHv2 3/3] oe-selftest: Add option to submit test result to a git repository mariano.lopez
2016-12-01 16:52   ` Benjamin Esquivel
2016-12-01 17:00     ` Mariano Lopez
2016-12-01 22:44       ` Benjamin Esquivel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480930507.13463.35.camel@linux.intel.com \
    --to=markus.lehtonen@linux.intel.com \
    --cc=mariano.lopez@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox