All of lore.kernel.org
 help / color / mirror / Atom feed
From: Armin Kuster <akuster808@gmail.com>
To: openembedded-devel@openembedded.org
Subject: [zeus 05/11] gitpkgv.bbclass: Add support for extending the supported tag formats
Date: Sun,  9 Feb 2020 08:17:13 -0800	[thread overview]
Message-ID: <b95100003df03c22eebe6ae5e4342b5281a2ef64.1581264950.git.akuster808@gmail.com> (raw)
In-Reply-To: <cover.1581264950.git.akuster808@gmail.com>

From: Peter Kjellerstedt <pkj@axis.com>

Introduce GITPKGV_TAG_REGEXP (which defaults to "v(\d.*)") to support
dropping other unwanted parts of the found tags than just a leading
"v". Any matching groups in the regexp will be concatenated to yield
the final version.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit b51af6b5b7a41b44d3539f44c10d21624c4cc4a7)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta-oe/classes/gitpkgv.bbclass | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
index ab591bd45c..180421ed35 100644
--- a/meta-oe/classes/gitpkgv.bbclass
+++ b/meta-oe/classes/gitpkgv.bbclass
@@ -40,10 +40,16 @@
 GITPKGV = "${@get_git_pkgv(d, False)}"
 GITPKGVTAG = "${@get_git_pkgv(d, True)}"
 
-def gitpkgv_drop_tag_prefix(version):
+# This regexp is used to drop unwanted parts of the found tags. Any matching
+# groups will be concatenated to yield the final version.
+GITPKGV_TAG_REGEXP ??= "v(\d.*)"
+
+def gitpkgv_drop_tag_prefix(d, version):
     import re
-    if re.match("v\d", version):
-        return version[1:]
+
+    m = re.match(d.getVar('GITPKGV_TAG_REGEXP'), version)
+    if m:
+        return ''.join(group for group in m.groups() if group)
     else:
         return version
 
@@ -105,7 +111,7 @@ def get_git_pkgv(d, use_tags):
                         output = bb.fetch2.runfetchcmd(
                             "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
                             % vars, d, quiet=True).strip()
-                        ver = gitpkgv_drop_tag_prefix(output)
+                        ver = gitpkgv_drop_tag_prefix(d, output)
                     except Exception:
                         ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
                 else:
-- 
2.17.1



  parent reply	other threads:[~2020-02-09 16:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-09 16:17 [zeus 00/11] Patch review Armin Kuster
2020-02-09 16:17 ` [zeus 01/11] libldb: upgrade 1.5.5 -> 1.5.6 Armin Kuster
2020-02-10 20:00   ` Khem Raj
2020-02-09 16:17 ` [zeus 02/11] mariadb: fix library LZ4 lookup Armin Kuster
2020-02-09 16:17 ` [zeus 03/11] python-twisted: add required RDEPENDS for twistd Armin Kuster
2020-02-09 16:17 ` [zeus 04/11] pyhamcrest: add python3 version of recipe Armin Kuster
2020-02-09 16:17 ` Armin Kuster [this message]
2020-02-09 16:17 ` [zeus 06/11] squid: Link with libatomic on riscv Armin Kuster
2020-02-09 16:17 ` [zeus 07/11] grpc: Link with libatomic on clang/x86 Armin Kuster
2020-02-09 16:17 ` [zeus 08/11] grpc: Link with libatomic on powerpc Armin Kuster
2020-02-09 16:17 ` [zeus 09/11] grpc: Link with libatomic on riscv Armin Kuster
2020-02-09 16:17 ` [zeus 10/11] netdata: Add libatomic to link step Armin Kuster
2020-02-09 16:17 ` [zeus 11/11] fluentbit: Fix packaging in multilib env Armin Kuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b95100003df03c22eebe6ae5e4342b5281a2ef64.1581264950.git.akuster808@gmail.com \
    --to=akuster808@gmail.com \
    --cc=openembedded-devel@openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.