RPM - Perl interface to the API for the RPM Package Manager
The Perl-RPM package is an extension for natively linking the functionality of the RPM Package Manager with the extension facility of Perl. The aim is to offer all the functionality made available via the C API in the form of Perl object classes.
At present, the package-manipulation functionality is not yet implemented. The RPM::Database and RPM::Header packages do provide access to the information contained within the database of installed packages, and individual package headers, respectively. The RPM::Error package is available, which provides support routines for signaling and catching errors. Additionally, there is the RPM::Constants package which provides a number of values from the rpm library, referred to by the same name used at the C level.
The following utility functions are exported by default from RPM:
Returns the text name of the O/S, as derived from the rpm configuration files. This is the O/S token that rpm will use to refer to the running system.
As above, but returns the architecture string instead. Again, this may not directly match the running system, but rather is the value that rpm is using. rpm will use the lowest-matching architecture whenever possible, for maximum cross-platform compatibility.
Returns the current version of RPM that the library is linked against. The value is a string of the form
The following utility function may be explicitly requested via use or import:
- vercmp($verA, $relA, $verB, $relB)
Allows RPM-style comparison of version/release pairs without having the full RPM::Header objects in memory. This enables programs to compare versions without having to worry about how RPM handles the mixture of alphanumeric cases that are supported internally. The return value is -1, 0 or 1, as with any comparison operator. This is purposefully named differently from the cmpver method in RPM::Header so as to avoid confusion.
- evrcmp($A, $B)
vercmp, but takes into account the Epoch along with Version/Release. Each of
$Bmust be either
When an error occurs in either the C-level rpm library or internally within these libraries, it is made available via a special dual-nature variable $RPM::err. When evaluated in a numeric context, it returns the integer code value of the error. When taken in a string context, it returns the text message associated with the error. This is intended to closely mimic the behavior of the special Perl variable "
This is currently regarded as alpha-quality software. The interface is subject to change in future releases.
Randy J. Ray <firstname.lastname@example.org>, Alexey Tourbin <email@example.com>.