-
Notifications
You must be signed in to change notification settings - Fork 390
depexts: Find the optimal scheme for conf-* packages for maxium coverage and non-overlaping #4440
Description
Current state of things in opam-repository
Currently depexts in opam-repository (mostly inside conf-* packages) typically look like this:
depexts: [
["libzstd-dev"] {os-family = "debian"}
["libzstd-devel"] {os-distribution = "centos"}
["libzstd-devel"] {os-distribution = "rhel"}
["libzstd-devel"] {os-distribution = "fedora"}
["libzstd-devel"] {os-family = "suse"}
["zstd-dev"] {os-distribution = "alpine"}
["zstd"] {os-distribution = "homebrew" & os = "macos"}
["zstd"] {os = "freebsd"}
]
This is problematic if we want to support more than just some specific distributions but also their "derived distributions" (e.g. Manjaro for Archlinux, PopOS for Ubuntu, …)
I've tried using os-family instead of os-distribution for all of them, as it is what is used in opam internally anyway to detect and launch the commands but for selecting package some issues arise from that approach, mainly:
- Some of the main distributions are derived from each others. For instance debian and ubuntu
["libmysqlclient-dev"] {os-distribution = "ubuntu"}
["default-libmysqlclient-dev"] {os-distribution = "debian"}
In this example requested packages have a different name. However if we were to use os-family here it would result in the right behaviour on ubuntu-derived distribution, but not on the main ubuntu as the os-family variable would pick up debian.
The same thing happens with centos being derived from rhel but the set of packages can vary wildly (especially given the sub-repositories structure – e.g. EPEL, PowerTools, … – in CentOS)
2) To complicate things even further, some distributions might have different names. From https://github.com/ocaml/opam/blob/3ee922d3e621bd0ee7427f33196bd977009131ef/src/state/opamSysInteract.ml for instance, Archlinux can be called arch or archlinux, Oraclelinux can be called ol or oraclelinux, OpenSUSE can be called suse or opensuse (I remember the change of the last one in OpenSUSE 15.x or whatever, for sure)
These things can be encoded using disjunction such as:
["libmysqlclient-dev"] {os-distribution = "ubuntu" | os-family = "ubuntu"}
["default-libmysqlclient-dev"] {os-distribution != "ubuntu" & os-family = "debian"}
["libzstd-devel"] {os-family = "suse" | os-family = "opensuse"}
However this is getting quite hard to read and maintain with all this.
Does anyone have any idea how to get the clean and easy scheme we already now have but make it work for derived distributions and be maintainable? Maybe by adding a new variable unique to a distribution and its derivatives? Thoughts?
cc @rjbou