How to allow dnf swap between alternate RPMs

I’d like to setup a pair of RPMs that can to swapped between using the dnf swap mechanism.

Looking at the pipewire and pulseaudio spec files for clues I found out that they do this:

Provides: pulseaudio-deamon
Conflicts: pulseaudio-daemon

That makes sense in that either package will satisfy a requirement for pulseaudio-daemon.

I assume I must do something to make one of the pair the default.
What I have not figure out is how is the pipewire RPM is preferered over the pulseaudio RPM to provide the pulseaudio-daemon.
How is that done?

There are two unrelated concepts here.

dnf swap

You don’t need to set anything up, you can swap between arbitrary packages.

The dnf command swap x y just means remove x AND install y.

For example you can swap the nano text editor with the 0ad strategy game:

dnf swap nano 0ad

I use this often when testing different versions/variations of packages.

dnf swap foo ./foo-with-bar-1.2.3.rpm


The Provides: in spec files defines capabilities (sometimes called virtual packages). It’s for dependency solving. If a package foo provides bar, you can do dnf install bar, or Requires: bar in another package and get foo.

Solving is done by the solver (libsolv or whatever used by other package manager) at install time. There is no preference/priority in the spec file (it would be pointless since another package can just set themselves higher).

Even if there was some kind of preference/priority, it’s irrelevant in this case since Fedora (Workstation, and some spins) installs pipewire-pulseaudio explicitly by name (in multimedia group), not by pulseaudio-daemon.

1 Like

The bit I am unclear on is why I can remove pipewire when its Required: by workstation.
I get why a package that has a Requires: pulseaudio-daemon works, but packages provide that virtual package.

Why does the system not get upset that, for example pipewire, has been removed as workstation has a Requires: pipewire?

If I get away with it on the dnf swap when a future dnf update of werkstation happens
doesn’t the new workstartion RPM need pipewire to satisfy its Requires: pipewire?

Please clarify what you mean by “workstation” in this context. workstation is not the name of a package. What do you think has a Requires: pipewire?

How can an RPM require pipewire-pulseaudio as a dep and also allow dnf swap to remove pipewire that provides that dep?

Is it that installing a group is the trick? There is no RPM with a requires on pipewire only a group that lists the RPM?

Again, which package requires pipewire-pulseaudio? It will be easier to talk with specific examples, so I can reproduce exactly what you’re doing, and answer why it works or doesn’t work.

You also seem to treat pipewire-pulseaudio and pipewire as equivalent. They are not; you can install either one without the other.

Packages installed by groups indeed can be removed (unless other packages require them). i.e. you can dnf group install foo and then dnf remove every member of @foo

There are only a few packages in Fedora that require pipewire by name, one of them being mutter. So if you use mutter (everyone who uses GNOME), you can’t remove pipewire (but you can remove pipewire-pulseaudio).

Sorry I was jumping between the SRPMs and their spec files and the RPMs.