diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2020-01-17 21:34:21 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-01-17 15:44:06 -0800 |
commit | b51af6b5b7a41b44d3539f44c10d21624c4cc4a7 (patch) | |
tree | 3994a9dbe1d5f5368f6c32f870c72ed6650b1542 /meta-oe/classes/gitpkgv.bbclass | |
parent | 1cc86099a86397dadc6e909e689ce20b5091e04b (diff) | |
download | meta-openembedded-contrib-b51af6b5b7a41b44d3539f44c10d21624c4cc4a7.tar.gz |
gitpkgv.bbclass: Add support for extending the supported tag formats
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>
Diffstat (limited to 'meta-oe/classes/gitpkgv.bbclass')
-rw-r--r-- | meta-oe/classes/gitpkgv.bbclass | 14 |
1 files 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: |