summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-23 15:54:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-28 17:47:03 +0000
commitb8d22ed681141ce360d742a96cec5f2925a20222 (patch)
tree8471d080fc220ba1ffb42a3d1d07e4ef39d3c33f /meta/lib
parentac4eba5415f39cd797a08071c0efae296ae61a70 (diff)
downloadopenembedded-core-contrib-b8d22ed681141ce360d742a96cec5f2925a20222.tar.gz
oeqa/utils/metadata: Add commit_count to fallback logic
Currently if python3-git isn't installed we can get odd behaviours when the commit_count is absent. Avoid this set of bugs by adding a fallback here. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/metadata.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index b7def77224..70a27569f2 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -72,8 +72,10 @@ def git_rev_info(path):
info['commit'] = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=path).decode('utf-8').strip()
except subprocess.CalledProcessError:
pass
- return info
-
+ try:
+ info['commit_count'] = int(subprocess.check_output(["git", "rev-list", "--count", "HEAD"], cwd=path).decode('utf-8').strip())
+ except subprocess.CalledProcessError:
+ pass
try:
repo = Repo(path, search_parent_directories=True)
except (InvalidGitRepositoryError, NoSuchPathError):