[Rpm-maint] [rpm-software-management/rpm] RFE: pass parametric macro options and arguments to Lua natively (#1092)

nim-nim notifications at github.com
Mon Oct 12 13:00:22 UTC 2020


@pmatilai Look, the only thing I care about lua side is being able to access spec state easily and reliably. state = state of macros/variables, state of flags and option passed to a macro, etc. The best macro logic in the world will produce erroneous results if it is mistaken about spec state.

Right now a lot of this accessing is done via expands. While expand is only a string processor that’s the only tool provided in the documented rpm lua API to read state lua-side. And you often need to compare several slightly different expand calls to guess the real data state.

Good replacements to this expand mess should expose real state lua side. Real means nil if unset, false if set to false, true if set to true (or just set without value), empty string if set to empty string, array of values if a macro evaluates to several lines of values (à la sourcelist).

While nil and false behave the same in bare conditionals, and nil and empty string behave the same when expanding to string, they are not the same semantically. Typically, nil means you are free to use default values instead, while an explicit false or empty string is an explicit packager request. When a macro can accept both quiet and verbose flags, or a general default state variable, you really really want to know which one of those was actually set to something (including false) and which one of those is currently unset..

What I objected here is exposing false instead of nil when something is unset. Requiring a separate call to check if it’s false or unset is no better than comparing several expand calls (with our without leading ?) to get the actual result.

-- 
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/1092#issuecomment-707105106
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20201012/806797db/attachment-0001.html>


More information about the Rpm-maint mailing list