On 5/11/26 17:32, Alexander Kanavin wrote:
On Sat, 9 May 2026 at 07:30, <[email protected]> wrote:
+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.


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 ?

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.


+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


Alex


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#236798): 
https://lists.openembedded.org/g/openembedded-core/message/236798
Mute This Topic: https://lists.openembedded.org/mt/119226368/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to