[Fedora-packaging] Checking distro release from spec file

Rex Dieter rdieter at math.unl.edu
Tue Mar 17 00:51:27 UTC 2009


Ray Van Dolson wrote:
> I'm trying to write a "distro agnostic" spec file that will apply two
> patches:
> 
>   - Patch 1 if and only if we're building for EL5 or EL4
>   - Patch 2 if and only if we're building for EL4
> 
> I know I can check for EL with the presence of the %{fedora} macro,

%{fedora} macro is the *fedora* release, for EL, the corresponding macro 
is %{rhel}.

In your case. you could use something like:

%if 0%{?rhel} >= 4
%patch1 ...
%endif

%if 0%{?rhel} >= 5
%patch2 ...
%endif




More information about the Fedora-packaging mailing list