aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Mery <amery@hanoverdisplays.com>2017-06-13 10:47:56 +0100
committerArmin Kuster <akuster808@gmail.com>2017-06-26 11:35:51 -0700
commit718daa97541b2b8570710e7f4e089191ef6477a4 (patch)
tree6d6278264c6966732f2d061ae2c10674a15f242a
parentc90b1753c9c34ed16613d8979613460c85f4295c (diff)
downloadmeta-openembedded-contrib-718daa97541b2b8570710e7f4e089191ef6477a4.tar.gz
meta-openembedded-contrib-718daa97541b2b8570710e7f4e089191ef6477a4.tar.bz2
meta-openembedded-contrib-718daa97541b2b8570710e7f4e089191ef6477a4.zip
gitver: fix broken ${GITSHA} and recursion in S when PV="${GITVER}"
v2: * use git rev-parse instead of rev-list for consistency with get_git_pv * fix getVar() to pass `expand` as required by morty's bitbake Signed-off-by: Alejandro Mery <amery@hanoverdisplays.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-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 adb434a46b..875a3d79de 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", True) or d.getVar("S", True)
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", True) or d.getVar("S", True)
+ gitdir = os.path.abspath(os.path.join(srcdir, ".git"))
+ try:
+ return gitrev_run("git rev-parse HEAD", gitdir)
+
+ except Exception as exc:
+ bb.fatal(str(exc))
+
def mark_recipe_dependencies(path, d):
from bb.parse import mark_dependency