Loading ...
Sorry, an error occurred while loading the content.

Dissecting RPM and DEB packages

Expand Messages
  • thad_floryan
    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
    Message 1 of 4 , May 3, 2012
    • 0 Attachment
      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:

      <ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Workstation/en/os/SRPMS/>

      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
      my $PATH.

      DEBs are simply wrapped 'ar' archives (see "man ar").

      A simple and short writeup how to handle both RPMs and DEBs is here:

      <http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/>
    • roro
      ... quick point in fact, if you re running x, you can open an rpm or deb with file-roller or equivalent program just like most any other archive.. -- @-}--
      Message 2 of 4 , May 3, 2012
      • 0 Attachment
        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 encapsulated
        > cpio and ar archives (loosely analogous to headers flanking the body of
        > email or XML obfuscating simple data).

        quick point in fact, if you're running x, you can open an rpm or deb
        with file-roller or equivalent program just like most any other
        archive..

        --
        @-}-- alanna
      • roro
        (and i might add that the midnight commander (mc) offers similar capabilities in a vfs format in an ncurses/text environment. @-}-- alanna
        Message 3 of 4 , May 3, 2012
        • 0 Attachment
          (and i might add that the midnight commander (mc) offers similar
          capabilities in a vfs format in an ncurses/text environment.

          @-}-- alanna
        • J
          ... Meh... I never did like midnight commander... never could get the hang of it... though I do admit that people that DO get it always liked it. I ve always
          Message 4 of 4 , May 3, 2012
          • 0 Attachment
            On Thu, May 3, 2012 at 10:21 PM, roro <roro@...> wrote:
            > (and i might add that the midnight commander (mc) offers similar
            > capabilities in a vfs format in an ncurses/text environment.

            Meh... I never did like midnight commander... never could get the hang
            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
            install scripts.

            File Roller is just... the tool of the devil. Devil, I say... :)
          Your message has been successfully submitted and would be delivered to recipients shortly.