Tuesday, December 28, 2010

Tweaking the find-provides and find-requires when building RPMs

Suppose for a second you want to not list all the dependencies for an RPM, they might be contained within your package and might disrupt the rest of the system. To solve that issue and to also keep some automation for the Provides and Requires tags in rpm one would tune them a bit.

Per default, these days at least, this is handled by two scripts
  • /usr/lib/rpm/find-requires
  • /usr/lib/rpm/find-provides
The easiest way to tune these would be to copy them and edit or in the end completely replace so it suits your needs. To reference them in your spec file, these definitions need to exist:

%define __find_provides [find-provides]
%define __find_requires [find-requires]

Where [find-provides] and [find-requires] are the relative or absolute paths to the scripts you are replacing. Doing only this would not work. This statement is also needed in the spec file:

%define _use_internal_dependency_generator 0

Once that's done everything would work as expected. To make sure this is still the case when reading this, just make sure those are the macro/script combination called upon to check for dependencies:

grep __find /usr/lib/rpm/macros
#%__find_provides %{_rpmconfigdir}/rpmdeps --provides
#%__find_requires %{_rpmconfigdir}/rpmdeps --requires
%__find_provides %{_rpmconfigdir}/find-provides
%__find_requires %{_rpmconfigdir}/find-requires
#%__find_conflicts ???
#%__find_obsoletes ???

This wouldn't affect the redefinition though.