[TriLUG] Another plea for RPM help!

Jeremy Katz katzj at linuxpower.org
Sun Nov 18 22:08:51 EST 2001


On Sunday, November 18 2001, Tom Bryan said:
> On Monday 19 November 2001 05:55 am, you wrote:
> > > Argh!  How does anyone learn how to package RPMs well?  
> >
> > It's pretty messy... half the things I learned were from looking at other
> > people's RPMs.  :(
> 
> That's what I've been doing, but from my days of working with LaTeX, I found 
> that when everyone copies the examples they have, they continue the same 
> legacy hacks forever.  More recent versions of the tool often supported a 
> much more elegant solution.  Not surprisingly, the LaTeX community has some 
> pretty good documentation available.

Grab packages done by Nalin Dahyabhai, Bill Nottingham, Matt Wilson, or
probably my own.  We tend to be "good citizens" about using RPM sanely.
It is, unfortunately, the best place to learn things.  That and ask
questions on rpm-list when you have them.  If I had about 3 or 4 more
hours in a day, I'd try to write more documentation for things... 
 
> > > I'm trying to write a .spec file, and I really want to do it well. 
> > > Here's a nice example.  I'm building a custom postgresql .rpm for a
> > > project.  I'd like to run ldconfig when the package installs.  I see that
> > > Red Hat's RPM does this:
> >
> > Damn, when you do something, you don't fool around, do you?  Postgresql is
> > definitely not an easy place to start in figuring out packaging.  =)
> 
> I started with Zope.  That was even worse because it doesn't follow the 
> standard configure-make-install.  :-P  Really, packagind something for a very 
> small audience with a special purpose is much easier than worrying about a 
> general purpose package.

At the same time, simple general use packages will get you more mileage
and not leave you feeling as confused.  *shrug*  Probably doesn't matter
which approach you take though.

> > > %post -p /sbin/ldconfig
> > >
> > > Question #1: What does the -p flag do?  I can't find any documentation on
> > > it.

For the %post, run the process /sbin/ldconfig instead of running /bin/sh
to run the scriptlet.

> > > Question #3: Why don't these RPMs protect the post script with a
> > > if [ $1 = 1 ]
> > > then
> > > 	/sbin/ldconfig -n /usr/local/pkg
> > > fi
> > > So that it isn't run every time the package is installed?
> >
> > Probably because it's pretty harmless to run ldconfig multiple times.  =)
> 
> Except that it scans the drive for shared libraries, not something to which I 
> want to subject people using low-end hardware.

It's most useful if you're running on a path which *isn't* in the
default /etc/ld.so.conf.  Most of the time, you just want to have it be
%post -p /sbin/ldconfig

And you need to do it on upgrades as well because libraries can and do
change on upgrade.  

And yeah, this sucks a lot... installs would go quite a bit faster if we
didn't have this overhead / could group packages such that we only ran
ldconfig "when needed"
 
> > > I know that someone lurking on this list is preparing a presentation on
> > > RPM. Where did *you* learn it?  How do I learn how to create a
> > > well-written .spec file that doesn't abuse RPM's intent and avoid all of
> > > its helpful features?
> >
> > The best reference is the maximum RPM work-in-progress.  
> 
> At ftp://ftp.rpm.org/pub/max-rpm/ ?
> Strange, last time I was on www.rpm.org, I thought that I was bounced to an 
> online copy of the previous release.

Maximum RPM is okay, but unfortunately somewhat dated.  cf the current
thread on some list (either enigma or rpm... I don't remember which atm)

> > or digging through the RPM source, which I don't understand.  =)
> 
> I'd do it, but I don't think that I have the time at the moment.  Maybe I'll 
> just log a bug.  The man page even has errors in it.  It's like Red Hat put 
> RPM out there just to fool their competitors into adopting it.  "What a 
> strategy.  It'll take them weeks to figure out how to use RPM!  By that time, 
> we'll already be releasing a new, incompatible version.  BWA!HA!HA!HA!"

Believe me, this definitely *isn't* the case.  The ever-changing without
much in the way of documentation bugs me probably more than most people.
And I sit a skip, hop, and jump away from jbj.  As far as spec files are
concerned, though, that has remained at least backwards compatible for a
while although new things have been added for convenience's sake.

> > > Finally, will the RPM presentation for TriLUG cover such fine points, or
> > > will it just cover the basic installing and building of RPMs?
> >
> > That's a darn good question.  I suspect going that deep into things will be
> > way too much time, but I can add stuff to the slides that won't be in the
> > presentation, maybe, if you want...
> 
> No, that's okay.  I was just curious whether you were assuming any background 
> with RPM.  Covering BuildRoot would be a good idea though.  I get the 
> impression that I should be using it, but I've had nothing but trouble with 
> it.  

What problem are you having and I'll see if I can help shed some light.

Cheers,

Jeremy

-- 
Jeremy Katz
katzj at redhat.com    	| jlkatz at eos.ncsu.edu
katzj at linuxpower.org	| Developer, NCSU Realm Kit for Red Hat Linux
GPG fingerprint: 367E 8B6B 5E57 2BDB 972A 4D73 C83C B4E8 89FE 392D



More information about the TriLUG mailing list