[Rpm-maint] [rpm-software-management/rpm] Parametric macro arguments are not expanded (#127)

Panu Matilainen notifications at github.com
Fri Aug 18 10:54:05 UTC 2017


The crucial difference is right there in the part you quoted:
```
%global does not work correctly with parametric macros in any version of rpm, since the body is expanded at the time of definition instead of time of use as is the case with %defines.
```

So basically you *can* use %global instead of %define, but doing that requires an extra escaping all the macros that are used. And then you need the %expand{} around them because it was already expanded. So lots of unnecessary work and complexity in the spec because of that wholly unnecessary switch to %global.

AFAICS the general pattern is:
```
%global sdkbindir()     %{expand:%{_jvmdir}/%{sdkdir %%1}/bin}
```

...which is the rather hard way to say:
```
%define sdkbindir()     %{_jvmdir}/%{sdkdir %1}/bin
```

For most cases both will work fine with the new rpm too. The biggest difference is the case where %1 might expand to nothing, in which case you need to either escape it with an extra % (so in %global case, there would now be three %-characters!) or have the relevant macro(s) handle the case where %1 is effectively not passed, ie %{?1}.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/127#issuecomment-323323618
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170818/148c2fa9/attachment.html>


More information about the Rpm-maint mailing list