RPM weak dependencies are now fully supported in Fedora. They are even part of the packaging guidelines. There are two kinds of weak dependencies both having forward and backward forms (respectively):
- weak - Recommends:, Supplements: and
- hint - Suggests:, Enhances:
The rule is to use the forward dependencies if possible with the backward ones being useful mainly for 3rd-party packages and addons/plugins for other packages (e.g. proprietary codecs,...).
Both kinds of weak dependencies mean that the package using them has to work and
be useful even without its weak dependencies being installed. The difference
between Recommends: and Suggests: is that the former ones are installed by
default by DNF if possible, the latter ones are ignored (but may be shown by
GNOME Software or some other tool, of course). "if possible" in the previous
sentence means among the other things that they are not explicitly
--exclude
-d. Also, when creating minimal images, a different DNF
configuration is used to not install weak dependencies at all. Last but not
least, Suggests: can be used to prefer a particular package over some other
with the same Provides: -- for example Requires: mysql
and Suggests:
mariadb
should result in mariadb
being installed instead of
community-mysql
unless user explicitly ``--exlude``s it.
Let's start with libblockdev. The Recommends: is clearly a good option for
the main libblockdev
package which only contains the library with no
plugins. It's not particularly useful, but it can be used as it is (for example
the various utility functions). There's also the libblockdev-plugins-all
which Requires: all the plugins in one of their implementation (so right now
lvm
over lvm-dbus
). We should probably keep that for backwards
compatibility, but if we add the plugins as Recommends: to the libblockdev
package, it shouldn't be needed.
Plus we could also use the weak dependencies for the libblockdev-lvm-dbus
package. We could use Suggests:, but even here Recommends: probably makes
more sense. After all, we want users to use lvm-dbus
if possible. Being
weak, the dependency would be ignored if for example lvm2-dbus
is not
available, but if everything's okay, it would be installed (and then used) by
default.
With blivet the situation is a bit more complicated, AFAICT. Having everything
properly implemented and tested, many things should be Recommends: too -- all
file system tools, lvm2
, mdadm
, btrfs-progs
, udisks-iscsi
,... As
blivet should work fine unless something missing is explictly being used by
the user code. But is it really like that? Do we have any tests for this? Do the
tasks really support this?
Starting with version 4.13 RPM supports processing boolean expressions in dependencies [1]. So for example:
Recommends: libblockdev-lvm if lvm2 Recommends: libblockdev-lvm-dbus if lvm2-dbusd
and so on. As can be seen these would be perfect for libblockdev. However, this is only supported for Suggests:, Supplements: and Enhances: weak dependencies in Fedora [2] now and what we need is Recommends:. So this is a no-go for us right now.
[1] | http://rpm.org/user_doc/boolean_dependencies.html |
[2] | https://fedoraproject.org/wiki/Packaging:Guidelines#Rich.2FBoolean_dependencies |
Added a section about boolean dependencies.