[Rpm-maint] [rpm-software-management/rpm] Add support for defining literal macros via a new modifier syntax (PR #4129)
Michal Domonkos
notifications at github.com
Tue Mar 24 10:11:07 UTC 2026
@dmnks commented on this pull request.
> @@ -738,6 +748,19 @@ Expands to *1* if *%aa* expands to *5*, otherwise expands to *2*:
%[ "%{aa}" == "5" ? 1 : 2]
```
+## Example 7. Literal macros
+
+Define a macro whose body contains literal *%* characters, possibly
+overlapping with other macros:
+
+```
+%mymacro 1.2.3
+%aa %mymacro
+%bb<l> %mymacro
> The thing is, in practise, for most `my%thing` random strings with a percent sign, literal makes no difference whatsoever just because there's no overlapping macro that would get expanded. To demonstrate the effect it has, you kinda need another macro that overlaps.
Argh, right, of course :facepalm:
> Hmm okay, then there's also `%%` which always becomes `%` on non-literal macros. And for that we even have a use-case of our own, where we currently need to double-escape the % because these must not be expanded since the %'s are for the query format: `%_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm`
Right, although that's indeed quite special and not super obvious... One yearns for a clear example instead.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4129#discussion_r2980432933
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/4129/review/3997891588 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260324/202ab8ba/attachment.htm>
More information about the Rpm-maint
mailing list