Camel in a Hat

New 4.14 RPM is stricter in macro handling

Petr Pisar, 2017-08-14T13:47:00
The new rpm-build-4.13.90-0.git14002.2.fc27 is stricter in handling macros
<>. As a result you can experience
build failures like this:

error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
error: Macro %__requires_exclude failed to expand
error: line 33: %global __requires_exclude %__requires_exclude|^perl\\(Glib\\)$

This example comes from perl-Cairo-GObject.spec that contained:

%global __requires_exclude %__requires_exclude|^perl\\(Cairo\\)$
%global __requires_exclude %__requires_exclude|^perl\\(Glib\\)$

The spec code raises the error if %__requires_exclude has not yet been
defined. This happens if perl_default_filter is not defined and that happens
if perl-macros is not installed and that's true in source RPM build root (the
build root where source packages are created before koji hub distributes them to
full-arch build workers).

The fix is to rewrite the __requires_exclude macro definition in the way that
it expands the original __requires_exclude macro only if it exists:

%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Cairo\\)$

This used to be good practise even before emerging the 4.14 RPM. But some
people used the shorter form for legibility with the excuse that it does not
cause any harm. Well, now it causes.

-- Petr
Generated from at 2017-10-21T21:02:18. Report issues with this page to Petr Pisar <>.