On 25-12-2023 17:52, Reto Gantenbein wrote:
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?
Have you considered making it sub packages (e.g. foo-iptables and
foo-nftables)? That would make it more transparent to the user and
allows you to stuff the dependencies in the sub package and create weak
dependencies [1].
There's probably also a way of doing it in the spec with some
expression[2]. Not my strong part, but maybe you need to declare it the
other way around:
Requires: (nftables unless iptables-legacy)
Requires: (ebtables-legacy if iptables-legacy)
[1]
https://docs.fedoraproject.org/en-US/packaging-guidelines/WeakDependencies/
[2]
https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
-- Sandro
--
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue