[CentOS-devel] How get a spec file with all macros expanded

Tue Mar 27 12:37:33 UTC 2012
Johnny Hughes <johnny at centos.org>

On 03/27/2012 05:56 AM, Marcos Lois Bermúdez wrote:
> Hi,
> I'm building some packages using CentOS 6, and i have a question that i 
> can't get answer for, i think that is a common task in rpm build that 
> will get some info that will help in automate some process.
> I need to get a spec file with all macro exanded, so i can extract info 
> of buildrequires, etc..

If you want to know the buildrequries, you can do this to with the SRPM:

rpm -qp --requires <name>.src.rpm

You can also extract the spec file directly with the command and then do
things with sed or grep to that file:

rpm2cpio <name>.src.rpm | cpio -i *.spec

You can also see all the macro information for rpm with the command:

rpmbuild --showrc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20120327/0b0d252a/attachment-0005.sig>