rpmbuild --eval of lua macros

Florian Festi ffesti at redhat.com
Tue Jul 28 11:08:40 UTC 2015

On 07/09/2015 08:47 PM, Josh Boyer wrote:
> Hello,
> I'm trying to get rpmbuild to print the expansion of the %{patches}
> macro in our kernel package.  When I run rpmbuild --eval %{patches}
> kernel.spec, I get the following error:
> error: lua script failed: [string "<lua>"]:1: bad argument #1 to
> 'ipairs' (table expected, got nil)
> Looking at the macro, it seems it is dynamically constructed as rpm
> parses the spec file.  What I cannot figure out is how to force rpm to
> actually do that when passing --eval.  It seems the --eval option
> doesn't call the code that would build the patches table?  That is my
> best guess anyway.
> So is there a way to get rpm to expand this macro and print out the value?

There is a bug in 4.12 that prevents doing that. See
344f938670b8f7400ef177945cef5552783d450f. Can you please try the newly
released rpm-4.12.90 aka 4.13-alpha if it fixes your problem? It is
currently available in Fedora rawhide or you can build it from source.

As the commit message says:

Fix adding of sources to lua variables during recursive parsing of spec

- Before this fix sources and patches weren't added to lua variables
  "sources" and "patches" if they were located in spec file after tag
  "BuildArch". Now it works.(rhbz:#1084309)

moving the BuildArch entry down may also do the trick.



Red Hat GmbH, http://www.de.redhat.com/ Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael
O'Neill, Charles Peters

More information about the Rpm-list mailing list