diff mbox series

[bitbake-devel,V3,1/5] fetch2/git.py: add filter_regex parameter to latest_versionstring

Message ID 20260509052950.1565384-1-Qi.Chen@windriver.com
State New
Headers show
Series [bitbake-devel,V3,1/5] fetch2/git.py: add filter_regex parameter to latest_versionstring | expand

Commit Message

ChenQi May 9, 2026, 5:29 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

We want to be able to do stable version upgrade for recipes. For
example, 1.0.0 -> 1.0.1 instead of 1.0.0 -> 1.1.0.

To to this, we need an extra paramter to latest_versionstring
so that we are able to filter out the versions we need. Using regex
has the advantage of adapting to different version schemes.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 lib/bb/fetch2/git.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Mathieu Dubois-Briand May 12, 2026, 11:42 a.m. UTC | #1
On Sat May 9, 2026 at 7:29 AM CEST, Chen Qi via lists.openembedded.org wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> We want to be able to do stable version upgrade for recipes. For
> example, 1.0.0 -> 1.0.1 instead of 1.0.0 -> 1.1.0.
>
> To to this, we need an extra paramter to latest_versionstring
> so that we are able to filter out the versions we need. Using regex
> has the advantage of adapting to different version schemes.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---

Hi Chen,

Thanks for your patch.

This is conflicting with some patches that were merged yesterday. I
tried to solve these conflicts, but I get some bitbake-selftest error:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3936

Either I didn't fix the conflicts correctly or your patch has issues.

Can you rebase on top of master and make sure bitbake-selftest runs
successfully?

Thanks,
Mathieu
ChenQi May 13, 2026, 2:44 a.m. UTC | #2
On 5/12/26 19:42, Mathieu Dubois-Briand via lists.openembedded.org wrote:
> On Sat May 9, 2026 at 7:29 AM CEST, Chen Qi via lists.openembedded.org wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> We want to be able to do stable version upgrade for recipes. For
>> example, 1.0.0 -> 1.0.1 instead of 1.0.0 -> 1.1.0.
>>
>> To to this, we need an extra paramter to latest_versionstring
>> so that we are able to filter out the versions we need. Using regex
>> has the advantage of adapting to different version schemes.
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> ---
> Hi Chen,
>
> Thanks for your patch.
>
> This is conflicting with some patches that were merged yesterday. I
> tried to solve these conflicts, but I get some bitbake-selftest error:
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3936
>
> Either I didn't fix the conflicts correctly or your patch has issues.
>
> Can you rebase on top of master and make sure bitbake-selftest runs
> successfully?

Yes, of course. I'll do it and send out V4.

Regards,
Qi

>
> Thanks,
> Mathieu
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#19499): https://lists.openembedded.org/g/bitbake-devel/message/19499
> Mute This Topic: https://lists.openembedded.org/mt/119226364/3618072
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [Qi.Chen@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 10eb63b20..a3a26a46c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -976,7 +976,7 @@  class Git(FetchMethod):
         raise bb.fetch2.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output for %s" % \
             (ud.unresolvedrev, ud.host+ud.path))
 
-    def latest_versionstring(self, ud, d):
+    def latest_versionstring(self, ud, d, filter_regex=None):
         """
         Compute the latest release name like "x.y.x" in "x.y.x+gitHASH"
         by searching through the tags output of ls-remote, comparing
@@ -1016,6 +1016,10 @@  class Git(FetchMethod):
 
             pver = m.group('pver').replace("_", ".")
 
+            if filter_regex:
+                if not re.match(filter_regex, pver):
+                    continue
+
             if verstring and bb.utils.vercmp(("0", pver, ""), ("0", verstring, "")) < 0:
                 continue