aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/classes
diff options
context:
space:
mode:
authorAlejandro Mery <amery@hanoverdisplays.com>2017-06-13 10:47:56 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2017-06-14 14:51:17 +0200
commit0ce424ded8c28a0122cbcde1836b341bca53e8dd (patch)
tree7802aec43b7e18a320d38dc8e68fc232c325c76c /meta-oe/classes
parentc4731b2a5a8af54d78ce2735c1c488e5b8183863 (diff)
downloadmeta-openembedded-0ce424ded8c28a0122cbcde1836b341bca53e8dd.tar.gz
meta-openembedded-0ce424ded8c28a0122cbcde1836b341bca53e8dd.tar.bz2
meta-openembedded-0ce424ded8c28a0122cbcde1836b341bca53e8dd.zip
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')
-rw-r--r--meta-oe/classes/gitver.bbclass18
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):
return version
GIT_TAGADJUST = "git_drop_tag_prefix(version)"
-GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
-GITSHA = "${@get_git_hash('${S}', d)}"
+GITVER = "${@get_git_pv(d, tagadjust=lambda version:${GIT_TAGADJUST})}"
+GITSHA = "${@get_git_hash(d)}"
def gitrev_run(cmd, path):
(output, error) = bb.process.run(cmd, cwd=path)
return output.rstrip()
-def get_git_pv(path, d, tagadjust=None):
+def get_git_pv(d, tagadjust=None):
import os
- import bb.process
srcdir = d.getVar("EXTERNALSRC") or d.getVar("S")
gitdir = os.path.abspath(os.path.join(srcdir, ".git"))
@@ -46,6 +45,17 @@ def get_git_pv(path, d, tagadjust=None):
ver = tagadjust(ver)
return ver
+def get_git_hash(d):
+ import os
+
+ srcdir = d.getVar("EXTERNALSRC") or d.getVar("S")
+ gitdir = os.path.abspath(os.path.join(srcdir, ".git"))
+ try:
+ rev = gitrev_run("git rev-list HEAD -1")
+ return rev[:7]
+ except Exception as exc:
+ bb.fatal(str(exc))
+
def mark_recipe_dependencies(path, d):
from bb.parse import mark_dependency