Le mercredi 06 mai 2020 à 13:44 +0200, Miro Hrončok a écrit :
Hi, Miro
As a side not, is it possible to have conditonal expansion not
expand
on empty macro?
If not, we'll advise the users to undefine when they want "empty
flags".
That won’t work if you need to build upon those macros in the future
lua-side. The official documented rpm lua API does not contain
undefine, just define.
Because of this, in my own Fedora macro sets, unsetting already set
variables safely, or emptying them, is done with
rpm.define(rpmvar .. " %{nil}")
And the test to check if a variable is free to be set, is checking if
"%{foo}" expands to "%{foo}". Anything else means something else
already touched the variable in the spec file and the result should
best be left alone.
Macros that consume the result then have to use rpm.expand("%{?foo}")
as input. Which seems to work as expected in all cases.
Regards,
--
Nicolas Mailhot