Skip to contentSkip to conversation

recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status

PATCH Superseded [email protected] 2 participants 10 messages May 9 – May 11

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/6 recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status

From: Chen Qi <[email protected]>

We want the ability to do stable version upgrades for recipes. To this end, add an optional stable_upgrade parameter to the get_recipe_upgrade_status function, which defaults to False and when enabled will try to get the latest stable version of the recipe.

The UPSTREAM_STABLE_RELEASE_REGEX is respected. If a recipe sets it, it will be used as the filter_regex. If it's not set explicitly, it means that there's no stable updates or the recipe hasn't been checked yet.

---
 meta/lib/oe/recipeutils.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
meta/lib/oe/recipeutils.py +17 -6
index c6604f536d..7c1df518a8 100644
@@ -1009,7 +1009,7 @@ def get_recipe_pv_with_pfx_sfx(pv, uri_type):
 
     return (pv, pfx, sfx)
 
-def get_recipe_upstream_version(rd):
+def get_recipe_upstream_version(rd, stable_upgrade):
     """
         Get upstream version of recipe using bb.fetch2 methods with support for
         http, https, ftp and git.
@@ -1080,7 +1080,15 @@ def get_recipe_upstream_version(rd):
             except bb.fetch2.FetchError as e:
                 bb.warn("Unable to obtain latest revision: {}".format(e))
         else:
-            pupver = ud.method.latest_versionstring(ud, rd)
+            if stable_upgrade:
+                stable_release_regex = rd.getVar("UPSTREAM_STABLE_RELEASE_REGEX")
+                if stable_release_regex:
+                    pupver = ud.method.latest_versionstring(ud, rd, filter_regex=stable_release_regex)
+                else:
+                    # Not explicitly setting "UPSTREAM_STABLE_RELEASE_REGEX" means there's no stable upgrade
+                    pupver = (ru['current_version'], None)
+            else:
+                pupver = ud.method.latest_versionstring(ud, rd)
             (upversion, revision) = pupver
 
         if upversion:
@@ -1094,8 +1102,8 @@ def get_recipe_upstream_version(rd):
 
     return ru
 
-def _get_recipe_upgrade_status(data):
-    uv = get_recipe_upstream_version(data)
+def _get_recipe_upgrade_status(data, stable_upgrade):
+    uv = get_recipe_upstream_version(data, stable_upgrade)
 
     pn = data.getVar('PN')
     cur_ver = uv['current_version']
@@ -1119,9 +1127,10 @@ def _get_recipe_upgrade_status(data):
 
     return {'pn':pn, 'status':status, 'cur_ver':cur_ver, 'next_ver':next_ver, 'maintainer':maintainer, 'revision':revision, 'no_upgrade_reason':no_upgrade_reason}
 
-def get_recipe_upgrade_status(recipes=None):
+def get_recipe_upgrade_status(recipes=None, stable_upgrade=False):
     pkgs_list = []
     data_copy_list = []
+    stable_copy_list = []
     copy_vars = ('SRC_URI',
                  'PV',
                  'DL_DIR',
@@ -1134,6 +1143,7 @@ def get_recipe_upgrade_status(recipes=None):
                  'UPSTREAM_CHECK_REGEX',
                  'UPSTREAM_CHECK_URI',
                  'UPSTREAM_VERSION_UNKNOWN',
+                 'UPSTREAM_STABLE_RELEASE_REGEX',
                  'RECIPE_MAINTAINER',
                  'RECIPE_NO_UPDATE_REASON',
                  'RECIPE_UPSTREAM_VERSION',
@@ -1180,12 +1190,13 @@ def get_recipe_upgrade_status(recipes=None):
                     data_copy.setVar(k, data.getVar(k))
 
             data_copy_list.append(data_copy)
+            stable_copy_list.append(stable_upgrade)
 
             recipeincludes[data.getVar('FILE')] = {'bbincluded':data.getVar('BBINCLUDED').split(),'pn':data.getVar('PN')}
 
     from concurrent.futures import ProcessPoolExecutor
     with ProcessPoolExecutor(max_workers=utils.cpu_count()) as executor:
-        pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list)
+        pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list, stable_copy_list)
 
     return _group_recipes(pkgs_list, _get_common_include_recipes(recipeincludes))
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 2/6 upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

From: Chen Qi <[email protected]>

When inheriting this bbclass, the recipe should have been checked to be sure that the last part bump (e.g., 1.0.0 -> 1.0.1 or 34 -> 34.1) is a stable version upgrade.

---
 .../upstream-stable-release-point.bbclass     | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/classes-recipe/upstream-stable-release-point.bbclass
meta/classes-recipe/upstream-stable-release-point.bbclass new file +22 -0
new file mode 100644
index 0000000000..947f882152
@@ -0,0 +1,22 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
+# This bbclass is expected to be inherited by recipes explicitly.
+# If a recipe's version is separated by point and its last part's
+# bump is a stable upgrade, then it can inherit this bbclass.
+#
+
+def get_majmin_version_regex(d):
+    pv = d.getVar('PV')
+    v_parts = pv.split('.')
+    if len(v_parts) == 1:
+        return pv
+    else:
+        return '\.'.join(v_parts[:-1])
+
+MAJMIN_VERSION_REGEX = "${@get_majmin_version_regex(d)}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION_REGEX}\.\d"
Signature · 1 line
2.34.1
#2 lore raw

Re: [OE-core][PATCH V3 2/6] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

meta/classes-recipe/upstream-stable-release-point.bbclass line 19

Quoted 7 lines · On Sat, 9 May 2026 at 07:30, <[email protected]> wrote:
meta/classes-recipe/upstream-stable-release-point.bbclass new file +7 -0
+def get_majmin_version_regex(d):
+    pv = d.getVar('PV')
+    v_parts = pv.split('.')
+    if len(v_parts) == 1:
+        return pv
+    else:
+        return '\.'.join(v_parts[:-1])

To be honest, I would not special-case the len(v_parts) == 1, as the class becomes somewhat inconsistent:

x -> x.1 is supported
x.y -> x.y.1 is not supported (instead it treats the stable versions as x.y -> x.y+1 )

These are two different schemes, so I would not mix them in a single class, and support only:

x.y -> x.y+1
x.y.z -> x.y.z+1
x.y.z.zz -> x.y.z.zz+1
etc

For x->x.1 we can make a different class,
'upstream-stable-release-append-number' maybe ?

meta/classes-recipe/upstream-stable-release-point.bbclass line 22

Quoted 2 lines
meta/classes-recipe/upstream-stable-release-point.bbclass new file +2 -0
+MAJMIN_VERSION_REGEX = "${@get_majmin_version_regex(d)}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION_REGEX}\.\d"

\.\d should be (\.\d+)+ to allow numbers bigger than 9 and multiple .number parts one after another.

Alex

#3 lore raw

Re: [OE-core][PATCH V3 2/6] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

Quoted 10 lines · Alexander Kanavin

To be honest, I would not special-case the len(v_parts) == 1, as the class becomes somewhat inconsistent:

x -> x.1 is supported
x.y -> x.y.1 is not supported (instead it treats the stable versions as x.y -> x.y+1 )

These are two different schemes, so I would not mix them in a single class, and support only:

Quoted 7 lines

x.y -> x.y+1
x.y.z -> x.y.z+1
x.y.z.zz -> x.y.z.zz+1
etc

For x->x.1 we can make a different class,
'upstream-stable-release-append-number' maybe ?

On further thought, the class should support only
major.minor.point[.subpoint] schemes.

The problem with removing only the last number is when upstream issues:
x.y.z -> x.y.z.zz, we update to that, and then there's x.y.z.zz -> x.y.z+1 - this would not be considered a stable update, even though it is.

It's a bit complicated to get it right :)

So basically:

def get_majmin_version_regex(d):

    pv = d.getVar('PV')
    v_parts_majmin = pv.split('.')[:2]
    return '\.'.join(v_parts_majmin)

...
UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION_REGEX}(\.\d+)+"

Alex

author
#4 lore raw

Re: [OE-core][PATCH V3 2/6] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

In reply to Alexander Kanavin
Quoted 10 lines · Alexander Kanavin

meta/classes-recipe/upstream-stable-release-point.bbclass line 19

Quoted 7 lines · On Sat, 9 May 2026 at 07:30, <[email protected]> wrote:
meta/classes-recipe/upstream-stable-release-point.bbclass new file +7 -0
+def get_majmin_version_regex(d):
+    pv = d.getVar('PV')
+    v_parts = pv.split('.')
+    if len(v_parts) == 1:
+        return pv
+    else:
+        return '\.'.join(v_parts[:-1])

To be honest, I would not special-case the len(v_parts) == 1, as the class becomes somewhat inconsistent:

Hi Alex,

The check is to avoid the function returning empty string. At that time, I was dealing with systemd and kmod.

I agree that this x -> x.1 special case introduces inconsistency.

Quoted 8 lines

x -> x.1 is supported
x.y -> x.y.1 is not supported (instead it treats the stable versions as x.y -> x.y+1 )

These are two different schemes, so I would not mix them in a single class, and support only:

Quoted 7 lines

x.y -> x.y+1
x.y.z -> x.y.z+1
x.y.z.zz -> x.y.z.zz+1
etc

For x->x.1 we can make a different class,
'upstream-stable-release-append-number' maybe ?

If we do so, recipes like systemd/kmod cannot inherit this bbclass as it will do uprevs like 259.1 -> 259.2 as well as 259 -> 259.1.

I mean, they can only inherit one such bbclass.

Ideally, I'd like things to be in one bbclass, maybe with some var controlling the behavior.

Quoted 5 lines

meta/classes-recipe/upstream-stable-release-point.bbclass line 22

Quoted 3 lines
meta/classes-recipe/upstream-stable-release-point.bbclass new file +2 -0
+MAJMIN_VERSION_REGEX = "${@get_majmin_version_regex(d)}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION_REGEX}\.\d"

\.\d should be (\.\d+)+ to allow numbers bigger than 9 and multiple .number parts one after another.

You're right about this '+'.

With your review, I'm now thinking about using something like below:

Introduce one configurable variable for this bbclass: MAJMIN_VERSION_PARTS ?= ""

By default, it's not set and the majmin version should be the [:-1] part (I mean for 1.2.3, majmin is 1.2). And for recipes like systemd/kmod, when inheriting this bbclass, they should also set MAJMIN_VERSION_PARTS = "1", so the majmin version is [:1]. Recipes who want to do x.y -> x.y.1 or x.y -> x.y.1.1 can set MAJMIN_VERSION_PARTS = "2", so that the majmin version is [:2] which is x.y in this case.

The number of recipes setting this var should be few.

What do you think about the above solution?

Regards,
Qi

Quoted 2 lines

Alex

#5 lore raw

Re: [OE-core][PATCH V3 2/6] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

Quoted 10 lines · ChenQi

Introduce one configurable variable for this bbclass:
MAJMIN_VERSION_PARTS ?= ""

By default, it's not set and the majmin version should be the [:-1] part (I mean for 1.2.3, majmin is 1.2). And for recipes like systemd/kmod, when inheriting this bbclass, they should also set MAJMIN_VERSION_PARTS = "1", so the majmin version is [:1]. Recipes who want to do x.y -> x.y.1 or x.y -> x.y.1.1 can set MAJMIN_VERSION_PARTS = "2", so that the majmin version is [:2] which is x.y in this case.

Quoted 3 lines

The number of recipes setting this var should be few.

What do you think about the above solution?

I agree with introducing the variable for configuration, but the problem with using the [:-1] default is that it sets up an upgrade 'trap' where this sequence in stable x.y releases:
x.y.z -> x.y.z.zz
x.y.z.zz -> x.y.z+1
will cause recipes to get stuck at x.y.z.zz.

My proposal is:
- let's drop the majmin naming, it's only suitable for major.minor schemes. I'd suggest naming it STABLE_VERSION_PARTS.

- then the class would slice that many parts from the front, and then add a regex that says 'anything after this is a maintenance release'.

STABLE_VERSION_PARTS ?= "2"
def get_stable_version_regex(d):

    pv = d.getVar('PV')
    stable_parts = pv.split('.')[:int(d.getVar('STABLE_VERSION_PARTS'))]
    return '\.'.join(stable_parts)

STABLE_VERSION_REGEX = "${@get_stable_version_regex(d)}" UPSTREAM_STABLE_RELEASE_REGEX = "${STABLE_VERSION_REGEX}.+"

I think this should cover everything common?

Alex

#6 lore raw

PATCH v3 3/6 vte: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

The last version part bump for vte is a stable upgrade.

* Evidence

Its repo[1] has remote branches like:

    origin/vte-0-76
    origin/vte-0-78
    origin/vte-0-80
    origin/vte-0-82
    origin/vte-0-84

So for example, 0.82.2 -> 0.82.3 is a stable upgrade.

[1] https://gitlab.gnome.org/GNOME/vte.git

---
 meta/recipes-support/vte/vte_0.82.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/vte/vte_0.82.2.bb +1 -1
index d5dced4ce6..839475f32c 100644
@@ -15,7 +15,7 @@ DEPENDS = "fastfloat fmt glib-2.0 glib-2.0-native gtk+3 libpcre2 libxml2-native
 
 GIR_MESON_OPTION = 'gir'
 GIDOCGEN_MESON_OPTION = "docs"
-inherit gnomebase gi-docgen features_check upstream-version-is-even gobject-introspection systemd vala
+inherit gnomebase gi-docgen features_check upstream-version-is-even gobject-introspection systemd vala upstream-stable-release-point
 
 SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch \
             file://0001-support-reproducibility-for-debug-sources.patch;patchdir=./subprojects/simdutf \
Signature · 1 line
2.34.1
#7 lore raw

PATCH v3 4/6 systemd: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

The last version part bump for vte is a stable upgrade.

* Evidence

Its repo[1] has remote branches like:

    origin/v256-stable
    origin/v257-stable
    origin/v258-stable
    origin/v259-stable
    origin/v260-stable

[1] https://github.com/systemd/systemd.git

---
 meta/recipes-core/systemd/systemd.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-core/systemd/systemd.inc +2 -0
index f107c4c5da..6b3989058b 100644
@@ -19,6 +19,8 @@ SRCREV = "b3d8fc43e9cb531d958c17ef2cd93b374bc14e8a"
 SRCBRANCH = "v259-stable"
 SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH};tag=v${PV}"
 
+inherit upstream-stable-release-point
+
 CVE_PRODUCT = "systemd"
 
 CVE_STATUS[CVE-2019-3815] = "not-applicable-platform: only applied to RHEL"
Signature · 1 line
2.34.1
#8 lore raw

PATCH v3 5/6 kmod: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

The last version part bump for vte is a stable upgrade.

* Evidence

Its repo contains a branch called:
origin/kmod-34.y

Its tags are like:
v32
v33
v34
v34.1

So we can infer that the maintenance policy for kmod is that upgrades such as 33 -> 34 contains features and upgrades such as 34 -> 34.1 is a stable upgrade. And such maintenance policy is likely to continue.

[1] https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git

---
 meta/recipes-kernel/kmod/kmod_34.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-kernel/kmod/kmod_34.2.bb +1 -1
index e5923a64cf..9518973c6b 100644
@@ -13,7 +13,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
                     file://libkmod/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
                     file://tools/COPYING;md5=751419260aa954499f7abaabaa882bbe \
                    "
-inherit bash-completion gtk-doc manpages meson pkgconfig update-alternatives
+inherit bash-completion gtk-doc manpages meson pkgconfig update-alternatives upstream-stable-release-point
 
 SRC_URI = "https://www.kernel.org/pub/linux/utils/kernel/${BPN}/${BP}.tar.xz \
            file://depmod-search.conf \
Signature · 1 line
2.34.1
#9 lore raw

PATCH v3 6/6 util-linux: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

The last version part bump for vte is a stable upgrade.

* Evidence

Its repo[1] contains branches like:

    origin/stable/v2.39
    origin/stable/v2.40
    origin/stable/v2.41

[1] https://github.com/util-linux/util-linux.git

---
 meta/recipes-core/util-linux/util-linux.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-core/util-linux/util-linux.inc +2 -0
index 0235862666..1068e24b76 100644
@@ -25,4 +25,6 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
 
 SRC_URI[sha256sum] = "3330d873f0fceb5560b89a7dc14e4f3288bbd880e96903ed9b50ec2b5799e58b"
 
+inherit upstream-stable-release-point
+
 CVE_PRODUCT = "util-linux"
Signature · 1 line
2.34.1