[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4089/8267] oeqa.utils.metadata: fix retrieval of git branch and revision
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 4089/8267] oeqa.utils.metadata: fix retrieval of git branch and revision
- Date: Sun, 17 Dec 2017 01:32:49 +0000 (UTC)
commit 927e759bb2d229ff023b58cce498ed3ae19af46a
Author: Markus Lehtonen <markus lehtonen linux intel com>
Date: Fri Jan 13 15:12:40 2017 +0200
oeqa.utils.metadata: fix retrieval of git branch and revision
Always return a valid branch name, or, '(nobranch)' if the current HEAD
is detached. Also, always return the hash of the commit object that HEAD
is pointing to. Previous code returned an incorrect branch name (or
crashed) e.g. in the case of detached HEAD.
[YOCTO #10590]
(From OE-Core rev: 02d3ba17a8090bd088beb973980651d664f713bb)
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>
meta/lib/oeqa/utils/metadata.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index a389c6a..b732d37 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -72,11 +72,13 @@ def get_layers(layers):
layer_dict[layer_name] = OrderedDict()
try:
repo = Repo(layer, search_parent_directories=True)
- revision, branch = repo.head.object.name_rev.split()
except (InvalidGitRepositoryError, NoSuchPathError):
continue
- layer_dict[layer_name]['branch'] = branch
- layer_dict[layer_name]['revision'] = revision
+ layer_dict[layer_name]['revision'] = repo.head.commit.hexsha
+ try:
+ layer_dict[layer_name]['branch'] = repo.active_branch.name
+ except TypeError:
+ layer_dict[layer_name]['branch'] = '(nobranch)'
return layer_dict
def write_metadata_file(file_path, metadata):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]