[NBLUG/talk] Recompiling a RPM

Eric Eisenhart eric at nblug.org
Mon Jan 8 11:14:31 PST 2007


On Mon, Jan 08, 2007 at 10:33:23AM -0800, Todd Cary wrote:
> I grasp the overall strategy in creating and using the macro, but I do 
> not fully understand it's creation/syntax.  Is there a good reference to 
> the syntax?

hm.  not that specifically, exactly...  The .rpmmacros file has the same
syntax as inside of .rpmmacros.    Here's the main place to look:
http://fedora.redhat.com/docs/drafts/rpm-guide-en/
Especially here, for that specific question:
http://fedora.redhat.com/docs/drafts/rpm-guide-en/ch-customizing-rpm.html

> By chance, is this what the rpmdevtools is suppose to do (though I have 
> only heard of it)?

I don't know.

> Does the rpmbuild replace what is already installed?  If not, how do set 
> it up so the old version is replaced?

No.  The rpmbuild just builds a pile of RPMs.  You have to install them
yourself.  If you want yours to be an "upgrade", you'll want to edit the
"Release" or the "Epoch" to be slightly higher.  I'd recommend taking the
release number that was on the original RPM and adding something like
".tc.1" to the end of it.  (tc being your initials.  At work we use '.ssu'
and a CVS revision)

> Todd
> 
> Eric Eisenhart wrote:
> >On Mon, Jan 08, 2007 at 08:58:03AM -0800, Todd Cary wrote:
> >  
> >>I need to recompile my version of Red Hat's PHP using the 
> >>--with-interbase=shared,/opt/firebird.  I have downloaded the .src.rpm 
> >>version, however I have forgotten how to recompile the src and how to 
> >>replace the current version.  In fact, can that even be done?
> >>
> >>I cannot run RPM -e php due to the dependencies..
> >>    
> >
> >I usually do this in a user-environment instead of as root, but here's the
> >basic steps:
> >
> >1) rpm -ihv blah.src.rpm
> >2) rpmbuild -ba /usr/src/redhat/SPECS/blah.spec
> >
> >The rpmbuild command-line can take some arguments to define things that are
> >passed to the stuff in the .spec file.  Or you can modify the .spec file
> >first.
> >
> >I highly recommend doing the following, though:
> >As a non-root user:
> >1) mkdir ~/rpmbuild/ ; mkdir ~/rpmbuild/tmp ; mkdir ~/rpmbuild/RPMS
> >2) cat > ~/.rpmmacros <<EOT
> >%_topdir                %(echo $HOME)/rpmbuild
> >%_tmppath               %{_topdir}/tmp
> >%_builddir              %{_tmppath}
> >
> >%_rpmtopdir             %{_topdir}/%{name}
> >%_sourcedir             %{_rpmtopdir}
> >%_specdir               %{_rpmtopdir}
> >%_rpmdir                %{_topdir}/RPMS
> >%_srcrpmdir             %{_topdir}/RPMS
> >%_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
> >EOT
> >
> >3) as same non-root user, "rpm -ihv somepackage.src.rpm" -- it'll install
> >the spec file and all its source stuff into ~/rpmbuild/packagename/.  You
> >can do the same "rpmbuild" command-line stuff as a non-root user from 
> >inside
> >that directory now.
> >
> >The biggest advantage to doing the non-root thing is that some software
> >tries really hard to install itself into the system proper when you run 
> >some
> >of the build/install scripts, and when you build as a non-root user that
> >generates an error that you can then fix, instead of putting files on the
> >system that RPM doesn't know about that will cause you trouble later.
> >  
> 
> -- 
> Ariste Software
> 2200 D Street Ext
> Petaluma, CA 94952
> (707) 773-4523
> 
> 
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
> 

-- 
Eric Eisenhart
NBLUG Co-Founder
The North Bay Linux Users Group -- http://nblug.org/
eric at nblug.org, IRC: Freiheit at fn AIM: falschfreiheit
Jabber/XMPP/GTalk: freiheit at gmail.com



More information about the talk mailing list