RPM(3)

NAME
RPM - Perl bindings for the RPM Package Manager API

SYNOPSIS
  use RPM;

DESCRIPTION
The RPM module provides an object-oriented interface to querying both the installed RPM database as well as files on the filesystem.

FUNCTIONS

  installsrpm($filename)
Install a source rpm and return spec file path and its cookies. Returns undef if install is impossible.

see RPM::Spec->new() for more information about cookies.

  GENERICS FUNCTIONS
rpmversion

Return the rpm version which is also the module version:

    RPM::rpmversion(); # return 5.0.DEVEL currently ;)

  MACROS FUNCTIONS
expand_macro($string)

Return the string after macros expansion:

    expand_macro('%_dbpath'); # will return '/var/lib/rpm' on most system,
                              # depending of your config
    expand_macro('%{?_dbpath:is set}'); # will return is set, normally... :)

add_macro($string)

Set or overide a macro, the format to use is the macro name (w/o %) follow by its definition:

    add_macro('_anymacros anyvalue');
    print expand_macro('%_anymacros'); # show 'anyvalue'

delete_macro($macro)

Delete a macro definition:

    delete_macro('_anymacros');

dump_macros($handle)

Dump macros all macros currently defined into $handle. If $handle is missing, STDOUT is used.

load_macro_file($file)

Load a macro file.

reset_macros

Reset all macros to default config (aka from rpm configuration).

  PLATFORM FUNCTIONS
setverbosity($verbosity)

Set the global verbosity of rpmlib.

rpmvercmp($verA, $verB)

Compare two version (or release, not both) and return:
  * -1 verA < verB
  * 0 verA = verB
  * 1 verA > verB

    rpmvercmp('1', '1.1'); # return 1
    # This works but will not give the expected result:
    rpmvercmp('1-1', '1.1-2') # return -1

platformscore($platform)

Return the score of platform according your rpm configuration, 0 if not compatible.

    # on x86_64 under Mandriva Linux:
    platformscore("i586-mandriva-linux-gnu");
    # return 8 here
    platformscore("ppc-mandriva-linux-gnu");
    # return 0

  LOG AND VERBOSITY FUNCTIONS
lastlogmsg

Return the last message give by rpm. In array context return both the erreur level and message:

    my $message = rpmlog();
    my ($code, $message) = rpmlog();

rpmlog($err_level, $message)

Log a message using rpm API.

setlogcallback

DEPRECATED ?

setlogfile

DEPRECATED ?

TODO
Make package installation and removal better (-;.

Signature validation.

  resign Resign a package.

HISTORY

0.5 Massive Rework:

0.01
    Initial release

AUTHOR
Olivier Thauvin <nanardon@rpm5.org>

Original author:

Chip Turner <cturner@redhat.com>

SEE ALSO
perl. RPM::Header RPM::PackageIterator RPM::Transaction RPM::Constant RPM::Files RPM::Dependencies