6

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?

7

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.

  • Download the source-rpm with yumdownloader --source yourpackagename. – ILMostro_7 Jun 30 '18 at 12:53
5

I did some more digging around and while I cannot extract the SPEC file into another file such as text, I can use rpmrebuild to view the SPEC file and edit it. So, with that being said, here is the command I used:

rpmrebuild -e -p sampleBuild.rpm

  • This works well for RPMs (not SRPMs) where the original spec is missing, as it generates a fake spec. The yum package is rpmrebuild. – rjh Sep 5 '18 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.