diff options
| author | Radek Dostal <rd@radekdostal.com> | 2012-10-29 07:53:35 +0000 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-10-30 09:51:51 +0100 |
| commit | 36f85eee821565c5bc197e7215ba13411a5605b4 (patch) | |
| tree | 41af0747abce66215739a95be31ec9d2c1c9aa33 /meta-oe/classes | |
| parent | 5056a7bf473c1e121eefa869f6a61ac4580604c9 (diff) | |
| download | meta-openembedded-36f85eee821565c5bc197e7215ba13411a5605b4.tar.gz | |
gitver: fix gitver to work with yocto 1.3
replace oe_run and oe.process with bb.process
gitver got broken by following oe-core commits:
15ad62ab1be060d8a7cdc2d28167ea3af4cfd5d5
d56062cbf92ef206bf06c767befacb66927a9a36
Signed-off-by: Radek Dostal <rd@radekdostal.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/classes')
| -rw-r--r-- | meta-oe/classes/gitver.bbclass | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass index ee8323d6f4..e7b5155ee0 100644 --- a/meta-oe/classes/gitver.bbclass +++ b/meta-oe/classes/gitver.bbclass | |||
| @@ -16,28 +16,23 @@ GIT_TAGADJUST = "git_drop_tag_prefix(version)" | |||
| 16 | GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" | 16 | GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" |
| 17 | GITSHA = "${@get_git_hash('${S}', d)}" | 17 | GITSHA = "${@get_git_hash('${S}', d)}" |
| 18 | 18 | ||
| 19 | def get_git_hash(path, d): | 19 | def 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 | ||
| 22 | def get_git_pv(path, d, tagadjust=None): | 23 | def 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: |
