Re: Problem with expansion of %* macro when using nested parameterized macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



% ...
% Again, let's take systemd macros as an example:
% 1) %systemd_post macro [1] is defined as:
% 
% %systemd_post() \
% if [ $1 -eq 1 ] ; then \
%         # Initial installation \
%         systemctl preset %{?*} >/dev/null 2>&1 || : \
% fi \
% %{nil}
% 
% 2) %systemd_user_post macro [2] is defined as:
% 
% %systemd_user_post() %systemd_post \\--user \\--global %{?*}
% 
...
% [vagrant@localhost ~]$ rpm --eval '%systemd_user_post foo'
% error: Too many levels of recursion in macro expansion. It is likely
% caused by recursive macro declaration.
% 
% if [ $1 -eq 1 ] ; then 
%         # Initial installation 
%         systemctl preset \--user \--global \--user \--global \--user
% \--global \--user \--global \--user \--global \--user \--global \--user
% \--global \--user \--global \--user \--global \--user \--global \--user
% \--global \--user \--global \--user \--global 
% 
% The problem is that rpm doesn't properly expand the '%{?*}' macro inside
% the %systemd_user_post into 'foo'.
% Instead, rpm passes it as the third argument to the %systemd_post macro,
% where '%{?*}' is then recursively defined as:
% \--user \--global {%?*}.
% 
% This obviously causes the recursive macro expansion error mentioned
% before.
% 
% How can I fix the %systemd_user_post macro to properly expand the
% '%{?*}' macro?

In this case inner macro should expand first:

%systemd_user_post() %{expand:%systemd_post \\--user \\--global %%{?*}}
 

Regards,

--
Michael Mráka
Software Management Engineering, Red Hat

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list




[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux