Can I use rpm to expand the macros in a specfile?

user376403 picture user376403 · Sep 3, 2010 · Viewed 11.2k times · Source

The concrete example being I have lots of specfiles with Source0: or other Source lines containing macros. How can I have these macros expanded without actually starting a build on the specfile or writing my own parser?

Answer

Stan picture Stan · Oct 26, 2011

Since rpm 4.9 you can use:

rpmspec -P <spec_file>

This will print out expanded spec file on stdout