Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Eric Smith <eric@goonsquad.spies.com>
Subject: Aarrgh!  (rpm misunderstanding)
Date: Tue, 7 May 96 00:10 PDT	[thread overview]
Message-ID: <m0uGgut-001UyKC@goonsquad.spies.com> (raw)

I just lost all my carefully tuned Apache configuration files as the result
of a misunderstanding of how rpm works, so I thought I would describe my
experience in the hope of preventing others from learning the hard way.

I'm running Red Hat AXP 2.1, using the standard apache-1.0.0-2.axp.rpm.
I'd carefully tweaked the various config files the way I liked them.  A few
weeks later I decided that I wanted to hack the apache source code to add a
minor feature.  So I FTP'd over a copy of apache-1.0.0-2.src.rpm.

First I tried to do a query of the source rpm.  No dice.  I'd already
upgraded my rpm executable to version 2 because I had to install some
other version 2 rpm.  And rpm version 2 can't query version 1 rpms.  Sigh.

So I did an "rpm --install apache-1.0.0-2.src.rpm".  It hung.  I let it run
for a while before I gave up.  Top showed that rpm was sucking CPU cycles as
fast as it could get them, but the cpio it had forked was sleeping.

Fortunately this was easily fixed.  I upgraded to rpm-2.0.7-1.  I tried
to install the apache source rpm again, and it worked fine.

Then I went looking for the sources.  Somehow I had gotten the misconception
that installing a source rpm would create a directory somewhere and get
everything ready so I could just type "make".  Not quite.  It just extracts
the .spec, .tar.gz, and .patch files.  Oh well.  There must be any easy
way to get the stuff ready to build, right?

So I do an "rpm" to look at the options, and there are rpm --rebuild and
rpm --recompile.  I do an "rpm --help" to get more info.  It turns out that
--rebuild is used to go all the way from a source rpm to a brand-spanking-new
object rpm.  Not what I want.  It sounds like rpm --recompile is what I want.

I type "rpm --recompile apache-1.0.0-2".  Doesn't work.  It seems that
the --recompile and --rebuild commands insist on installing the source rpm.
I guess it was pointless for me to do the "rpm --install" myself.

I cd back to where i have the source rpm, and type
"rpm --recompile apache-1.0.0-2.src.rpm".  This seems to work fine.  Sure
enough, it makes a directory, extracts the sources, and does a make.  I'm
happy...

Unfortunately, it doesn't stop there.  The make completes successfully, so
it does a make install, which proceeds to wipe out my old configuration
files.  I had no idea it was going to do a make install, or I never would
have invoked it.  To me, the word recompile doesn't imply install.  Most of
the time if I recompile something I want to test it before I install it for
general use.

To add insult to injury, it then proceeds to rm -rf the directory it built
in.  And it deinstalls the source rpm.  So I still don't have sources to
modify.

I'm sure that I must be going about this entirely the wrong way, but I'm not
sure what the preferred way is; so far my best guess is to use some variant of
rpm -b, although that seems to require the spec file, .tar.gz, and .patch
files, so it looks like I would have to do something like this:
	rpm --install apache-1.0.0-2.src.rpm
	rpm -bl /usr/src/redhat/SPECS/apache-1.0.0.spec
	cd /usr/src/redhat/BUILD/apache-1.0.0
        (repeat)
		(edit sources)
		rpm -bc --short-circuit /usr/src/redhat/SPECS/apache-1.0.0.spec
		(test the resulting executables)
        (until happy)
        rpm -bi --short circuit /usr/src/redhat/SPECS/apache-1.0.0.spec
which seems somewhat clunky at best.  Of course, if I look at the spec file I
may find that the compile and install phases simply do "make" and
"make install", in which case I can do that myself and avoid some typing.

I had purchased an official copy of Red Hat 2.1 specifically to get the User's
Guide in the hope of learning how this rpm stuff works.  By my count, there
are seven pages explaining how to use rpm to install object rpm packages, and
twenty pages explaining how I can create my own new rpms, but not a single page
telling me how to do anything useful with a source rpm.

Overall, I really like rpm, but there seem to be some rough edges, or at
least some holes in the documentation.

The main lesson though is to keep backups of your configuration files.  Don't
assume that using rpm won't clobber them.

So far I've been doing all this stuff as root, which is really dangerous.
I'm going to try creating a user "source" to do all this as in the future.
Of course, I'll have to su to root to do the install phase.

If I'm going to be doing a lot of work with the "rpm -b" command in the
future, which seems likely, it would be nice to be able to set a default
rpm spec file in an environment variable such as DEF_RPM_SPEC.

One of the things I've been thinking about doing is writing a script to
use the output of an "rpm -Va" and an "ls -R" to construct a file list to
pipe into tar.  I figure there's no point in my wasting time and tape backing
up files that came unmodified from rpms.  Or maybe someone out there has
already done this?

Eric

             reply	other threads:[~1996-05-07  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-07  7:10 Eric Smith [this message]
1996-05-07 15:14 ` Aarrgh! (rpm misunderstanding) Erik Troan
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox