Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extract the spec file from rpm package

Is there any way to extract the spec file from rpm package ( I have only RPM file )

not by

   rpm --scripts -qp my-great-app-1.1.2.rpm  

( this syntax not get the spec file only the scripts from the rpm)

like image 990
jon Avatar asked Apr 10 '11 18:04

jon


People also ask

How do I get spec files from rpm?

Install rpmrebuild and "extract" (actually re-create) the spec file of your rpm file or your already installed package. Looking at rpmrebuild's code and then actually testing it, it doesn't "extract" the spec file; it regenerates most of a spec file (header, log, pre/post scripts).

How do I export an RPM package?

If you want to save a copy of the package as currently installed before upgrading or removing it, use rpm --repackage -- it'll save the RPMs in /var/tmp or /var/spool/repackage or elsewhere, depending on your configuration. Otherwise, there exists rpmrebuild , which does exactly what you ask for.

How do you get the list of the files installed by an rpm?

You can use the repoquery command which is part of the yum-utils to list files installed on a CentOS/RHEL system from a given package. Important: In Fedora 22+ version, the repoquery command is integrated with dnf package manager for RPM based distribution to list files installed from a package as shown above.


2 Answers

Install rpmrebuild and "extract" (actually re-create) the spec file of your rpm file or your already installed package.

Examples:

rpmrebuild --package --notest-install -e oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm rpmrebuild -s hercules.spec hercules 
like image 159
reichhart Avatar answered Oct 07 '22 16:10

reichhart


The spec file is not stored in binary rpms unless the packager specifically included it for some reason (and there's really no reason to do that). The only information you can get from a binary rpm is the information that rpm -qi <package> returns, and the files that rpm -ql <package> lists. If you need more than that, you have to find the source package. If Google / the vendor's web site fails to provide that for you, there should be contact information provided in the Packager field for anything packaged by anyone competent. For example, here's a package that ships with RHEL and a package from a third party vendor:

$ rpm --qf '%{Packager}\n' -q redhat-release Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> $ rpm --qf '%{Packager}\n' -q cfengine-community CFEngine AS ([email protected]) 

There you have a website and an email address, respectively, where you could ask about a spec file or srpm file.

like image 33
dannysauer Avatar answered Oct 07 '22 18:10

dannysauer