Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [bitbake-devel][PATCH V2 1/5] fetch2/git.py: add filter_regex parameter to latest_versionstring
@ 2026-05-07  6:18 Qi.Chen
  2026-05-07  6:18 ` [bitbake-devel][PATCH V2 2/5] fetch2/wget.py: " Qi.Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Qi.Chen @ 2026-05-07  6:18 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alex.kanavin, randy.macleod

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(-)

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
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-05-08  5:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07  6:18 [bitbake-devel][PATCH V2 1/5] fetch2/git.py: add filter_regex parameter to latest_versionstring Qi.Chen
2026-05-07  6:18 ` [bitbake-devel][PATCH V2 2/5] fetch2/wget.py: " Qi.Chen
2026-05-07 10:43   ` Alexander Kanavin
2026-05-08  5:26     ` Chen, Qi
2026-05-07  6:18 ` [bitbake-devel][PATCH V2 3/5] fetch2/crate.py: " Qi.Chen
2026-05-07 10:51   ` Alexander Kanavin
2026-05-08  5:26     ` Chen, Qi
2026-05-07  6:18 ` [bitbake-devel][PATCH V2 4/5] fetch2/__init__.py: add filter_regex to default latest_versionstring Qi.Chen
2026-05-07  6:18 ` [bitbake-devel][PATCH V2 5/5] bb/tests/fetch.py: add case for filter_regex parameter in latest_versionstring Qi.Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox