recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status
PATCH v4 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
@@ -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
PATCH v4 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
@@ -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 '\.'.join(stable_parts) + +STABLE_VERSION_REGEX = "${@get_majmin_version_regex(d)}" +UPSTREAM_STABLE_RELEASE_REGEX = "${STABLE_VERSION_REGEX}\..+"
Signature · 1 line
2.34.1
Re: [OE-core][PATCH V4 2/7] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade
meta/classes-recipe/upstream-stable-release-point.bbclass line 21
Quoted 2 lines · On Tue, 12 May 2026 at 05:26, <[email protected]> wrote:
meta/classes-recipe/upstream-stable-release-point.bbclass new file +2
-0+STABLE_VERSION_REGEX = "${@get_majmin_version_regex(d)}" +UPSTREAM_STABLE_RELEASE_REGEX = "${STABLE_VERSION_REGEX}\..+"
I think we can make this even more universal:
UPSTREAM_STABLE_RELEASE_REGEX ?= "${STABLE_VERSION_REGEX}.*"
E.g.
- use ?= so the variable can be overridden with a custom recipe-specific expression (that still has STABLE_VERSION_REGEX in it)
- do not require that . separates the stable series and stable release part (this will allow openssh to inherit the class)
- do not require that the stable release suffix is non-empty (this will cover e.g. systemd when there are no stable maintenance releases yet, e.g. if PV is at 261 but 261.1 is not yet out, then 261 will be reported as latest stable release, which is more accurate than 'no stable release was found')
Other than that, looks good.
Alex
Re: [OE-core][PATCH V4 2/7] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade
Quoted 10 lines · Alexander Kanavin
meta/classes-recipe/upstream-stable-release-point.bbclass line 21
Quoted 2 lines · On Tue, 12 May 2026 at 05:26, <[email protected]> wrote:
meta/classes-recipe/upstream-stable-release-point.bbclass new file +2
-0+STABLE_VERSION_REGEX = "${@get_majmin_version_regex(d)}" +UPSTREAM_STABLE_RELEASE_REGEX = "${STABLE_VERSION_REGEX}\..+"I think we can make this even more universal:
UPSTREAM_STABLE_RELEASE_REGEX?= "${STABLE_VERSION_REGEX}.*"E.g.
- use ?= so the variable can be overridden with a custom recipe-specific expression (that still hasSTABLE_VERSION_REGEXin it)
OK
Quoted 2 lines
- do not require that . separates the stable series and stable release part (this will allow openssh to inherit the class)
If we do not use '.' to separate stable parts and the other parts, recipe with version such as 1.2.3 will also match 1.21.
The name of this bbclass is about 'point' ('.'), but openssh separates its stable part with 'p', so maybe it should not inherit this bbclass?
Quoted 5 lines
- do not require that the stable release suffix is non-empty (this will cover e.g. systemd when there are no stable maintenance releases yet, e.g. if PV is at 261 but 261.1 is not yet out, then 261 will be reported as latest stable release, which is more accurate than 'no stable release was found')
How about:
UPSTREAM_STABLE_RELEASE_REGEX ?= "^${STABLE_VERSION_REGEX}(\.[^.]+)*$"
This will match 261 as well as 261.1 but not some other unexpected versions.
The regex starts to get a little complicated though.
What do you think?
Regards,
Qi
Quoted 4 lines
Other than that, looks good.
Alex
Re: [OE-core][PATCH V4 2/7] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade
Quoted 5 lines · ChenQi
Quoted 2 lines
- do not require that . separates the stable series and stable release part (this will allow openssh to inherit the class)
If we do not use '.' to separate stable parts and the other parts, recipe with version such as 1.2.3 will also match 1.21.
Yes :) I really had missed that problem.
Quoted 9 lines
How about:
UPSTREAM_STABLE_RELEASE_REGEX?= "^${STABLE_VERSION_REGEX}(\.[^.]+)*$"This will match 261 as well as 261.1 but not some other unexpected versions.
The regex starts to get a little complicated though.
What do you think?
Maybe this:
UPSTREAM_STABLE_RELEASE_REGEX ?= "^${STABLE_VERSION_REGEX}(\.\d+)*$"
I.e. the suffix is zero or more ".number" components, and they must be at the end of the version. This would match 261, and 261.12, and 261.1.2.3 but not 262 or 261alpha3.
Then openssh can inherit the class and set:
UPSTREAM_STABLE_RELEASE_REGEX = "^${STABLE_VERSION_REGEX}(p\d+)*$"
e.g replace . with p, as a separator.
Note: you can test various regexes, what they match and what they don't here: https://regex101.com/
Alex
PATCH v4 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-84So 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
@@ -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
PATCH v4 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
@@ -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
PATCH v4 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
@@ -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
PATCH v4 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
@@ -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
PATCH v4 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
@@ -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('.', '\.')}" +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