Re: [Rpm-maint] [rpm-software-management/rpm] `define(name, body)` documentation does not align with implementation (Issue #2962)
For the context, I have stumbled upon this issue playing with #2969 and my initial idea was to assign the whole macro body including the new lines to some macro with some specifically crafted name. But I was not able to achieve that no matter what and resorted to use variables (which is probably good enough variant). It is my feeling that for whatever reason defining macro in Lua is limited comparing to plain .spec file, not being able to insert new line there. But maybe I have just not figured out the right amount of backslashes or what not. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2962#issuecomment-2010097636 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] `define(name, body)` documentation does not align with implementation (Issue #2962)
Indeed, rpm.define() calls rpmDefineMacro() which is takes the macro name and the body as a single line - as you would get in a macro file. It doesn't make much sense as an API. IIRC Lua's rpm.define() used that API because the other alternative lacked all the error checking back in the day, but things are quite different now, Lua should get a better define macro. Note that this also works: `macros['foo'] = 1` -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2962#issuecomment-2009523484 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] `define(name, body)` documentation does not align with implementation (Issue #2962)
It's kinda sad that this strips the leading spaces: ``` rpm -E "%{lua:macros.define({'foo', ' 1 '})}" -E "x%{foo}x" >1 < ``` -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2962#issuecomment-1999675441 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint