2011-12-10 by sourpoi in misc, tagged: rpm yum

What packages does an RPM package depend on?

The short answer: use repoquery (part of the yum-utils package):

repoquery --tree-whatrequires <package>

The long answer (use in the absence of a tool that gives you a short answer): note the relationship between packages and capabilities:

rpm -q --provides <package>         # capabilities the package provides
rpm -q --requires <package>         # capabilities the package requires

rpm -q --whatprovides <capability>  # packages providing capability
rpm -q --whatrequires <capability>  # packages requiring capability

Finding out what packages depend on a given package is not straightforward; you must determine capability dependencies and then find out which package(s) provide those capabilities. It would be nice to be able to ask "which packages does this package depend on" but that query is not supported by the rpm command.

For example:

> rpm -q --requires hfsplus-tools
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libcrypto.so.10()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libpthread.so.0(GLIBC_2.3.2)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

> rpm -q --whatprovides libcrypto.so.10
openssl-1.0.0k-1.fc17.i686
> rpm -q --whatprovides 'libpthread.so.0()(64bit)'
glibc-2.15-58.fc17.x86_64

However:

> rpm -q --whatprovides rpmlib
no package provides rpmlib
> rpm -q --whatprovides 'rpmlib(FileDigests)'
no package provides rpmlib(FileDigests)
> rpm -q rpmlib
package rpmlib is not installed

We cannot, in all cases, query a capability's provider using --whatprovides. In this case, rpmlib() is a tracking dependency - a feature of the underlying rpmlib, but not a capability of the rpm package which implements it. In practice, if a package requires a missing rpmlib() feature, upgrade the rpm package.

Use rpm --showrc to view the rpmlib features:

# rpm --showrc | grep rpmlib
Features supported by rpmlib:
rpmlib(BuiltinLuaScripts) = 4.2.2-1
rpmlib(CompressedFileNames) = 3.0.4-1
rpmlib(ConcurrentAccess) = 4.1-1
rpmlib(ExplicitPackageProvide) = 4.0-1
rpmlib(FileCaps) = 4.6.1-1
rpmlib(FileDigests) = 4.6.0-1
rpmlib(HeaderLoadSortsTags) = 4.0.1-1
rpmlib(PartialHardlinkSets) = 4.0.4-1
rpmlib(PayloadFilesHavePrefix) = 4.0-1
rpmlib(PayloadIsBzip2) = 3.0.5-1
rpmlib(PayloadIsLzma) = 4.4.2-1
rpmlib(PayloadIsXz) = 5.2-1
rpmlib(ScriptletExpansion) = 4.9.0-1
rpmlib(ScriptletInterpreterArgs) = 4.0.3-1
rpmlib(VersionedDependencies) = 3.0.3-1

See https://www.redhat.com/archives/rpm-list/2002-February/msg00313.html for some context on tracking dependencies.

Comments