Skip to content

Instantly share code, notes, and snippets.

@vpodzime
Last active April 25, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpodzime/7f01647fa5b8545d4231517678456b23 to your computer and use it in GitHub Desktop.
Save vpodzime/7f01647fa5b8545d4231517678456b23 to your computer and use it in GitHub Desktop.

Weak dependencies for blivet and libblockdev

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 --exludes it.

Potential use for libblockdev and blivet

libblockdev

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.

blivet

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?

Boolean dependencies

Starting with version 4.13 RPM supports processing boolean expressions in dependencies1. 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 Fedora2 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

@vpodzime
Copy link
Author

Added a section about boolean dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment