Archive:PackagingDrafts/ExtraDistTagConditionalMacros

From FedoraProject

Jump to: navigation, search

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"
a
%endif

%if "%rhel" == "4"
b
%endif

%if "%rhel" == "3"
c
%endif

%if "%rhel" == "2"
d
%endif