RFE: Support `distro.like.match()`
Some packaging might use things like this:
{% if distro.match("rhel >= 8") %}
...
{% endif %}
This works nicely but breaks down if someone tries to build the package on e.g. CentOS/Alma/... Ordinarily, aliases would be the solution, but that suffers from several drawbacks:
- requires the packager to define and maintain a list of all derivatives
- version inequalities are not supported (an apkg distro alias does not carry a version)
distro
module already parses /etc/os-release
when available and makes things like like
available.
I propose that a new option be added that could work this way:
{% if distro.like.match("rhel >= 8") %}
...
{% elif distro.like.match("debian") %}
...
{% endif %}
This allows the packager to cover the above when it's desired. Yes, they can shoot themselves in the foot if they do distro.like.match("debian > 7")
but that's up to them.
I have a local patch that does exactly that if you are interested.