packages: dovecot/dovecot.spec - TODO was accidentally removed (sorry), but...

Paweł Zuzelski pawelz at pld-linux.org
Sun Oct 31 02:08:45 CEST 2010


On Thu, 28 Oct 2010, caleb wrote:

> Author: caleb                        Date: Thu Oct 28 09:53:02 2010 GMT
> Module: packages                      Tag: HEAD
> ---- Log message:
> - TODO was accidentally removed (sorry), but having [percent]service in the spec even on a commented line breaks the build. Bug in builder?

No, it is not a bug.

'#' is not a comment in spec files. To be precise, it does not
prevent rpmbuild from expanding %macros. The problem is that
%service macro is multiline macro, so

# - use %service macros

expands to

# - use {
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/ ] && . /etc/sysconfig/
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/ ]; then
/sbin/service   1>&2 || :;
else
echo 'Run "/sbin/service  start" to start  service.'
fi
fi }; macros

^^^ obviously it is incorrect

If you want to prevent builder from expanding macro, use double
percent:

# - use %%service macros

it expands to

# - use %service macros

In fact the only correct way to comment something out on spec level
is:

%if 0
...
%endif

-- 
Regards,
Paweł


More information about the pld-devel-en mailing list