V Mon, Dec 25, 2023 at 05:52:12PM +0100, Reto Gantenbein napsal(a):
Merry Christmas everyone
I have an application that can either work with legacy iptables (`iptables-legacy` and `ebtables-legacy`) or `nftables`. So I'm trying to specify this as a dependency in a spec file. If a user has not installed any of it (or `iptables-nft`) then `nftables` should be preferred.
I thought this would be easy with a RPM boolean dependency [1]:
Requires: (ebtables-legacy if iptables-legacy else nftables)
When installing the RPM with this expression and no `iptables-legacy` nor `nftables` already installed then `dnf` will want to install `ebtables-legacy` and `iptables-legacy`.
Only when I include `nftables` in the `dnf install` command it will ignore the legacy package dependencies.
Is there a way to express that I want `nftables` by default except a user has already `iptables-legacy` installed?
It is. Add:
Suggests: nftables
Suggests remains unaffected when weak dependencies are disabled with an install_weak_deps=false option.
DNF uses Suggests as a hint to prefer a solution with the suggested package among multiple possible solutions.
Don't ask me why DNF without the hint prefers (ebtables-legacy and iptables-legacy) if nftables is not installed. What heuristic DNF/libsolv uses is a mystery for me.
-- Petr