diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2020-01-17 21:34:21 +0100 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2020-01-30 18:17:17 -0800 |
commit | b95100003df03c22eebe6ae5e4342b5281a2ef64 (patch) | |
tree | 004dd0021a517bed4abf93d3eb4c60e5161cf035 /meta-oe/classes | |
parent | 12390fd0d6f0ddca04783b2920a5d60fecd78b6a (diff) | |
download | meta-openembedded-b95100003df03c22eebe6ae5e4342b5281a2ef64.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>
(cherry picked from commit b51af6b5b7a41b44d3539f44c10d21624c4cc4a7)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe/classes')
-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 ab591bd45..180421ed3 100644 --- a/meta-oe/classes/gitpkgv.bbclass +++ b/meta-oe/classes/gitpkgv.bbclass | |||
@@ -40,10 +40,16 @@ | |||
40 | GITPKGV = "${@get_git_pkgv(d, False)}" | 40 | GITPKGV = "${@get_git_pkgv(d, False)}" |
41 | GITPKGVTAG = "${@get_git_pkgv(d, True)}" | 41 | GITPKGVTAG = "${@get_git_pkgv(d, True)}" |
42 | 42 | ||
43 | def gitpkgv_drop_tag_prefix(version): | 43 | # This regexp is used to drop unwanted parts of the found tags. Any matching |
44 | # groups will be concatenated to yield the final version. | ||
45 | GITPKGV_TAG_REGEXP ??= "v(\d.*)" | ||
46 | |||
47 | def gitpkgv_drop_tag_prefix(d, version): | ||
44 | import re | 48 | import re |
45 | if re.match("v\d", version): | 49 | |
46 | return version[1:] | 50 | m = re.match(d.getVar('GITPKGV_TAG_REGEXP'), version) |
51 | if m: | ||
52 | return ''.join(group for group in m.groups() if group) | ||
47 | else: | 53 | else: |
48 | return version | 54 | return version |
49 | 55 | ||
@@ -105,7 +111,7 @@ def get_git_pkgv(d, use_tags): | |||
105 | output = bb.fetch2.runfetchcmd( | 111 | output = bb.fetch2.runfetchcmd( |
106 | "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null" | 112 | "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null" |
107 | % vars, d, quiet=True).strip() | 113 | % vars, d, quiet=True).strip() |
108 | ver = gitpkgv_drop_tag_prefix(output) | 114 | ver = gitpkgv_drop_tag_prefix(d, output) |
109 | except Exception: | 115 | except Exception: |
110 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) | 116 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) |
111 | else: | 117 | else: |