Skip to contentSkip to conversation

recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status

PATCH Superseded [email protected] 2 participants 6 messages May 7 – May 8

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 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, we give it a reasonable default value, which means if a version consists of at least three parts, the bump in last one is considered as a stable upgrade. If a version consists of less then three parts, we'd be conservative to treat any bump as a non-stable upgrade (e.g., strace, coreutils).

Recipes such as kmod and systemd have versions consisting of less than three parts. So they'll need to set UPSTREAM_STABLE_RELEASE_REGEX in meta data.

---
 meta/lib/oe/recipeutils.py | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
meta/lib/oe/recipeutils.py +21 -6
index c6604f536d..3fc427fa5e 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,19 @@ 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:
+                    # Recipe not setting UPSTREAM_STABLE_RELEASE_REGEX, give it some reasonable default.
+                    if len(ru['current_version'].split('.')) >= 3:
+                        stable_release_regex = '%s\.\d' % '\.'.join(ru['current_version'].split('.')[:-1])
+                        pupver = ud.method.latest_versionstring(ud, rd, filter_regex=stable_release_regex)
+                    else:
+                        pupver = (ru['current_version'], None)
+            else:
+                pupver = ud.method.latest_versionstring(ud, rd)
             (upversion, revision) = pupver
 
         if upversion:
@@ -1094,8 +1106,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 +1131,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 +1147,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 +1194,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 v2 2/4 systemd: set UPSTREAM_STABLE_RELEASE_REGEX

From: Chen Qi <[email protected]>

For systemd, 259.1 -> 259.2 is a stable upgrade.

---
 meta/recipes-core/systemd/systemd.inc | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-core/systemd/systemd.inc +3 -0
index f107c4c5da..292520e6ae 100644
@@ -26,3 +26,6 @@ CVE_STATUS[CVE-2026-40223] = "fixed-version: fixed in 259.2"
 CVE_STATUS[CVE-2026-40224] = "fixed-version: fixed in 259.3"
 CVE_STATUS[CVE-2026-40225] = "fixed-version: fixed in 259.5"
 CVE_STATUS[CVE-2026-40226] = "fixed-version: fixed in 259.4"
+
+MAJMIN_VERSION = "${@d.getVar('PV').split('.')[0]}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION}\.\d"
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 3/4 kmod: set UPSTREAM_STABLE_RELEASE_REGEX

In reply to [email protected]

From: Chen Qi <[email protected]>

For kmod, 34 -> 34.1 is a stable upgrade.

---
 meta/recipes-kernel/kmod/kmod_34.2.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-kernel/kmod/kmod_34.2.bb +3 -0
index e5923a64cf..b055b9409f 100644
@@ -20,6 +20,9 @@ SRC_URI = "https://www.kernel.org/pub/linux/utils/kernel/${BPN}/${BP}.tar.xz \
            "
 SRC_URI[sha256sum] = "5a5d5073070cc7e0c7a7a3c6ec2a0e1780850c8b47b3e3892226b93ffcb9cb54"
 
+MAJMIN_VERSION = "${@d.getVar('PV').split('.')[0]}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_VERSION}\.\d"
+
 EXTRA_OEMESON += "\
     -Ddistconfdir=${nonarch_base_libdir} \
     --bindir=${base_bindir} \
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 4/4 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..38c3ef0214 100644
@@ -27,6 +27,9 @@ SRC_URI = "https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.ta
            "
 SRC_URI[sha256sum] = "56682a36bb92dcf4b4f016fd8ec8e74059b79a8de25c15d670d731e7d18e45f4"
 
+MAJMIN_VERSION = "${@d.getVar('PV').split('p')[0].replace('.', '\.')}"
+UPSTREAM_STABLE_RELEASE_REGEX = "${MAJMIN_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
#4 lore raw
In reply to [email protected]
Quoted 4 lines · On Thu, 7 May 2026 at 08:20, <[email protected]> wrote:

If it's not set, we give
it a reasonable default value, which means if a version consists of at least three parts, the bump in last one is considered as a stable upgrade.

I strongly disagree and think we should be a lot more careful. This default will result in a lot of point version updates where the LTS maintainer would have to go and check whether the updates include new features or not. Yoann already had to reject a bunch of such updates, produced in a similar way with custom AUH tweaks.

Rather this should be enabled on a case by case basis for components that are known to do stable maintenance (a good indicator is presence of stable branches with a major.minor version in branch name somewhere), by setting UPSTREAM_STABLE_RELEASE_REGEX for them (perhaps via class inherit to avoid repetition).

No explicitly set UPSTREAM_STABLE_RELEASE_REGEX means no stable updates exist, or the situation hasn't yet been checked.

Alex

author
#5 lore raw

Got it. I see your rational and I now understand why you proposed a bbclass. I'll use this bbclass method and send out V3.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Thursday, May 7, 2026 7:33 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; MacLeod, Randy <[email protected]>
Subject: Re: [OE-core][PATCH V2 1/4] recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status

Quoted 4 lines · On Thu, 7 May 2026 at 08:20, <[email protected]> wrote:

If it's not set, we give
it a reasonable default value, which means if a version consists of at least three parts, the bump in last one is considered as a stable upgrade.

I strongly disagree and think we should be a lot more careful. This default will result in a lot of point version updates where the LTS maintainer would have to go and check whether the updates include new features or not. Yoann already had to reject a bunch of such updates, produced in a similar way with custom AUH tweaks.

Rather this should be enabled on a case by case basis for components that are known to do stable maintenance (a good indicator is presence of stable branches with a major.minor version in branch name somewhere), by setting UPSTREAM_STABLE_RELEASE_REGEX for them (perhaps via class inherit to avoid repetition).

No explicitly set UPSTREAM_STABLE_RELEASE_REGEX means no stable updates exist, or the situation hasn't yet been checked.

Alex