Thierry Vignaud > RPM4-0.31 > RPM4

Download:
RPM4-0.31.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.31   Source   Latest Release: RPM4-0.33

NAME ^

RPM4 - perl module to access and manipulate RPM files

SYNOPSIS ^

DESCRIPTION ^

This module allow to use API functions from rpmlib, directly or trough perl objects.

FUNCTIONS ^

readconfig($rpmrc, $target)

Force rpmlib to re-read configuration files. If defined, $rpmrc is read. If $target is defined, rpmlib will read config for this target. $target has the form "CPU-VENDOR-OS".

    readconfig(); # Reread default configuration
    readconfig(undef, "i386-mandrake-linux"); # Read configuration for i386

setverbosity($level)

Set the rpmlib verbosity level. $level can be an integer (0 to 7) or a verbosity level name.

  - EMERG    (0)
  - ALERT    (1)
  - CRIT     (2)
  - ERR      (3)
  - WARNING  (4)
  - NOTICE   (5)
  - INFO     (6)
  - DEBUG    (7)

setlogcallback(sub {})

Set a perl callback code for rpm logging/output system. When the callback is set, rpm lets your code print error/information messages. The parameter passed to the callback is a hash with log value: locode => the rpm log code (integer), priority => priority of the message (0 to 7), msg => the formated string message.

To unset the callback function, passed an undef value as code reference.

Ex: setlogcallback( sub { my %log = @_; print "$log{priority}: $log{msg}\n"; });

setlogfile(filename)

Redirect all rpm message into this file. Data will be append to the end of the file, the file is created if it don't already exists. The old loging file is close.

To unset (and close) a pending loging file, passed an undef value.

lastlogmsg

Return an array about latest rpm log message information: - rpm log code, - rpm priority (0 to 7), - string message.

rpmlog($codelevel, $msg)

Send a message trougth the rpmlib logging system. - $codelevel is either an integer value between 0 and 7, or a level code string, see setverbosity(), - $msg is the message to send.

format_rpmpb(@pb)

Some functions return an array of rpm transaction problem (RPM4::Db->transpb()), this function return an array of human readable string for each problem.

querytag

Returns a hash containing the tags known by rpmlib. The hash has the form TAGNAME = tagvalue >. Note that some tags are virtual and do not have any tag value, and that some tags are alias to already existing tags, so they have the same value.

tagtypevalue($tagtypename)

Return the type value of a tag type. $tagtypename can be CHAR, INT8, INT16 INT32, STRING, ARRAY_STRING or I18NSTRING. This return value is usefull with RPM4::Header::addtag() function.

tagName($tagvalue)

Returns the tag name for a given internal value.

    tagName(1000); return "NAME".

See: tagValue.

tagValue($tagname)

Returns the internal tag value for $tagname.

    tagValue("NAME"); return 1000.

See: tagName.

expand($string)

Evaluate macros contained in $string, like rpm --eval.

    expand("%_var") return "/var".

addmacro("_macro value")

Define a macro into rpmlib. The macro is defined for the whole script. Ex: addmacro("_macro value"). Note that the macro name does have the prefix "%", to prevent rpm from evaluating it.

del_macro("_macro")

Delete a macro from rpmlib. Exactly the reverse of addmacro().

loadmacrosfile($filename)

Read a macro configuration file and load macros defined within. Unfortunately, the function returns nothing, even when file loading failed.

To reset macros loaded from file you have to re-read the rpm config file with readconfig.

resetmacros

Reset all macros defined with add_macro() functions.

This function does not reset macros loaded with loadmacrosfile().

getosname

Returns the operating system name of current rpm configuration. Rpmlib auto-detects the system name, but you can force rpm to use another system name with macros or using readconfig().

getarchname

Returns the arch name of current rpm configuration. Rpmlib auto-detects the architecture, but you can force rpm to use another architecture with macros or by using readconfig().

buildhost

Returns the BuildHost name of the current system, ie the value rpm will use to set BuilHost tag in built rpm.

dumprc(*FILE)

Dump rpm configuration into file handle. Ex: dumprc(*STDOUT);

dumpmacros(*FILE)

Dump rpm macros into file handle. Ex: dumpmacros(*STDOUT);

rpmresign($passphrase, $rpmfile)

Resign a rpm using user settings. $passphrase is the key's gpg/pgp pass phrase.

Return 0 on success.

rpmvercmp(version1, version2)

Compare two version and return 1 if left argument is highter, -1 if rigth argument is highter, 0 if equal. Ex: rpmvercmp("1.1mdk", "2.1mdk"); # return -1.

compare_evr(version1, version2)

COmpare two rpm version in forms [epoch:]version[-release] and return 1 if left argument is highter, -1 if rigth argument is highter, 0 if equal. Ex: compare_evr("1:1-1mdk", "2-2mdk"); # return 1

installsrpm($filename)

Install a source rpm and return spec file path and its cookies. Returns undef if install is impossible.

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

rpmdbinit(rootdir, permissions)

Create an empty rpm database located into %{_dbpath} (useally /var/lib/rpm). If set, rootdir is the root directory of system where rpm db should be create, if set, theses permissions will be applied to files, default is 0644.

Directory %{_dbpath} should exist.

Returns 0 on success.

Ex: rpmdbinit(); # Create rpm database on the system rpmdbinit("/chroot"); # Create rpm database for system located into /chroot.

rpmdbverify($rootdir)

Verify rpm database located into %{_dbpath} (useally /var/lib/rpm). If set, $rootdir is root directory of system to check.

Returns 0 on success.

rpmdbrebuild($rootdir)

Rebuild the rpm database located into %{_dbpath} (useally /var/lib/rpm). If set, $rootdir is the root directory of system.

Returns 0 on success.

rpmlibdep()

Create a RPM4::Header::Dependencies object about rpmlib internals provides

SEE ALSO ^

rpm(8),

This aims at replacing part of the functionality provided by URPM.

syntax highlighting: