Filtering requires/provides

Paul Howarth paul at city-fan.org
Wed Mar 1 17:26:47 UTC 2006


The current suggestion on the Packaging/Perl wiki page is (for Requires, 
Provides works the same) is:

----------------------------------------------------------------------
# Filter unwanted Requires:
cat << \EOF > %{name}-req
#!/bin/sh
%{__perl_requires} $* |\
   sed -e '/perl(unwanted_require)/d'
EOF

%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req
chmod +x %{__perl_requires}
----------------------------------------------------------------------

This won't work for the majority of perl modules because the build 
directory is %{_builddir}/MODULENAME-%{version} rather than 
%{_builddir}/%{name}-%{version}.

A simpler way that avoids generating script files at all might be:

%global filtered_requires sh -c '%{__perl_requires} "$@" | %{__sed} -e 
"/^perl(unwanted_require)$/d"'
%define __perl_requires %{filtered_requires}

Anyone see any problems with this?

P.S. I'm not an rpm macro expert and don't really know the significance 
of %global but using %define in its place results in a recursive macro 
definition, which doesn't work.

Paul.




More information about the Fedora-perl-devel-list mailing list