Skip to contentSkip to conversation

recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status

PATCH In review [email protected] 3 participants 10 messages May 18 – Jun 2

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/7 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 v6 2/7 upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

From: Chen Qi <[email protected]>

If a recipe can do stable version upgrade and the stable parts of the version is seperated by '.', then it can inherit this bbclass.

By default, the stable parts number is 2, which means the following upgrades are stable version upgrades:
x.y.z -> x.y.z+1
x.y.z+1 -> x.y.z+1.zz
x.y.z+1.zz -> x.y.z+2

Recipes that have different stable version parts can also inherit this bbclass and set STABLE_VERSION_PARTS. For example, systemd sets this variable to "1".

For recipes whose stable version part is not separated by '.', they should not inherit this bbclass and intead set UPSTREAM_STABLE_RELEASE_REGEX themselves. For example, openssh's stable part is separted by 'p' and should not inherit this bbclass.

---
 .../upstream-stable-release-point.bbclass     | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 meta/classes-recipe/upstream-stable-release-point.bbclass
meta/classes-recipe/upstream-stable-release-point.bbclass new file +21 -0
new file mode 100644
index 0000000000..98fdb5b808
@@ -0,0 +1,21 @@
+#
+# 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 we know for sure
+# which parts of the version represent the stable part, then the
+# recipe could inherit this bbclass.
+#
+
+STABLE_VERSION_PARTS ?= "2"
+def get_majmin_version_regex(d):
+    pv = d.getVar('PV')
+    stable_parts = pv.split('.')[:int(d.getVar('STABLE_VERSION_PARTS'))]
+    return r'\.'.join(stable_parts)
+
+STABLE_VERSION_REGEX = "${@get_majmin_version_regex(d)}"
+UPSTREAM_STABLE_RELEASE_REGEX ?= "^${STABLE_VERSION_REGEX}(\.\d+)*$"
Signature · 1 line
2.34.1
#2 lore raw

PATCH v6 3/7 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
#3 lore raw

PATCH v6 4/7 systemd: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

Upgrades like 259 -> 259.1 or 259.1 -> 259.2 are stable upgrades for systemd.

* 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 | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-core/systemd/systemd.inc +3 -0
index f107c4c5da..e63dde3af9 100644
@@ -19,6 +19,9 @@ 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
+STABLE_VERSION_PARTS = "1"
+
 CVE_PRODUCT = "systemd"
 
 CVE_STATUS[CVE-2019-3815] = "not-applicable-platform: only applied to RHEL"
Signature · 1 line
2.34.1
#4 lore raw

PATCH v6 5/7 kmod: inherit upstream-stable-release-point

In reply to [email protected]

From: Chen Qi <[email protected]>

Upgrades like 34 -> 34.1 or 34.1 -> 34.2 for kmod are stable upgrades.

* 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-kernel/kmod/kmod_34.2.bb +3 -1
index e5923a64cf..a61466cefb 100644
@@ -13,13 +13,15 @@ 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 \
            "
 SRC_URI[sha256sum] = "5a5d5073070cc7e0c7a7a3c6ec2a0e1780850c8b47b3e3892226b93ffcb9cb54"
 
+STABLE_VERSION_PARTS = "1"
+
 EXTRA_OEMESON += "\
     -Ddistconfdir=${nonarch_base_libdir} \
     --bindir=${base_bindir} \
Signature · 1 line
2.34.1
#5 lore raw

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

In reply to [email protected]

From: Chen Qi <[email protected]>

util-linux has x.y.z version scheme and the bump in z is a stable version upgrade. For example, 2.41.1 -> 2.41.2 is a stable version 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
#6 lore raw

PATCH v6 7/7 openssh: set UPSTREAM_STABLE_RELEASE_REGEX

In reply to [email protected]

From: Chen Qi <[email protected]>

For openssh, 10.3p1 -> 10.3p2 is a stable upgrade.

---
 meta/recipes-connectivity/openssh/openssh_10.3p1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-connectivity/openssh/openssh_10.3p1.bb +3 -0
index a050475532..e2018f07da 100644
@@ -27,6 +27,9 @@ SRC_URI = "https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.ta
            "
 SRC_URI[sha256sum] = "56682a36bb92dcf4b4f016fd8ec8e74059b79a8de25c15d670d731e7d18e45f4"
 
+STABLE_VERSION = "${@d.getVar('PV').split('p')[0].replace('.', r'\.')}"
+UPSTREAM_STABLE_RELEASE_REGEX = "^${STABLE_VERSION}p\d+$"
+
 CVE_STATUS[CVE-2007-2768] = "not-applicable-config: This CVE is specific to OpenSSH with the pam opie which we don't build/use here."
 
 # This CVE is specific to OpenSSH server, as used in Fedora and Red Hat Enterprise Linux 7
Signature · 1 line
2.34.1
#7 lore raw
In reply to [email protected]
Quoted 7 lines · On Mon, 2026-05-18 at 13:55 +0800, [email protected] wrote:

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.

Quoted 6 lines

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.

Hi Qi,

We discussed this series on the patch review call. The implementation here looks good and we're broadly in favour of this approach.

But, before we merge this we need to:
- confirm how this will be used on the stable branch
- agree what criteria we judge upstream stable branches against
- get buy-in from the stable maintainer

As this will alter our policy of how we handle stable recipe updates, someone needs to send a proposal to the openembedded-architecture list.

If you can send the initial email to the architecture list with how you see this working, I'm happy to provide feedback and drive the discussion forwards.

Best regards,

Signature · 1 line
Paul Barker
#8 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, 18 May 2026 at 07:56, <[email protected]> wrote:

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.

Hello Chen,

can you also add support for this to 'devtool latest-version' and 'devtool check-upgrade-status' and 'devtool upgrade' which would use this when --stable option is passed in? So that stable updates can be checked for and upgraded to without having to set up and run AUH.

Alex

author
#9 lore raw
Quoted 10 lines · Alexander Kanavin
Quoted 9 lines · On Mon, 18 May 2026 at 07:56, <[email protected]> wrote:

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.

Quoted 8 lines

Hello Chen,

can you also add support for this to 'devtool latest-version' and 'devtool check-upgrade-status' and 'devtool upgrade' which would use this when --stable option is passed in? So that stable updates can be checked for and upgraded to without having to set up and run AUH.

Alex

Yes. I'll add '--stable' option to these three subcommands of devtool.

Regards,
Qi