Dissecting RPM and DEB packages
- A not well known fact is that RPMs and DEBs are simply encapsulated
cpio and ar archives (loosely analogous to headers flanking the body of
email or XML obfuscating simple data).
If you, like me, want to examine source code to understand a program
rather than relying on [often] poor documentation with few examples,
you need to determine where the sources are maintained. Google is often
good for this [search using "<progname> source download"] but what if
a distro's version might be unique or have some differences from common
source archives' versions?
The solution for that is to install source code from the distro's
repositories but it's not always clear where the source code will appear
on your system after installation.
The solution for that is to grab the source code directly and unpack it
whereever you want it to be.
I recently had need to examine some CentOS programs and since CentOS is
a "white box" version of Red Hat Enterprise Linux the source files can
be found here:
which is easy to browse and then download what's wanted. But then you
are faced with the RPMs [for CentOS].
The solution to that is to open the RPM wrapper, extract the embedded
cpio archive and from that extract the source's tar file. This is much
simpler than you might believe. This command extracts everything from
an RPM file into the directory in which it's issued:
rpm2cpio package.rpm | cpio -vid
If you just want to examine the package's contents:
rpm2cpio package.rpm | cpio -vt
The rpm2cpio program is a short and sweet Perl program available here:
<http://www.iagora.com/~espel/rpm2cpio> copy'n'paste it to a file
and I put my copy of it in /usr/local/bin since that directory is in
DEBs are simply wrapped 'ar' archives (see "man ar").
A simple and short writeup how to handle both RPMs and DEBs is here:
- On Thu, May 3, 2012 at 7:01 PM, thad_floryan <thad@...> wrote:
> A not well known fact is that RPMs and DEBs are simply encapsulatedquick point in fact, if you're running x, you can open an rpm or deb
> cpio and ar archives (loosely analogous to headers flanking the body of
> email or XML obfuscating simple data).
with file-roller or equivalent program just like most any other
- (and i might add that the midnight commander (mc) offers similar
capabilities in a vfs format in an ncurses/text environment.
- On Thu, May 3, 2012 at 10:21 PM, roro <roro@...> wrote:
> (and i might add that the midnight commander (mc) offers similarMeh... I never did like midnight commander... never could get the hang
> capabilities in a vfs format in an ncurses/text environment.
of it... though I do admit that people that DO get it always liked it.
I've always used rpm2cpio as Thad described to extract rpms,
personally... especially if I want the contents without executing the
File Roller is just... the tool of the devil. Devil, I say... :)