Bug 6961 - FR: macros with parameter
: FR: macros with parameter
Status: NEW
: Sisyphus
(All bugs in Sisyphus/rpm-build)
: unstable
: all Linux
: P3 enhancement
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2005-05-29 13:49 by
Modified: 2016-08-14 18:28 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-05-29 13:49:03
I want to propose next improve for macroses like
%def_with, %def_enable, etc to using parameters

%define def_with_param() %{expand:%%{!?_with_%{1}: %%{!?_without_%{1}: %%{?2:
%%global _with_param_%{1} %{2}} %%global _with_%{1} --with-%{1}}}}

%define subst_with_param()
%{expand:%%{?_with_%{1}:%%{_with_%{1}}%%{?_with_param_%{1}:=%%{_with_param_%{1}}}}}
%{expand:%%{?_without_%{1}:%%{_without_%{1}}%%{?_without_param_%{1}:=%%{_without_param_%{1}}}}}

%define if_with_param() %if %{expand:%%{?_with_%{1}: %%{?2:%%(if [
"%%{_with_param_%{1}}" == "%{2}" ]; then echo 1; else echo 0;
fi)}%%{!?2:1}}%%{!?_with_%{1}:0}}

Steps to Reproduce:
1.
%def_with debug yes

2.
%if_with debug yes 
%endif

3.
%configure %{subst_with debug}

Actual Results:  
rpm -bE tes.spec:
.........
  ./configure --build=pentium4-alt-linux --host=pentium4-alt-linux \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib \
        --libexecdir=/usr/lib \
        --localstatedir=/var/lib \
        --sharedstatedir=/usr/com \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --without-included-gettext --with-debug
.........

Expected Results:  
rpm -bE tes.spec:
.........
  ./configure --build=pentium4-alt-linux --host=pentium4-alt-linux \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib \
        --libexecdir=/usr/lib \
        --localstatedir=/var/lib \
        --sharedstatedir=/usr/com \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --without-included-gettext --with-debug=yes
.........
------- Comment #1 From 2005-06-16 22:03:43 -------
*** Bug 6963 has been marked as a duplicate of this bug. ***
------- Comment #2 From 2008-06-13 13:00:39 -------
*** This bug has been confirmed by popular vote. ***