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 15:08:30 +0000 |
| commit | 9694fe1d684ec80a7e1efdb62a954f89275cb273 (patch) | |
| tree | 5055be39bc84e8ec4e0f3ab31b6d77303ca70126 /bitbake/lib/bb/fetch2/git.py | |
| parent | 21603031df33b820daf7c37e2c8c824848368367 (diff) | |
| download | poky-9694fe1d684ec80a7e1efdb62a954f89275cb273.tar.gz | |
bitbake: fetch2/git: A bit of clean-up of latest_versionstring()
This is mostly preparations for the next commit.
(Bitbake rev: dcd2abfde55cc59d9869a7c97620b6fc30a52047)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
| -rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index db1e286371..39dfd474b3 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
| @@ -827,37 +827,36 @@ class Git(FetchMethod): | |||
| 827 | """ | 827 | """ |
| 828 | pupver = ('', '') | 828 | pupver = ('', '') |
| 829 | 829 | ||
| 830 | tagregex = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)") | ||
| 831 | try: | 830 | try: |
| 832 | output = self._lsremote(ud, d, "refs/tags/*") | 831 | output = self._lsremote(ud, d, "refs/tags/*") |
| 833 | except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e: | 832 | except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e: |
| 834 | bb.note("Could not list remote: %s" % str(e)) | 833 | bb.note("Could not list remote: %s" % str(e)) |
| 835 | return pupver | 834 | return pupver |
| 836 | 835 | ||
| 836 | pver_re = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)") | ||
| 837 | nonrel_re = re.compile(r"(alpha|beta|rc|final)+") | ||
| 838 | |||
| 837 | verstring = "" | 839 | verstring = "" |
| 838 | revision = "" | ||
| 839 | for line in output.split("\n"): | 840 | for line in output.split("\n"): |
| 840 | if not line: | 841 | if not line: |
| 841 | break | 842 | break |
| 842 | 843 | ||
| 843 | tag_head = line.split("/")[-1] | 844 | tag = line.split("/")[-1] |
| 844 | # Ignore non-released branches | 845 | # Ignore non-released branches |
| 845 | m = re.search(r"(alpha|beta|rc|final)+", tag_head) | 846 | if nonrel_re.search(tag): |
| 846 | if m: | ||
| 847 | continue | 847 | continue |
| 848 | 848 | ||
| 849 | # search for version in the line | 849 | # search for version in the line |
| 850 | tag = tagregex.search(tag_head) | 850 | m = pver_re.search(tag) |
| 851 | if tag is None: | 851 | if not m: |
| 852 | continue | 852 | continue |
| 853 | 853 | ||
| 854 | tag = tag.group('pver') | 854 | pver = m.group('pver').replace("_", ".") |
| 855 | tag = tag.replace("_", ".") | ||
| 856 | 855 | ||
| 857 | if verstring and bb.utils.vercmp(("0", tag, ""), ("0", verstring, "")) < 0: | 856 | if verstring and bb.utils.vercmp(("0", pver, ""), ("0", verstring, "")) < 0: |
| 858 | continue | 857 | continue |
| 859 | 858 | ||
| 860 | verstring = tag | 859 | verstring = pver |
| 861 | revision = line.split()[0] | 860 | revision = line.split()[0] |
| 862 | pupver = (verstring, revision) | 861 | pupver = (verstring, revision) |
| 863 | 862 | ||
