NAME
RPM::Database - Access to the RPM database of installed packages
SYNOPSIS
use RPM::Database;
tie %RPM, "RPM::Database" or die "$RPM::err";
for (sort keys %RPM)
{
...
}
DESCRIPTION
The RPM::Database package provides access to the database of installed packages on a system. The database may be accessed as either a tied hash or as a blessed reference to a hash. The keys of the hash represent packages on the system. The order in which they are returned by any of keys
, each
or values
, is determined by the internal database ordering. Unlike the keys in RPM::Header (see RPM::Header), the keys here are in fact case-sensitive.
The return value corresponding to each key is a reference to a RPM::Header object. The header object is marked read-only, as the RPM database is not directly modifiable via this interface.
There are also a number of class methods implemented, which are described in the next section.
USAGE
Creating an Object
An object may be created one of two ways:
tie %D, "RPM::Database";
$dataref = new RPM::Database;
The latter approach offers more direct access to the class methods, while also permitting the usual tied-hash operations such as fetching:
$dataref->{package} # Such as "rpm" or "perl"
Class Methods
The following methods are available to objects of this class, in addition to the tied-hash suite of operations. If the object is a hash instead of a hash reference, it can be used to call these methods via:
(tied %hash)->method_name(...)
- init
-
This causes a complete initialization of the RPM database. It must be run with sufficient permissions to create/update the relevant files. It must also be called as a static method, to avoid having any file descriptors open on the database at the time.
- rebuild
-
This rebuilds the database (same as "rpm --rebuilddb"). As with init above, this requires adequate permissions and must be invoked as a static method.
- FindByFile(file)
-
Returns a list of RPM::Header objects that correspond to the package(s) claiming ownership of the file "file".
- FindByGroup(group)
-
Returns of a list of headers for all packages flagged as being in the group specified.
- FindByProvides(provides)
-
Search as above, but based on which packages provide the file/object specified as "provides".
- FindByRequiredBy(requires)
-
Return a list of headers for the packages that directly depend on the specified package for installation and operation.
- FindByConflicts(conflicts)
-
List those packages that have conflicts based on the value of "conflicts".
- FindByPackage(package)
-
This performs the search by a specific package name. This is the API call used by the FETCH tied-hash method, but this differs in that if there is in fact more than one matching record, all are returned.
DIAGNOSTICS
Direct binding to the internal error-management of rpm is still under development. At present, most operations generate their diagnostics to STDERR.
CAVEATS
This is currently regarded as alpha-quality software. The interface is subject to change in future releases.
SEE ALSO
RPM, RPM::Header, perl, rpm
AUTHOR
Randy J. Ray <rjray@blackperl.com>