summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/classes/gitver.bbclass21
1 files changed, 8 insertions, 13 deletions
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass
index ee8323d6f..e7b5155ee 100644
--- a/meta-oe/classes/gitver.bbclass
+++ b/meta-oe/classes/gitver.bbclass
@@ -16,28 +16,23 @@ GIT_TAGADJUST = "git_drop_tag_prefix(version)"
16GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" 16GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
17GITSHA = "${@get_git_hash('${S}', d)}" 17GITSHA = "${@get_git_hash('${S}', d)}"
18 18
19def get_git_hash(path, d): 19def gitrev_run(cmd, path):
20 return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], cwd=path).rstrip() 20 (output, error) = bb.process.run(cmd, cwd=path)
21 return output.rstrip()
21 22
22def get_git_pv(path, d, tagadjust=None): 23def get_git_pv(path, d, tagadjust=None):
23 import os 24 import os
24 import oe.process 25 import bb.process
25 26
26 gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) 27 gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git"))
27 def git(cmd):
28 try:
29 return oe_run(d, ["git"] + cmd, cwd=gitdir).rstrip()
30 except oe.process.CmdError, exc:
31 bb.fatal(str(exc))
32
33 try: 28 try:
34 ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip() 29 ver = gitrev_run("git describe --tags", gitdir)
35 except Exception, exc: 30 except Exception, exc:
36 bb.fatal(str(exc)) 31 bb.fatal(str(exc))
37 32
38 if not ver: 33 if not ver:
39 try: 34 try:
40 ver = get_git_hash(gitdir, d) 35 ver = gitrev_run("git rev-parse --short HEAD", gitdir)
41 except Exception, exc: 36 except Exception, exc:
42 bb.fatal(str(exc)) 37 bb.fatal(str(exc))
43 38
@@ -63,8 +58,8 @@ def mark_recipe_dependencies(path, d):
63 mark_dependency(d, os.path.join(gitdir, "index")) 58 mark_dependency(d, os.path.join(gitdir, "index"))
64 59
65 try: 60 try:
66 ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip() 61 ref = gitrev_run("git symbolic-ref -q HEAD", gitdir)
67 except oe.process.CmdError: 62 except bb.process.CmdError:
68 pass 63 pass
69 else: 64 else:
70 if ref: 65 if ref: