diff mbox series

[V3,2/6] upstream-stable-release-point.bbclass: add bbclass for stable point upgrade

Message ID 20260509053033.1565462-2-Qi.Chen@windriver.com
State New
Headers show
Series [V3,1/6] recipeutils: add optional stable_upgrade parameter to get_recipe_upgrade_status | expand

Commit Message

Chen, Qi May 9, 2026, 5:30 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

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.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../upstream-stable-release-point.bbclass     | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/classes-recipe/upstream-stable-release-point.bbclass
diff mbox series

Patch

diff --git a/meta/classes-recipe/upstream-stable-release-point.bbclass b/meta/classes-recipe/upstream-stable-release-point.bbclass
new file mode 100644
index 0000000000..947f882152
--- /dev/null
+++ b/meta/classes-recipe/upstream-stable-release-point.bbclass
@@ -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"