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

Radek Dostal rd at radekdostal.com
Mon Oct 29 07:53:35 UTC 2012


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 at radekdostal.com>
---
 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 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:
-- 
1.7.5.4





More information about the Openembedded-devel mailing list