[Rpm-maint] [rpm-software-management/rpm] Introduce convenient %gsub macro to wrap Lua's string.gsub() (#1764)

Miro Hrončok notifications at github.com
Mon Aug 30 16:06:26 UTC 2021


I like your questions but I don't have the answer. Would exposing Lua string methods on RPM macros make sense? E.g.:

```
%{version:gsub ~} -> as if rpm.expand("%version"):gsub(rpm.expand("~"), "") is called from Lua
%{version:gsub %{thingy} -} -> as if rpm.expand("%version"):gsub(rpm.expand("%{thingy}"), rpm.expand("-")) is called
%{version:gsub [^%%%%w]+ - 5)} -> ...
%{whatever:len}
%{name:lower}
%{commit:sub -8}
```

>     * you'd probably want to use `arg[n]` instead of `rpm.expand('%{?n})` for better control - for one, re-expanding the arguments tends to lead to %-escape hell as the arguments are already expanded once

I was aiming at compatibility with older RPM but %-escape hell seems like it is indeed not worthy.

-- 
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/pull/1764#issuecomment-908469704
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210830/dfd3b17e/attachment.html>


More information about the Rpm-maint mailing list