On 9/21/21 7:30 PM, Erik Skultety wrote:
Commit b5e8db8f14d tuned the SPEC file so that libvirt daemons
restart
on package upgrade. In order to do that it added a bunch of
parametrized macros using the %global directive. This caused a problem
when running RPM builds on CentOS Stream 8 resulting in:
error: Too many levels of recursion in macro expansion. It is likely
caused by recursive macro declaration.
error: Macro %libvirt_daemon_perform_restart failed to expand
error: line 1275: %global libvirt_daemon_perform_restart() \
if test %libvirt_daemon_needs_restart %1 \
then \
/bin/systemctl try-restart %1.service >/dev/null 2>&1 || : \
fi \
%libvirt_daemon_finish_restart %1
There are 2 important differences between %global and %define
directives:
1) %define is local-only and does have scope - in reality though, its
scope is apparently not really enforced because it behaves exactly
the same way as %global
2) %define is evaluated at the of use while %global is evaluated at the
time of definition
The latter and the fact the macro is parametrized is the reason why the
RPM builds fails on CentOS. Strangely enough this only happens on
CentOS Stream, but not Fedora (which is also the main proponent of
replacing %define with %global). Anyhow, replacing %global with %define
makes the rpmbuild to pass on both and along with package upgrades.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
libvirt.spec.in | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal