[Rpm-maint] [rpm-software-management/rpm] RFE: provide lustache as an external templating alternative to macro expansion (#492)

Jeff Johnson notifications at github.com
Fri Aug 3 14:32:08 UTC 2018


Recent issues with rpm macros indicate that packagers need/expect a better paradigm than macro expansion for templating in spec files. See the many many efforts to "fix" the rpm macro implementation including (but not limited too)

* expecting every construct with a % to be a macro (except when it's not a macro)
* expecting macro expansion to be context aware and not expand in comments or to expand in textual sections like %description
* creating packaging policies that insist on %global instead of %define
* changing lazy/late argument expansion to immediate expansion to be more like shell
* expecting rpm to be able to be reconfigured within spec files by, say, changing %_topdir or %buildroot within spec files after rpm has already committed to configuration paths
* handling %nil within positional arguments just like shell
* expecting repeated macro expansion to be idempotent
* wanting if ... then ... else and loop constructs, and with legacy compatible retrofits

See the no. of issues about macro expansion reported here over the last year.

Enough already.

Mustache engines (of which lustache is a lua implementation) are quite commonly and successfully used for templating. There are engines available in most common languages, and the syntax is easy to parse with tools outside of rpm. There is also means to change the start/stop tokens to permit %{...} syntax, and there are extensions that permit diversions like %(...) through function calls to replace popen(3) and macro builtins.

Mustache can also provide recursive run-time expansion using partials, and has constructs for matching, negation and existence tests as well as loops.

Finally there is mustache specification, and documentation and tutorials etc, none of which exists for rpm macros.

Most importantly (to rpm development) is that lustache can be pulled in from external lua modules and so it's far easier to upgrade in, say, CentOS than rpm is. Legacy compatibility cannot be solved if rpm is not permitted to be upgraded. You want legacy compatibility? Upgrade lustache instead.






-- 
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/492
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180803/4c0fad57/attachment.html>


More information about the Rpm-maint mailing list