Re: [OE-core] [PATCH 8/8] oeqa.utils.metadata: add bitbake revision information
On 04/01/2017, 17.45, "Mariano Lopez"wrote: >On 28/12/16 07:02, Markus Lehtonen wrote: >> [YOCTO #10590] >> >> Signed-off-by: Markus Lehtonen >> --- >> meta/lib/oeqa/utils/metadata.py | 32 +++- >> 1 file changed, 19 insertions(+), 13 deletions(-) >> >> diff --git a/meta/lib/oeqa/utils/metadata.py >>b/meta/lib/oeqa/utils/metadata.py >> index 6331c21..23449fc 100644 >> --- a/meta/lib/oeqa/utils/metadata.py >> +++ b/meta/lib/oeqa/utils/metadata.py >> @@ -10,6 +10,8 @@ from collections.abc import MutableMapping >> from xml.dom.minidom import parseString >> from xml.etree.ElementTree import Element, tostring >> >> +from git import Repo, InvalidGitRepositoryError, NoSuchPathError >> + > >It seems not every user running selftest appreciated the requirement of >gitpython, so there was a patch to keep this dependency out. This will >introduce the need of gitpython again. Yes. I don't know why I moved this import to module level in the first place. A corrected version of the patch in now found in my oe-core-contrib branch (git://git.openembedded.org/openembedded-core-contrib marquiz/oeqa-metaxml) Thanks, Markus -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 8/8] oeqa.utils.metadata: add bitbake revision information
On 28/12/16 07:02, Markus Lehtonen wrote: > [YOCTO #10590] > > Signed-off-by: Markus Lehtonen> --- > meta/lib/oeqa/utils/metadata.py | 32 +++- > 1 file changed, 19 insertions(+), 13 deletions(-) > > diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py > index 6331c21..23449fc 100644 > --- a/meta/lib/oeqa/utils/metadata.py > +++ b/meta/lib/oeqa/utils/metadata.py > @@ -10,6 +10,8 @@ from collections.abc import MutableMapping > from xml.dom.minidom import parseString > from xml.etree.ElementTree import Element, tostring > > +from git import Repo, InvalidGitRepositoryError, NoSuchPathError > + It seems not every user running selftest appreciated the requirement of gitpython, so there was a patch to keep this dependency out. This will introduce the need of gitpython again. -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 8/8] oeqa.utils.metadata: add bitbake revision information
[YOCTO #10590] Signed-off-by: Markus Lehtonen--- meta/lib/oeqa/utils/metadata.py | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py index 6331c21..23449fc 100644 --- a/meta/lib/oeqa/utils/metadata.py +++ b/meta/lib/oeqa/utils/metadata.py @@ -10,6 +10,8 @@ from collections.abc import MutableMapping from xml.dom.minidom import parseString from xml.etree.ElementTree import Element, tostring +from git import Repo, InvalidGitRepositoryError, NoSuchPathError + from oeqa.utils.commands import runCmd, get_bb_vars def get_os_release(): @@ -51,6 +53,7 @@ def metadata_from_bb(): info_dict['host_distro'][key] = os_release[key] info_dict['layers'] = get_layers(data_dict['BBLAYERS']) +info_dict['bitbake'] = git_rev_info(os.path.dirname(bb.__file__)) return info_dict def metadata_from_data_store(d): @@ -62,24 +65,27 @@ def metadata_from_data_store(d): # be useful when running within bitbake. pass +def git_rev_info(path): +"""Get git revision information as a dict""" +info = OrderedDict() +try: +repo = Repo(path, search_parent_directories=True) +except (InvalidGitRepositoryError, NoSuchPathError): +return info +info['commit'] = repo.head.commit.hexsha +info['commit_count'] = repo.head.commit.count() +try: +info['branch'] = repo.active_branch.name +except TypeError: +info['branch'] = '(nobranch)' +return info + def get_layers(layers): """Returns layer information in dict format""" -from git import Repo, InvalidGitRepositoryError, NoSuchPathError - layer_dict = OrderedDict() for layer in layers.split(): layer_name = os.path.basename(layer) -layer_dict[layer_name] = OrderedDict() -try: -repo = Repo(layer, search_parent_directories=True) -except (InvalidGitRepositoryError, NoSuchPathError): -continue -layer_dict[layer_name]['commit'] = repo.head.commit.hexsha -layer_dict[layer_name]['commit_count'] = repo.head.commit.count() -try: -layer_dict[layer_name]['branch'] = repo.active_branch.name -except TypeError: -layer_dict[layer_name]['branch'] = '(nobranch)' +layer_dict[layer_name] = git_rev_info(layer) return layer_dict def write_metadata_file(file_path, metadata): -- 2.6.6 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core