Draft: debian/lib/python/debian_linux/debian.py: allow more liberal revision suffixes than just \+b\d+
This is a draft MR intentionally not intended for merging but showing something that works for me to start a discussion on how to implement this properly.
In our Debian downstream derivative for the MNT Reform we add patches to the Debian linux packaging required for the CPU modules that are compatible with the MNT Reform, MNT Pocket Reform and MNT Reform Next. To this end we append our own version suffix to the Debian linux package version to further differentiate our kernel from the kernel in the Debian repositories.
This causes problems when patching the Debian linux kernel for backports. The first problem that appears is that a RuntimeError is raised by process_changelog in debian/bin/gencontrol.py because our distribution name ends in -backports but our kernel version does not look like a backports kernel version (version.linux_revision_backports is False. My first idea was to just drop this check but this only solves one half of the problem. While the build succeeds, the resulting package will miss the +bpo suffix in its abiname. This suffix is not added, because (again) version.linux_revision_backports is False.
So instead, I am now patching the _revision_re in debian/lib/python/debian_linux/debian.py to be more liberal with the allowed version suffixes. See the diff of this MR.
While this works, it is probably not something that you'd want to apply to the Debian linux packaging as the current regex serves as a safety mechanism against uploading kernels with an incorrect version to the archive. But would it make be possible to make it easier for downstream consumers of the Debian linux packaging such that they can take advantage of the facilities it provides to, for example, add the +bpo suffix to the abiname without having to patch it?
Maybe a setting in debian/config.local/defines.toml or a new environment variable can be used to allow custom version suffixes by relaxing the _revision_re regex a bit?
How would you like to see this solved? I'd like to provide the code if you can tell me how your preferred solution to this looks like.
Thanks!