Product SiteDocumentation Site

Working with RPM Files

The RPM2 module provides a top-level object, RPM2, that acts as an entry point into the module. From the RPM2 object, you either open the RPM database, covered in the "Programming with the RPM Database" section, or open an RPM package file, covered here.
The first step in working with an RPM file is to open the file inside a Perl script.

Opening package files

The open_package subroutine opens an RPM package file and returns a header object (an RPM2::Header). The basic syntax follows:
my $header = RPM2->open_package( $filename );
For example:
my $header = RPM2->open_package("jikes-1.14-1-glibc-2.2.i386.rpm");
After you’ve opened a package, you can perform a number of query operations on the header object returned by the open_package subroutine.