RPM SPEC files know about package versions in both Requires:
and Provides:
tags, so inside a SPEC file it's easy to build proper dependency even with mangled names (e.g. to avoid conflicts and allow multiple versions of packages)
As an example package foo provides updated version:
Name: foox
Provides: foo = 2
and
Name: bar5
Requires: foo >= 2
works quite well - yum will not install bar5 unless foox is also installed.
My question - how can I query which package provides foo = 2
from command line?
From the man page of rpm it appears that
--whatprovides CAPABILITY
Query all packages that provide the CAPABILITY capability.
--provides
List capabilities this package provides.
Would've sufficed.
I can rpm -q --provides <package name>
and see the version.
I can even rpm -q --qf %{VERSION} <package name>
and get only the version.
However, I can't rpm -q --whatprovides
on the name and version to get the actual package name.
I have also tried rpm -q --provides foo
but I only get the original foo = 1, even though foox is installed and provides foo = 2.
what I would like is the following magic:
$ rpm -q --whatprovides "foo = 2"
$ foox