From Fedora Project Wiki

Revision as of 21:16, 21 February 2009 by Laubersm (talk | contribs) (PackagingDrafts/ExtraDistTagConditionalMacros moved to Archive:PackagingDrafts/ExtraDistTagConditionalMacros: (no revisions since import from MoinMoin May 2008) Appears to already be applied to Packaging:DistTag#Conditionals)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Purpose: There are some additional macros for DistTag that make it much easier to conditionalize inside of spec files.

Specifically, I propose that the following helper macros be added and the DistTag documentation updated accordingly:

%{?fedora: %{expand: %%define fc%{fedora} 1}}
%{?rhel: %{expand: %%define el%{rhel} 1}}

This means that if %{fedora} is set to 7, the following macro is set:

%define fc7 1

This permits easier conditionalization in spec files. For example, with these defines, you can do:

%{?el5: a}
%{?el4: b}
%{?el3: c}
%{?el2: d}

Without these macros, you have to resort to:

%if "%rhel" == "5"

%if "%rhel" == "4"

%if "%rhel" == "3"

%if "%rhel" == "2"