Bug 6963 - FR: macros with parameter
Summary: FR: macros with parameter
Status: CLOSED DUPLICATE of bug 6961
Alias: None
Product: Sisyphus
Classification: Development
Component: rpm-build (show other bugs)
Version: unstable
Hardware: all Linux
: P3 enhancement
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-29 20:18 MSD by Evgeny Sinelnikov
Modified: 2005-10-16 16:12 MSD (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Sinelnikov 2005-05-29 20:18:39 MSD
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 Dmitry V. Levin 2005-06-16 22:03:42 MSD

*** This bug has been marked as a duplicate of 6961 ***