mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-10-02 05:29:12 +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:
parent
5056a7bf47
commit
36f85eee82
@ -16,28 +16,23 @@ GIT_TAGADJUST = "git_drop_tag_prefix(version)"
|
|||||||
GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
|
GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
|
||||||
GITSHA = "${@get_git_hash('${S}', d)}"
|
GITSHA = "${@get_git_hash('${S}', d)}"
|
||||||
|
|
||||||
def get_git_hash(path, d):
|
def gitrev_run(cmd, path):
|
||||||
return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], cwd=path).rstrip()
|
(output, error) = bb.process.run(cmd, cwd=path)
|
||||||
|
return output.rstrip()
|
||||||
|
|
||||||
def get_git_pv(path, d, tagadjust=None):
|
def get_git_pv(path, d, tagadjust=None):
|
||||||
import os
|
import os
|
||||||
import oe.process
|
import bb.process
|
||||||
|
|
||||||
gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git"))
|
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:
|
try:
|
||||||
ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip()
|
ver = gitrev_run("git describe --tags", gitdir)
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
bb.fatal(str(exc))
|
bb.fatal(str(exc))
|
||||||
|
|
||||||
if not ver:
|
if not ver:
|
||||||
try:
|
try:
|
||||||
ver = get_git_hash(gitdir, d)
|
ver = gitrev_run("git rev-parse --short HEAD", gitdir)
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
bb.fatal(str(exc))
|
bb.fatal(str(exc))
|
||||||
|
|
||||||
@ -63,8 +58,8 @@ def mark_recipe_dependencies(path, d):
|
|||||||
mark_dependency(d, os.path.join(gitdir, "index"))
|
mark_dependency(d, os.path.join(gitdir, "index"))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip()
|
ref = gitrev_run("git symbolic-ref -q HEAD", gitdir)
|
||||||
except oe.process.CmdError:
|
except bb.process.CmdError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if ref:
|
if ref:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user