diff options
Diffstat (limited to 'meta/lib/oeqa/utils/metadata.py')
| -rw-r--r-- | meta/lib/oeqa/utils/metadata.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py index 65bbdc61f4..b7def77224 100644 --- a/meta/lib/oeqa/utils/metadata.py +++ b/meta/lib/oeqa/utils/metadata.py | |||
| @@ -58,9 +58,22 @@ def metadata_from_data_store(d): | |||
| 58 | 58 | ||
| 59 | def git_rev_info(path): | 59 | def git_rev_info(path): |
| 60 | """Get git revision information as a dict""" | 60 | """Get git revision information as a dict""" |
| 61 | from git import Repo, InvalidGitRepositoryError, NoSuchPathError | ||
| 62 | |||
| 63 | info = OrderedDict() | 61 | info = OrderedDict() |
| 62 | |||
| 63 | try: | ||
| 64 | from git import Repo, InvalidGitRepositoryError, NoSuchPathError | ||
| 65 | except ImportError: | ||
| 66 | import subprocess | ||
| 67 | try: | ||
| 68 | info['branch'] = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=path).decode('utf-8').strip() | ||
| 69 | except subprocess.CalledProcessError: | ||
| 70 | pass | ||
| 71 | try: | ||
| 72 | info['commit'] = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=path).decode('utf-8').strip() | ||
| 73 | except subprocess.CalledProcessError: | ||
| 74 | pass | ||
| 75 | return info | ||
| 76 | |||
| 64 | try: | 77 | try: |
| 65 | repo = Repo(path, search_parent_directories=True) | 78 | repo = Repo(path, search_parent_directories=True) |
| 66 | except (InvalidGitRepositoryError, NoSuchPathError): | 79 | except (InvalidGitRepositoryError, NoSuchPathError): |
