Patchwork [meta-oe] gitver: fix gitver to work with yocto 1.3

login
register
mail settings
Submitter Radek Dostal
Date Oct. 29, 2012, 7:53 a.m.
Message ID <1351497216-13574-1-git-send-email-rd@radekdostal.com>
Download mbox | patch
Permalink /patch/38637/
State Accepted
Commit 36f85eee821565c5bc197e7215ba13411a5605b4
Headers show

Comments

Radek Dostal - Oct. 29, 2012, 7:53 a.m.
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>
---
 meta-oe/classes/gitver.bbclass |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

Patch

diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass
index ee8323d..e7b5155 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: