mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-07 03:29:59 +00:00
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>
This commit is contained in:
committed by
Martin Jansa
parent
c4731b2a5a
commit
0ce424ded8
@@ -13,16 +13,15 @@ def git_drop_tag_prefix(version):
|
|||||||
return version
|
return version
|
||||||
|
|
||||||
GIT_TAGADJUST = "git_drop_tag_prefix(version)"
|
GIT_TAGADJUST = "git_drop_tag_prefix(version)"
|
||||||
GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
|
GITVER = "${@get_git_pv(d, tagadjust=lambda version:${GIT_TAGADJUST})}"
|
||||||
GITSHA = "${@get_git_hash('${S}', d)}"
|
GITSHA = "${@get_git_hash(d)}"
|
||||||
|
|
||||||
def gitrev_run(cmd, path):
|
def gitrev_run(cmd, path):
|
||||||
(output, error) = bb.process.run(cmd, cwd=path)
|
(output, error) = bb.process.run(cmd, cwd=path)
|
||||||
return output.rstrip()
|
return output.rstrip()
|
||||||
|
|
||||||
def get_git_pv(path, d, tagadjust=None):
|
def get_git_pv(d, tagadjust=None):
|
||||||
import os
|
import os
|
||||||
import bb.process
|
|
||||||
|
|
||||||
srcdir = d.getVar("EXTERNALSRC") or d.getVar("S")
|
srcdir = d.getVar("EXTERNALSRC") or d.getVar("S")
|
||||||
gitdir = os.path.abspath(os.path.join(srcdir, ".git"))
|
gitdir = os.path.abspath(os.path.join(srcdir, ".git"))
|
||||||
@@ -46,6 +45,17 @@ def get_git_pv(path, d, tagadjust=None):
|
|||||||
ver = tagadjust(ver)
|
ver = tagadjust(ver)
|
||||||
return 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):
|
def mark_recipe_dependencies(path, d):
|
||||||
from bb.parse import mark_dependency
|
from bb.parse import mark_dependency
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user