[oe] [RFH] Support for automatic package versining using git describe

Otavio Salvador otavio at ossystems.com.br
Fri Feb 13 02:32:21 UTC 2009


Hello,

One of nice features we've been using is the git-describe to get
versions based on tags; many projects are using it to name the
development releases and it does give a better view of how diverged it
from last released version.

So we're looking for a way to use it to generate the PV based on
that. The current git fetcher already has the required support to get
tags, so we can use it as SRCREV, but not yet to use git-describe.

I've tried to implement it, and failed. Here is the current patch just
to reference.

Index: lib/bb/fetch/git.py
===================================================================
--- lib/bb/fetch/git.py (revisão 1150)
+++ lib/bb/fetch/git.py (cópia de trabalho)
@@ -49,10 +49,7 @@
         elif tag:
             ud.tag = tag
 
-        if not ud.tag:
-            ud.tag = self.latest_revision(url, ud, d)  
-
-        if ud.tag == "master":
+        if not ud.tag or ud.tag == "master":
             ud.tag = self.latest_revision(url, ud, d)
 
         ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
@@ -179,6 +176,15 @@
 
         sortable_revision = "%s+%s" % (output.split()[0], ud.tag)
         bb.data.setVar(key, sortable_revision, d)
+
+        if bb.data.getVar("GIT_USE_DESCRIBE", d, False):
+            describe = runfetchcmd("git describe 2> /dev/null").read().strip()
+
+            if describe.empty():
+                bb.data.setVar("GIT_DESCRIBED_VERSION", "0.0.0+gitr%s" % (ud.tag))
+            else:
+                bb.data.setVar("GIT_DESCRIBED_VERSION", describe)
+
         return sortable_revision

Do someone has a better idea how to do that?

TIA,

-- 
Otavio Salvador                  O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br




More information about the Openembedded-devel mailing list