[Rpm-maint] [rpm-software-management/rpm] Meta programming in .spec using Lua, is it heresy? (Discussion #2969)
I am playing with ideas such as #2959 or #2892 and here is a proposal how to achieve that (and much more). This could be the .spec file: ~~~rpm-spec %define subpackage() %{lua: subpackage = arg[1] subpackage_name = subpackage:match("\\n%%package%s*([^\\n]*)") if subpackages == nil then subpackages = {} end subpackages[subpackage_name] = subpackage if licenses == nil then licenses = {} end licenses[subpackage_name] = subpackage:match("\\nLicense:%s*([^\\n]*)") } %define subpackages() %{lua: for k in pairs(subpackages) do print(rpm.expand(subpackages[k])) end } %define licenses() %{lua: local license = arg[1] for k in pairs(licenses) do l = licenses[k] if l then license = license .. " AND " .. l end end print(license) } %{subpackage: %package foo Summary: foo subpackage License: BSD %description foo This random subpackage %files foo } Summary: Demonstration package for mining licenses from subpackages Name: license-subpackages Version: 1 Release: 1%{?dist} License: %{licenses:MIT} %description Using Lua and "metaprograming", it is possible to do magic with .spec files such as collecting licenses from subpackages. %{subpackages} %changelog * Wed Mar 13 2024 Vít Ondruch - Initial version ~~~ The SRPM would look like this: ~~~ $ rpm -qp --qf "%{SPEC}" license-subpackages-1-1.fc41.src.rpm Summary: Demonstration package for mining licenses from subpackages Name: license-subpackages Version: 1 Release: 1.fc41 License: MIT AND BSD %description Using Lua and "metaprograming", it is possible to do magic with .spec files such as collecting licenses from subpackages. %package foo Summary: foo subpackage License: BSD %description foo This random subpackage %files foo %changelog * Wed Mar 13 2024 Vít Ondruch - Initial version ~~~ I can imagine quite a lot more done with something similar. This trick could be used to enable/disable subpackages at will. If there were requires/provides, they could be adjusted for systems such as SCL. Is there some functionality or tag which RPM does not support (yet?), no problem to implement it in such macro. Is this going too far? -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/discussions/2969 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] Lua equivalent to `%{echo:...}` and similar (Discussion #2968)
Yes, I don't argue with that. But output from Lua to terminal is useful and would IMHO deserve some separate note. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/discussions/2968#discussioncomment-8772227 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
@pmatilai converted this issue into discussion #2968. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#event-12102257552 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
Accessing rpm macros through the `macros` table *is* documented in https://rpm-software-management.github.io/rpm/manual/lua.html -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#issuecomment-1994197986 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
Closed #2967 as completed. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#event-12102237708 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
TBH figuring out `rpm.expand("%{echo: some output}")` is also not that straight forward. I was able to find such example at least. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#issuecomment-1994195978 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
Oh. Interesting, the for the tip 👍 Nevertheless, I was not able to figure that out myself, therefore it would deserve to be documented if that is the right approach. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#issuecomment-1994192617 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] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
You can already do: ``` macros.echo({"hello world"}) ``` -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967#issuecomment-1994089448 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
[Rpm-maint] [rpm-software-management/rpm] Lua equivalent to `%{echo:...}` and similar (Issue #2967)
Currently the way to get some information from Lua macro is quite clumsy. One needs to do something like: ~~~ %define foo() %{lua: rpm.expand("%{echo: some output}") } ~~~ Would it be possible to make it easier, e.g. something like this would be more convenient: ~~~ %define foo() %{lua: rpm.echo("some output") } ~~~ Or maybe just: ~~~ %define foo() %{lua: echo("some output") } ~~~ -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/2967 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] Weak dependencies do not allow qualifiers (#624)
Closed #624 as completed via 0644ba5755360cd6a33caa41ea09d3e25096bc72. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/624#event-12099057036 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] Weak dependencies do not allow qualifiers (#624)
Closed #624 as completed via #2964. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/624#event-12099056999 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] Really allow qualifiers like pre/post/meta for weak dependencies (PR #2964)
Merged #2964 into master. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2964#event-12099056777 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] Fix dependency generators sometimes dying with SIGPIPE (PR #2958)
@pmatilai pushed 1 commit. ae37b4311f160df832569782ae816604e3ffb854 Fix dependency generators sometimes dying with SIGPIPE -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2958/files/7d0f5cf42af0b5528ff9ae07c7c0f365e44e51cb..ae37b4311f160df832569782ae816604e3ffb854 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