diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2024-02-19 01:38:04 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 12:01:00 +0000 |
commit | dcd2abfde55cc59d9869a7c97620b6fc30a52047 (patch) | |
tree | aabd8d77ca96ef6362d2170b5956c147e79aab8d /lib/bb | |
parent | 9134d4777109bc78410c3e641420d9a78b485e33 (diff) | |
download | bitbake-dcd2abfde55cc59d9869a7c97620b6fc30a52047.tar.gz |
fetch2/git: A bit of clean-up of latest_versionstring()
This is mostly preparations for the next commit.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb')
-rw-r--r-- | lib/bb/fetch2/git.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py index db1e28637..39dfd474b 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch2/git.py @@ -827,37 +827,36 @@ class Git(FetchMethod): """ pupver = ('', '') - tagregex = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)") try: output = self._lsremote(ud, d, "refs/tags/*") except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e: bb.note("Could not list remote: %s" % str(e)) return pupver + pver_re = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)") + nonrel_re = re.compile(r"(alpha|beta|rc|final)+") + verstring = "" - revision = "" for line in output.split("\n"): if not line: break - tag_head = line.split("/")[-1] + tag = line.split("/")[-1] # Ignore non-released branches - m = re.search(r"(alpha|beta|rc|final)+", tag_head) - if m: + if nonrel_re.search(tag): continue # search for version in the line - tag = tagregex.search(tag_head) - if tag is None: + m = pver_re.search(tag) + if not m: continue - tag = tag.group('pver') - tag = tag.replace("_", ".") + pver = m.group('pver').replace("_", ".") - if verstring and bb.utils.vercmp(("0", tag, ""), ("0", verstring, "")) < 0: + if verstring and bb.utils.vercmp(("0", pver, ""), ("0", verstring, "")) < 0: continue - verstring = tag + verstring = pver revision = line.split()[0] pupver = (verstring, revision) |