Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Tuesday, August 14, 2007

How to convert .srpm to .rpm

An SRPM is an RPM package with source code. Unlike a tarball (or an RPM), an SRPM package can be automatically compiled and installed, following instructions in the .spec file included in the SRPM.


rpmbuild --rebuild <.srpm file>


I found an interesting question "Other than rebuild, how do I use an srpm file ?" and its answer on https://www.redhat.com/archives/rpm-list/2001-December/msg00048.html :

On Wed, Dec 05, 2001 at 11:27:24AM -0500, Pete Peterson wrote:
>
> I want to build the latest openssh for Red Hat 6.2. I grabbed the
> SRPM and did an 'rpm --rebuild' on it and created a bunch of new
> RPM files. The only problme is that the default configuration
> wasn't exactly what I wanted. Unfortunately --rebuild removes
> all the intermediate data, so I couldn't modify patch files,
> config files or spec files --- whatever it is that I would have
> to change to, for instance, enable MD5 passwords.
>
> I've read the man page multiple times and read the (unmaintained)
> RPM HOWTO and I can't seem to find a way to to unwrap the pieces
> from an SRPM file so they can be modified. The build instructions
> seem to be telling me that you need a spec file (-b) or a spec
> file embedded in a maybe-compressed tar file (-t).
>
> I'm sure I'm missing something obvious, but could somebody please
> either explain the procedure or point out where in TFM I should read to get
> an explanation that I can understand, for unwinding an SRPM and recreating
> a new RPM?

Do 'rpm -i ', which will install the sources in
_topdir/SOURCES and the specfile in _topdir/SPECS (where "_topdir" is
either whatever you've set it to in ~/.rpmmacros or /usr/src/redhat by
default).

The go into the specfile and look at the configure options in the %build
section. Change them as appropriate.

To rebuild the package, then run 'rpm -ba ' from inside the
SPECS directory and you end up with binary rpms and a source rpm with
your new settings (ready for a future rpm --rebuild ...). If you just
want the binary rpms, just do 'rpm -bp '.

Cheers,
Malcolm

--
Experience is something you don't get until just after you need it.


I recommend appending your initials to the release number in the spec
file so that it's clear that your rebuild has been tweaked and is no
longer stock from the distributor.

Ken
mailto:shiva@well.com
http://www.sewingwitch.com/ken/




No comments: