opam
opam copied to clipboard
Support constraints on Linux kernel version
opam packages can declare constraints on their os, os-distribution and os-version using
available : [ os = <..> & os-distribution = <..> & os-version = <..>]
However, it isn't possible to declare constraints on the kernel version. For example, I'd like to be able to declare something like
available : [ os = "linux" & kernel-version = "6.1"]
It'll be useful to have this feature rather than manually adding the constraints of each os-distribution & os-version that correspond to the kernel-version lower bound I want.
Linking in https://github.com/ocaml/opam-repository/pull/26183 and https://github.com/ocaml/opam-repository/issues/26198 for context.
This is definitely something we should be able to do better. It's tempting simply to keep adding global variables, but I believe that we already have too many, and need to step back from this. There are two problems with global variables:
- The main issue is that they are disconnected from the repositories which consume them - i.e. as variables get added or updated (for example because the way of determining the value changes over time) to opam, repository packages then have to worry about precisely which version of opam is going to interpret them.
- They don't map very neatly into the dependency graph - cf. the
sys-ocaml-versionvariable and the matrix of largely identicalocaml-systempackages which have to be maintained to correspond to them. That's not so bad with what's wanted here, but the same kind of feature has been requested for ages for arbitrary external dependencies.
I have a fledgling idea for how this might be tacklable and it's definitely something which is high on my list for 3.0. As one of the maintainers of the compiler packages, I'd very much like to simplify the ocaml-system packages and, with my Windows hat on, I need something more powerful than depext is now to cope with providing external dependencies from multiple sources... and I'm pretty sure we'd be able to resolve the Linux kernel version properly within that 😊