Extract Spec File from RPM – How to Guide

centosrpm

I have an RPM that I built. And I am looking to figure out how to extract the Spec file out of it. I have tried:

rpm --scripts -qp sampleBuild.rpm

That didn't work. Does anyone know the proper command?

Best Answer

Usually, only source rpms have a spec file. You can extract it with

rpm2cpio myrpm.src.rpm | cpio -civ '*.spec'

or you can install the src rpm, as a user, with rpm -i myrpm.src.rpm, when the directory rpmbuild/SPECS/ will get the spec file.

Related Question