[Rpm-maint] [rpm-software-management/rpm] How to expand possibly non-existent user constructed variable name? (Discussion #3411)

Panu Matilainen notifications at github.com
Wed Oct 30 08:07:07 UTC 2024


> Funnily enough, we were forced to use Lua for [c9s](https://gitlab.com/redhat/centos-stream/rpms/ruby/-/blob/stream-ruby-3.3-rhel-9.6.0/macros.rubygems?ref_type=heads#L15), because RPM does not support %{sub:...} there. ATM, I don't think it is more readable nor shorter. But admittedly, it could also be written different way ...

Yeah you'd want to write the whole macro in Lua, not just parts of it. And format like you would do regular code - just as a silly example:
```
%mymacro() %{lua:
    function helper(myarg)
        return myarg.."-helper"
    end

    if arg[1] then
        print(helper(arg[1]))
    else
        print("no arguments")
    end
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/3411#discussioncomment-11096956
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/3411/comments/11096956 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241030/abc56ddd/attachment.html>


More information about the Rpm-maint mailing list