diff options
author | Alejandro Mery <amery@hanoverdisplays.com> | 2017-06-13 10:47:56 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-06-14 14:51:17 +0200 |
commit | 0ce424ded8c28a0122cbcde1836b341bca53e8dd (patch) | |
tree | 7802aec43b7e18a320d38dc8e68fc232c325c76c /meta-oe/classes/gitver.bbclass | |
parent | c4731b2a5a8af54d78ce2735c1c488e5b8183863 (diff) | |
download | meta-openembedded-0ce424ded8c28a0122cbcde1836b341bca53e8dd.tar.gz |
gitver: fix broken ${GITSHA} and recursion in S when PV="${GITVER}"
Signed-off-by: Alejandro Mery <amery@hanoverdisplays.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/classes/gitver.bbclass')
-rw-r--r-- | meta-oe/classes/gitver.bbclass | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass index 73521d538..a09c99749 100644 --- a/meta-oe/classes/gitver.bbclass +++ b/meta-oe/classes/gitver.bbclass | |||
@@ -13,16 +13,15 @@ def git_drop_tag_prefix(version): | |||
13 | return version | 13 | return version |
14 | 14 | ||
15 | GIT_TAGADJUST = "git_drop_tag_prefix(version)" | 15 | GIT_TAGADJUST = "git_drop_tag_prefix(version)" |
16 | GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" | 16 | GITVER = "${@get_git_pv(d, tagadjust=lambda version:${GIT_TAGADJUST})}" |
17 | GITSHA = "${@get_git_hash('${S}', d)}" | 17 | GITSHA = "${@get_git_hash(d)}" |
18 | 18 | ||
19 | def gitrev_run(cmd, path): | 19 | def gitrev_run(cmd, path): |
20 | (output, error) = bb.process.run(cmd, cwd=path) | 20 | (output, error) = bb.process.run(cmd, cwd=path) |
21 | return output.rstrip() | 21 | return output.rstrip() |
22 | 22 | ||
23 | def get_git_pv(path, d, tagadjust=None): | 23 | def get_git_pv(d, tagadjust=None): |
24 | import os | 24 | import os |
25 | import bb.process | ||
26 | 25 | ||
27 | srcdir = d.getVar("EXTERNALSRC") or d.getVar("S") | 26 | srcdir = d.getVar("EXTERNALSRC") or d.getVar("S") |
28 | gitdir = os.path.abspath(os.path.join(srcdir, ".git")) | 27 | gitdir = os.path.abspath(os.path.join(srcdir, ".git")) |
@@ -46,6 +45,17 @@ def get_git_pv(path, d, tagadjust=None): | |||
46 | ver = tagadjust(ver) | 45 | ver = tagadjust(ver) |
47 | return ver | 46 | return ver |
48 | 47 | ||
48 | def get_git_hash(d): | ||
49 | import os | ||
50 | |||
51 | srcdir = d.getVar("EXTERNALSRC") or d.getVar("S") | ||
52 | gitdir = os.path.abspath(os.path.join(srcdir, ".git")) | ||
53 | try: | ||
54 | rev = gitrev_run("git rev-list HEAD -1") | ||
55 | return rev[:7] | ||
56 | except Exception as exc: | ||
57 | bb.fatal(str(exc)) | ||
58 | |||
49 | def mark_recipe_dependencies(path, d): | 59 | def mark_recipe_dependencies(path, d): |
50 | from bb.parse import mark_dependency | 60 | from bb.parse import mark_dependency |
51 | 61 | ||