RPM spec in tar file (was Re: An introduction of the new cheerleader...)

Kir Kolyshkin kir at darnet.ru
Tue Jan 27 22:55:18 UTC 2004


Ian Pilcher wrote:

> Kir Kolyshkin wrote:
>
>> To some extent, this can be solved using various %ifdef constructions 
>> in spec file.
>
>
> How?  AFAIK, there is no canonical way for the SPEC file to determine
> what distribution it is building on.

If there's no canonical way or a clean solution, there is always space 
for ugly hacks...

Here's a short example for spec file working for various redhats and 
suses. Yes I know it's ugly. But you got the idea.

%if %_vendor == "redhat"
# Define redhat-specific stuff here.

# If you want more precision, you can use the below define
# %define rh_ver %(rpm -q --queryformat %{VERSION} redhat-release)

# The problem is nested %if's doesn't always work well, therefore
%define suse_version 0
%endif

# The problem is %else doesn't work in all rpm versions, so avoid using it.

# SuSE guys made a good definition for us - so let's use it
%if %suse_version = 820
# Define stuff specific for SuSE 8.2
%endif

%if %suse_version = 830
# Oh, things for SuSE 8.3 goes here
%endif





More information about the devel mailing list