Subject: EXTRACTing rpm's
To: Simon Burge <>
From: Miles Nordin <carton@Ivy.NET>
List: tech-pkg
Date: 06/15/1999 01:11:19
On Tue, 15 Jun 1999, Simon Burge wrote:

> I've found a few locations for source .tar.gz and .rpm files, but (not
> being a Linux user), I've got no idea what to list as the master site.

Not that I'm a Linux user or anything, but here's the deal with RPM's.

Binary RPM's are of course useless--the interesting ones are the .src.rpm
``SRPMS''.  Avoiding pkgsrc dependency on the whole rpm package manager
would be nice, because it's an ugly, misguided, unmaintainable little
condescending hack compared to pkgsrc.  Distributed along with the main
rpm binary is a tool called ``rpm2cpio'' that you use in a pipe to turn
rpm packages into plain cpio archives of their contents, so assuming we
had rpm2cpio,

cat ....src.rpm | rpm2cpio | pax -r

ought to get at any rpm's contents (unless rpm2cpio is too old--new rpm
files tend _not_ to be backward compatible with old rpm tools, usually to
the point of not even being extractable).

Inside an .src.rpm are copies of the distfile(s), the patches, and a
*.spec file.  The spec file contains Bourne-again shell script fragments
to replace our pkg Makefile's, as well a %files section that replaces our
PLIST, except it's full of strange secret undocumented features that only
RedHat knows how to use.  Each release of rpm has more %files secrets than
the last.

I assume what you want is the difinitive maintained version of a Linux
utility's source--this is rarely in an RPM, even with things like
util-linux.tar.gz, since rpm is a RedHat-ism and there are other
``competing'' distributions.  The spec file contains lines like:

Source: ftp://casper.Ivy.NET/pub/secret-linux-util.tar.gz
Source1: ftp://balthasar.Ivy.NET/pub/secret-linux-util-addon.tar.gz
Source2: secret-util.initscript
Patch0: ftp://melchior.Ivy.NET/pub/secret-linux-util_flock.patch
Patch1: secret-util_glibc-headerfile-collisions.patch

The URL's are optional and often outdated, since they're never actually
used for fetching the sources--you have to do that by hand.  But where
they exist, they tend to note (one of) the difinitive maintained source
repositories from which RedHat pilfers their sources with every new

Thus, if you can use rpm2cpio to rape the spec file out of it's rpm, you
can figure out from where RedHat is getting the clean sources.

No, RedHat doesn't cache distfiles publicly.  only SRPMS.  thus offering
of SRPMS is GPL compliance.

Unfortunately, the rpm distribution is one of the very few packages where
the .src.rpm is the difinitive source.  And, as I mentioned earlier,
they're not backward-compatible file formats, so you need the latest rpm
tool to build the latest rpm tool.  A NetBSD 1.2-to-current upgrade might
almost be easier to cleanly integrate into pkgsrc than rpm2cpio.

However, I think RedHat usually burries a .tar.gz'ed version of rpm (and
rpm2cpio) on their site somewhere.  Likely as not, it's an Intel binary.

If you find you need it, I'd be glad to cpio-ize some RPM's for you, such
as rpm-*-*.src.rpm for example if you're interested in building rpm2cpio.
I ashamedly still have that capability.

Hopefully you've heard more secrets from the Dark Tower of Linux than you
care to already, but let me know if I can tell you anything else.

BTW--i was just in CompUSA looking for a Duo Type III battery, and the
creepy announcer-advertisement voice was telling me how powerful
``L-eye-nuks'' is.  What is ``powerful,'' what's the difference between a
computer and a ``server,'' i still don't know, but I threw the nearest
sales lackey against the wall and screamed, ``Say it, you worthless goat!  
X...Window...System... not XWINDOWS!.  u...s...r.... not USER!  don't
_push_ me, little man.'' so if you see my picture on the wall in your
local CompUSA that's why.  
take care, all.

Miles Nordin / v:1-888-857-2723 fax:+1 530 579-8680
555 Bryant Street PMB 182 / Palo Alto, CA 94301-1700 / US