osbuild / images

Image builder image definition library
Apache License 2.0
23 stars 52 forks source link

distro: add SortNames helper #1000

Closed mvo5 closed 1 week ago

mvo5 commented 3 weeks ago

This commit adds a new distro.SortNames() helper that can be used sort sort distro names. It will take version numbers of the distro into account and sort by semantic version. This is useful in e.g. user-interfaces where we want to present the version in a nicely sorted way.

supakeen commented 3 weeks ago

Will we be having any versions containing beta, or rc tags or such?

mvo5 commented 2 weeks ago

Will we be having any versions containing beta, or rc tags or such?

That is a good question - so far this is meant for the list we have in our images distros:

centos-9
centos-10
fedora-39
fedora-40
fedora-41
rhel-7.9
rhel-8.4
rhel-8.5
rhel-8.6
rhel-8.7
rhel-8.8
rhel-8.9
rhel-8.10
rhel-9.0
rhel-9.1
rhel-9.2
rhel-9.3
rhel-9.4
rhel-9.5
rhel-9.6
rhel-10.0

here we do not use beta/rc etc. The underlying library (go-version) supports anything that follows https://semver.org/ the splitting becomes a bit more tricky then, we will need to be able to split centos-stream-9.1.2-beta correctly, I updated the code to support this splitting better.

thozza commented 2 weeks ago

Will we be having any versions containing beta, or rc tags or such?

We used to support beta for RHEL, but then removed the support. I'm not saying that it won't ever happen, but the main use case for it will be IMHO in the SaaS version (Koji or CRC).

For the on-prem, we default to building the host's distro if not specified and the detection if the host distro is beta or RC was a bit of a mess to get right. Nevertheless, if someone has repositories defined for RC / Beta locally and wants to explicitly build that version of a distro, it may make sense to support this use case (it should be already possible with distro name aliases).

mvo5 commented 1 week ago

Closing in favor of https://github.com/osbuild/images/pull/1012