Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Aarrgh!  (rpm misunderstanding)
@ 1996-05-07  7:10 Eric Smith
  1996-05-07 15:14 ` Erik Troan
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Smith @ 1996-05-07  7:10 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Aarrgh! (rpm misunderstanding)
  1996-05-07  7:10 Aarrgh! (rpm misunderstanding) Eric Smith
@ 1996-05-07 15:14 ` Erik Troan
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Troan @ 1996-05-07 15:14 UTC (permalink / raw)


On Tue, 7 May 1996, Eric Smith wrote:

> 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.

This was a problem in RPM 2.0.0 on the Alpha. It was fixed in 2.0.1 and
better.

> 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.

Building ignores the database completely. If you had downloaded the bianry
package instead and upgraded to it, your config files would have been saved.

> 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.

True - we're trying to fix this. The answer for what you wanted to do it:

	1) rpm -i apache*src.rpm
	2) rpm -bp /usr/src/redhat/apache*.spec
	3) cd /usr/src/redhat/BUILD/apache*
	4) do the rest by hand

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

Gaping holes in the documentation. Source packages are not tracked in the
database at all, and we can't control what a build process does. RPM doesn't
have much control over the "make install" step of a Makefile.

Erik

-------------------------------------------------------------------------------
   Always hoped that I'd be an apostle. Knew that I would make it if I tried.
     Then when we retire we can write the gospels so they'll all talk about
         us when we die. - "The Last Supper" from Jesus Christ Superstar
|   Erik Troan   =   http://sunsite.unc.edu/ewt/   =   ewt@sunsite.unc.edu    |

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-07 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-05-07  7:10 Aarrgh! (rpm misunderstanding) Eric Smith
1996-05-07 15:14 ` Erik Troan

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