[Fedora-packaging] %{macro} vs. %macro in spec files

Mamoru TASAKA mtasaka at fedoraproject.org
Wed Apr 24 22:33:20 UTC 2013


Michael Schwendt wrote, at 04/25/2013 04:16 AM +9:00:
> On Fri, 19 Apr 2013 12:53:06 +0400, Alexey I. Froloff wrote:
>
>> OTOH, %configure is also a
>> macro, but it is widely used without curly brackets.
>
> Bad comparison, because %configure is always separated with spaces
> from the rest. The brackets don't add any value there. Even if you
> "%define config blubb", or something to that effect, that won't cause
> %configure to be expanded incorrectly.
>

Note that (as far as I am correct) there is a case where
wrapping with brackets causes wrong (unexpected) behavior when macro takes
arguments:
http://lists.fedoraproject.org/pipermail/packaging/2011-August/007898.html

For example with rubygem-devel installed and on F-19, i686:

$ rpm --eval "%gem_install -n foobar.gem"

mkdir -p ./usr/share/gems

CONFIGURE_ARGS="--with-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' $CONFIGURE_ARGS" \
gem install \
         -V \
         --local \
         --install-dir ./usr/share/gems \
         --bindir ./usr/bin \
         --force \
         --document=ri,rdoc \
         foobar.gem

v.s.
$ rpm --eval "%{gem_install} -n foobar.gem"

mkdir -p ./usr/share/gems

CONFIGURE_ARGS="--with-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' $CONFIGURE_ARGS" \
gem install \
         -V \
         --local \
         --install-dir ./usr/share/gems \
         --bindir ./usr/bin \
         --force \
         --document=ri,rdoc \
         %{gem_name}-%{version}.gem
  -n foobar.gem

Regards,
Mamoru




More information about the packaging mailing list