Perl-RPM

Version 0.40 (alpha thirteen)

What Is It?

The Perl-RPM package is an attempt at native Perl-level bindings for the RPM Package Manager, versions 3.0.X and 4.0. It has been developed and tested against version 3.0.4 from the Red Hat Linux 6.2 distribution, version 3.0.5 from the RPM.org home page, and version 4.0 from the Red Hat Linux 7 distribution. While being developed in a modular fashion, the goal is to implement the full C-level API in a series of Perl classes.

Effective with the 0.40 release, this package will no longer attempt to maintain support for versions of rpm prior to 4.0.4. Also, provided rpm packages will only support Red Hat Linux 7 (and later). Full source is still provided for systems not directly supported, of course.

Example Usage

The initial code released implements access to the package database maintained by RPM and access to the headers stored either in the database or in disk files that haven't yet been installed. Both of these classes are implemented as tied hashes. In the case of the database, this means that individual packages are referenced by their (case-sensitive) name as keys on the hash table:

      use RPM::Database;

      tie %RPMdb, "RPM::Database" or die "$RPM::err";
      $hdr = $RPMdb{XFree86};
      ...
    

In the case of headers themselves, they can either be instantiated directly from a file:

      use RPM::Header;

      tie %HDR, "RPM::Header", "bash2-2.03-8.i386.rpm" or die "$RPM::err";
      printf "%s-%s-%s", map { $HDR{$_} } qw(name version release);
      ...
    

Or, as may be the more common case, as hash references returned from a key on a hash tied to the RPM::Database class:

      use RPM::Database '%RPM';

      $hdr = $RPM{XFree86};

      printf "%s-%s-%s", map { $hdr->{$_} } qw(name version release);
      ...
    

Note that in this second example, the hash tied to the database was imported from the RPM::Database module directly.

Within an object instantiated from RPM::Header, all defined RPM header tags present in the actual header itself may be retrieved from the object as keys, in a case-insensitive manner (any time key names are returned, i.e. from keys, they are returned as all-uppercase).

Getting the Software

This package is available via the Comprehensive Perl Archive Network, at CPAN, indexed by my CPAN user-id, RJRAY. You may go directly to the package via this link:

http://search.cpan.org/search?dist=Perl-RPM

This will always refer to the latest version CPAN has available.

System Requirements

This extension makes heavy usage of Perl-to-C glue via the XS layer of Perl 5. To build it, you will need to have a version of Perl at least as current as 5.6.0, with access to an ANSI-compliant C compiler.

Perl-RPM Mailing List

There is now a mailing list for the Perl-RPM package, hosted at redhat.com. Information on the list and instructions for subscribing may be found at:

https://listman.redhat.com/mailman/listinfo/perl-rpm-list

The list is currently very low-traffic. Topics discussed include design issues as the package itself matures, general usage and application.

Effective with version 0.291, Perl-RPM has the ability to create RPM and SRPM packages of itself.

Perl-RPM-0.40-5.6.1.i386.rpm
Perl-RPM-0.40-5.6.1.src.rpm
Perl-RPM-0.40-5.6.0.i386.rpm
Perl-RPM-0.40-5.6.0.src.rpm

Note that the files with "5.6.1" in the release field are for Perl version 5.6.1, while the ones with "5.6.0" are for Perl 5.6.0.

Other Documentation

The main manual page
The RPM::Constants manual page
The RPM::Header manual page
The RPM::Database manual page
The RPM::Error manual page
 
The README file
 
The ChangeLog file