diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/metadata_scm.bbclass | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass index 237e61821d..64465faa4c 100644 --- a/meta/classes/metadata_scm.bbclass +++ b/meta/classes/metadata_scm.bbclass | |||
@@ -65,18 +65,19 @@ def base_get_metadata_svn_revision(path, d): | |||
65 | return revision | 65 | return revision |
66 | 66 | ||
67 | def base_get_metadata_git_branch(path, d): | 67 | def base_get_metadata_git_branch(path, d): |
68 | branch = os.popen('cd %s; git branch 2>&1 | grep "^* " | tr -d "* "' % path).read() | 68 | import subprocess |
69 | 69 | ||
70 | if len(branch) != 0: | 70 | try: |
71 | return branch | 71 | return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], |
72 | return "<unknown>" | 72 | cwd=path).strip() |
73 | except: | ||
74 | return "<unknown>" | ||
73 | 75 | ||
74 | def base_get_metadata_git_revision(path, d): | 76 | def base_get_metadata_git_revision(path, d): |
75 | f = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path) | 77 | import subprocess |
76 | data = f.read() | ||
77 | if f.close() is None: | ||
78 | rev = data.split(" ")[0] | ||
79 | if len(rev) != 0: | ||
80 | return rev | ||
81 | return "<unknown>" | ||
82 | 78 | ||
79 | try: | ||
80 | return subprocess.check_output(["git", "rev-parse", "HEAD"], | ||
81 | cwd=path).strip() | ||
82 | except: | ||
83 | return "<unknown>" | ||