mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-04-20 11:38:34 +00:00
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>
This commit is contained in:
@@ -16,28 +16,23 @@ GIT_TAGADJUST = "git_drop_tag_prefix(version)"
|
||||
GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
|
||||
GITSHA = "${@get_git_hash('${S}', d)}"
|
||||
|
||||
def get_git_hash(path, d):
|
||||
return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], cwd=path).rstrip()
|
||||
def gitrev_run(cmd, path):
|
||||
(output, error) = bb.process.run(cmd, cwd=path)
|
||||
return output.rstrip()
|
||||
|
||||
def get_git_pv(path, d, tagadjust=None):
|
||||
import os
|
||||
import oe.process
|
||||
import bb.process
|
||||
|
||||
gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git"))
|
||||
def git(cmd):
|
||||
try:
|
||||
return oe_run(d, ["git"] + cmd, cwd=gitdir).rstrip()
|
||||
except oe.process.CmdError, exc:
|
||||
bb.fatal(str(exc))
|
||||
|
||||
try:
|
||||
ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip()
|
||||
ver = gitrev_run("git describe --tags", gitdir)
|
||||
except Exception, exc:
|
||||
bb.fatal(str(exc))
|
||||
|
||||
if not ver:
|
||||
try:
|
||||
ver = get_git_hash(gitdir, d)
|
||||
ver = gitrev_run("git rev-parse --short HEAD", gitdir)
|
||||
except Exception, exc:
|
||||
bb.fatal(str(exc))
|
||||
|
||||
@@ -63,8 +58,8 @@ def mark_recipe_dependencies(path, d):
|
||||
mark_dependency(d, os.path.join(gitdir, "index"))
|
||||
|
||||
try:
|
||||
ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip()
|
||||
except oe.process.CmdError:
|
||||
ref = gitrev_run("git symbolic-ref -q HEAD", gitdir)
|
||||
except bb.process.CmdError:
|
||||
pass
|
||||
else:
|
||||
if ref:
|
||||
|
||||
Reference in New Issue
Block a user