Description

rpm-depcheck is a tool for checking the RPM dependencies of a specific command or application. In other words, it shows you what installed RPM packages are used when running the command given to it.

It functions by running the specified command under strace (see man strace for details), after which it determines the packages used during the process, and outputs them to stderr.

By default it resolves inter-package dependencies and excludes packages that are considered to be part of the base system in order to present a minimal set of dependencies; this is typically a good indication of what should be included in the "BuildRequires" tag of a RPM spec file. Note that it isn't perfect as yet, as it tends to give some false positives... this is being worked on. :-)

Example

Let's say we want to know what RPMs are used by the "xfig" program. By running xfig through rpm-depcheck, we get:

$ rpm-depcheck xfig
====== PROGRAM TERMINATED ======
Gathering file dependencies...
Calculating RPM dependencies....
[##################################################] 30/30 (/usr/share/xfig/CompKeyDB)
Excluding base system packages...
Pruning RPM dependencies...
[##################################################] 17/17 (libXfixes                )

RPMs Required:
==============
xfig
libXcursor

Purpose

Looking at what packages an installed program is using on an RPM-based system is pretty pointless, as the RPM package manager itself already tracks all that information using dependencies. However, when running a program that has not been installed from an RPM, rpm-depcheck becomes useful.

For instance, let's say we are running a game called "chickens", compiled and installed from a tarball into /usr/local/bin:

$ rpm -qf /usr/local/bin/chickens
file /usr/local/bin/chickens is not owned by any package

$ rpm-depcheck /usr/local/bin/chickens
====== PROGRAM TERMINATED ======
Gathering file dependencies...
Calculating RPM dependencies....
[##################################################] 55/55 (/etc/alsa/pcm/modem.conf )
Excluding base system packages...
Pruning RPM dependencies...
[##################################################] 15/15 (arts                     )

RPMs Required:
==============
allegro

So from the above output we can see that the installed "allegro" RPM package is used by this game. We now what the game's RPM run-time dependencies are.
In a similar way, we can find out what the game's compile-time dependencies (or build requirements) are, by running the compile procedure through rpm-depcheck:

$ rpm-depcheck make
g++ main.cpp -o chickens animation.o chicken.o gem.o gore.o helper.o highscore.o level.o settings.o smoke.o -L/usr/lib -Wl,--export-dynamic -lalleg-4.2.0 -lalleg_unsharable
====== PROGRAM TERMINATED ======
Gathering file dependencies...
Calculating RPM dependencies....
[##################################################] 263/263 (/usr/lib/libXdmcp.so.6   )
Excluding base system packages...
Pruning RPM dependencies...
[##################################################] 11/11 (libXdmcp                 )

RPMs Required:
==============
allegro-devel

In other words, we need the "allegro-devel" package in order to build this game. If we wanted to to create an RPM package of the "chickens" game, we would need to add "allegro-devel" to the RPM spec file's BuildRequires tag.

Contribute!

or: rpm-depcheck needs you!

By default, rpm-depcheck is configured for the Fedora RPM environment (in terms of the base system packages, etc), but it should run just fine on other RPM-based distributions - please feel free to create and send me configurations for other distros, and I will include them.

rpm-depcheck is very much a work-in-progress. The biggest problem at this stage is the removal of false positives. Also, it could be faster... If you feel the sudden urge to contribute, please, go ahead, it will be highly appreciated.

Origin

rpm-depcheck is partly inspired by the idea behind dpkg-depcheck, a similar script for the dpkg package management system, written by Bill Allombert. The name at least is shamelessly *cough* borrowed from that program... Thanks. :-)
However, the implementation and usage are very different; this is not intended to be a drop-in RPM-based alternative to that script. Rather, it focuses on being as easy-to-use as possible, and to complement the RPM build system (specifically the "rpmbuild" command).

SourceForge.net Logo