mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-15 16:07:26 +00:00
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>
(cherry picked from commit b51af6b5b7)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
committed by
Armin Kuster
parent
12390fd0d6
commit
b95100003d
@@ -40,10 +40,16 @@
|
|||||||
GITPKGV = "${@get_git_pkgv(d, False)}"
|
GITPKGV = "${@get_git_pkgv(d, False)}"
|
||||||
GITPKGVTAG = "${@get_git_pkgv(d, True)}"
|
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
|
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:
|
else:
|
||||||
return version
|
return version
|
||||||
|
|
||||||
@@ -105,7 +111,7 @@ def get_git_pkgv(d, use_tags):
|
|||||||
output = bb.fetch2.runfetchcmd(
|
output = bb.fetch2.runfetchcmd(
|
||||||
"git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
|
"git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
|
||||||
% vars, d, quiet=True).strip()
|
% vars, d, quiet=True).strip()
|
||||||
ver = gitpkgv_drop_tag_prefix(output)
|
ver = gitpkgv_drop_tag_prefix(d, output)
|
||||||
except Exception:
|
except Exception:
|
||||||
ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
|
ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user