[Rpm-maint] [rpm-software-management/rpm] Unclosed %if (when defined inside %define) (#1198)
Mihai Moldovan
notifications at github.com
Wed Jun 1 12:42:45 UTC 2022
I actually want to provide compatibility macros if rpm doesn't offer them for a specific piece of software, and something like this was my original idea:
```spec
%if 0%{!?build_cflags:1}
%build_cflags %{optflags}
%endif
```
which naturally didn't work in a macro definition file, since every line is essentially prefixed with `%define` internally and `%define %if ...` is not well formed.
My next best, logical approach would have been using %if conditionals in the definition itself, so essentially doing what is shown here, but that seems to be a bad idea.
I've since learned of [`%[expression expansion]`](https://rpm-software-management.github.io/rpm/manual/macros.html#expression-expansion) and the `${expr:expression}` macro, which do vary in the way they actually expand macros within them to the point where `%[]` seems to be doing what an `%if` conditional would do, if I read the information in this bug report correctly.
I might even get away without any conditional macros at all in my case, such as using something like this:
```spec
%build_cflags %{?build_cflags}%{!?build_cflags:%{optflags}}
```
but, while I've seen constructs like these in macro definition files already, they were never self-referencing and the recursion in this looks crazy and I have no idea if the spec parser can handle cases like these.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1198#issuecomment-1143561172
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/1198/1143561172 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220601/105689e2/attachment.html>
More information about the Rpm-maint
mailing list