[Rpm-maint] Adding features to RPM

Derek Pressnall derekpr2 at needcaffeine.net
Thu Jan 27 03:11:51 UTC 2011


Quick question.  I'm looking at developing a couple of features for
RPM, and was wondering if there is any documentation on the code base.
 I've started to look at it, and I think I've figured out where to get
started, but in case I get stuck...

What I'm looking to add is essentially a new URL type and file format.
 What I'd like to do is be able to extract an RPM's contents into an
on-disk directory structure (both the file contents and all the meta
data), and later be able to install from that extracted directory
structure. For example, a package "foo-1.3-7.i386.rpm" would be
extracted to "/usr/share/rpmdepot/foo-1.3.7.i386/", with the meta data
(pre/post
install scripts, header information, ...) sitting in a "meta"
directory and the actual contents sitting in a "package" directory.

Secondly, when you install the package to the system from that
location, you would specify a command line similar to: "rpm -i
--link-files depot://foo-1.3.7.i386".  Then, instead of copying all
the files to their target locations, any static file (binaries,
libraries, etc) would get symlinked to the source (package depot)
directory.  By default any file that would be in /usr/bin or /usr/lib,
or any other read-only directory (as defined by the FHS)  would get
symlinked; any file that goes in /etc or /var gets copied.

Now what do I hope to gain by this?  Well for starters, the package
depot directory can be exported to multiple VMs.  Each VM could then
have a rather light-weight root filesystem, since most of the contents
would be symlinked to the shared directory.  Makes for installing a
bunch of VMs a lot easier.  This has an advantage over having /usr
exported to the VMs, as it allows packages each VM to be upgraded
incrementally.

A second use for this would be for generating installable live OS DVD
images.  The package depot could be a read-only compressed image
sitting on the DVD, with a relatively small ram disk root filesystem.
The OS installer can then do a normal install to the target PC by
using the depot as its source instead of a directory full of RPM files
(saving space on the DVD by not having to have two copies of each of
the packages -- a packaged version, and an installed version).  Also I
can see use for this in some embedded environments too.

So to implement this feature, I'd have to add 1) a method of
extracting the RPM contents along with meta data (something similar to
rpm2cpio, but with meta data extraction also); 2) add in a new URL
type (depot://) which specifies that we are installing from an
extracted RPM copy; 3) add the  "--link-files" option which symlinks
package files from the source location where possible.  Also, the RPM
verification code would need to be altered to handle the linked files
(since the original package would record in the database that these
files aren't symlinked, the checksum validation procedure would have
to follow the symlinks in this case).  I'm sure other parts of the
code would have to be touched, because it looks like all the current
URL specifications simply copy the RPM from that URL into a temp
location, and install from there.

So does anyone see any flaws in what I've outlined above?  Any
comments are welcome.


More information about the Rpm-maint mailing list