<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>6963</bug_id>
          
          <creation_ts>2005-05-29 20:18:39 +0400</creation_ts>
          <short_desc>FR: macros with parameter</short_desc>
          <delta_ts>2005-10-16 16:12:09 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>6961</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Evgeny Sinelnikov">sin</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25037</commentid>
    <comment_count>0</comment_count>
    <who name="Evgeny Sinelnikov">sin</who>
    <bug_when>2005-05-29 20:18:39 +0400</bug_when>
    <thetext>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 [
&quot;%%{_with_param_%{1}}&quot; == &quot;%{2}&quot; ]; 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
.........</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25927</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2005-06-16 22:03:42 +0400</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 6961 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>