diff options
Diffstat (limited to 'meta-oe/classes')
-rw-r--r-- | meta-oe/classes/gitver.bbclass | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass index ee8323d6f4..e7b5155ee0 100644 --- a/meta-oe/classes/gitver.bbclass +++ b/meta-oe/classes/gitver.bbclass @@ -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: |