diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2024-02-19 01:38:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 15:08:30 +0000 |
commit | d25f6b970fbe252d947082a46f7d84490ddcd7da (patch) | |
tree | 25d332e9bc640706cfdf006e9c268d004fcd242f | |
parent | 9694fe1d684ec80a7e1efdb62a954f89275cb273 (diff) | |
download | poky-d25f6b970fbe252d947082a46f7d84490ddcd7da.tar.gz |
bitbake: fetch2/git: Make latest_versionstring extract tags with slashes correctly
Before, everything up to the last slash was removed when extracting the
names of the tags. This would lead to that a tag such as "agent/11.0.0"
would be incorrectly identified as "11.0.0", which would then be treated
as a correct version matching "^(?P<pver>\d+(\.\d+)+)".
(Bitbake rev: 8b21024b9966d5158ac4a77e87ffb935c2a57764)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 39dfd474b3..df33fb6aeb 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -833,6 +833,7 @@ class Git(FetchMethod): | |||
833 | bb.note("Could not list remote: %s" % str(e)) | 833 | bb.note("Could not list remote: %s" % str(e)) |
834 | return pupver | 834 | return pupver |
835 | 835 | ||
836 | rev_tag_re = re.compile(r"([0-9a-f]{40})\s+refs/tags/(.*)") | ||
836 | pver_re = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)") | 837 | 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 | nonrel_re = re.compile(r"(alpha|beta|rc|final)+") |
838 | 839 | ||
@@ -841,7 +842,12 @@ class Git(FetchMethod): | |||
841 | if not line: | 842 | if not line: |
842 | break | 843 | break |
843 | 844 | ||
844 | tag = line.split("/")[-1] | 845 | m = rev_tag_re.match(line) |
846 | if not m: | ||
847 | continue | ||
848 | |||
849 | (revision, tag) = m.groups() | ||
850 | |||
845 | # Ignore non-released branches | 851 | # Ignore non-released branches |
846 | if nonrel_re.search(tag): | 852 | if nonrel_re.search(tag): |
847 | continue | 853 | continue |
@@ -857,7 +863,6 @@ class Git(FetchMethod): | |||
857 | continue | 863 | continue |
858 | 864 | ||
859 | verstring = pver | 865 | verstring = pver |
860 | revision = line.split()[0] | ||
861 | pupver = (verstring, revision) | 866 | pupver = (verstring, revision) |
862 | 867 | ||
863 | return pupver | 868 | return pupver |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index ca869fb24c..5ed5b5607f 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1420,6 +1420,8 @@ class FetchLatestVersionTest(FetcherTest): | |||
1420 | : "1.3.59", | 1420 | : "1.3.59", |
1421 | ("remake", "git://github.com/rocky/remake.git;protocol=https;branch=master", "f05508e521987c8494c92d9c2871aec46307d51d", r"(?P<pver>(\d+\.(\d+\.)*\d*(\+dbg\d+(\.\d+)*)*))", "") | 1421 | ("remake", "git://github.com/rocky/remake.git;protocol=https;branch=master", "f05508e521987c8494c92d9c2871aec46307d51d", r"(?P<pver>(\d+\.(\d+\.)*\d*(\+dbg\d+(\.\d+)*)*))", "") |
1422 | : "3.82+dbg0.9", | 1422 | : "3.82+dbg0.9", |
1423 | ("sysdig", "git://github.com/draios/sysdig.git;branch=dev;protocol=https", "4fb6288275f567f63515df0ff0a6518043ecfa9b", r"^(?P<pver>\d+(\.\d+)+)", "10.0.0") | ||
1424 | : "0.28.0", | ||
1423 | } | 1425 | } |
1424 | 1426 | ||
1425 | test_wget_uris = { | 1427 | test_wget_uris = { |