-->

Previous | Table of Contents | Next

Page 314

21.2.7.3. rpmdbFindByGroup()—Search RPM Database by Group

This function searches the RPM database specified by db for the packages that are members of the group specified by group. It returns matching records in matches:


#include  <rpm/rpmlib.h>

#include  <rpm/dbindex.h>



int rpmdbFindByGroup(rpmdb db,

                     char * group,

                      dbiIndexSet * matches);

This function returns the following status values:

-1—An error occurred while reading a database record.
0—The search completed normally.
1—The search term was not found.

21.2.7.4. rpmdbFindPackage()—Search RPM Database by Package

This function searches the RPM database specified by db for the packages with the package name (not label) specified by name. It returns matching records in matches:


#include  <rpm/rpmlib.h>

#include  <rpm/dbindex.h>



int rpmdbFindPackage(rpmdb db,

                     char * name,

                      dbiIndexSet * matches);

This function returns the following status values:

-1—An error occurred while reading a database record.
0—The search completed normally.
1—The search term was not found.

21.2.7.5. rpmdbFindByProvides()—Search RPM Database by Provides

This function searches the RPM database specified by db for the packages that make available the provides information specified by provides. It returns matching records in matches:


#include  <rpm/rpmlib.h>

#include  <rpm/dbindex.h>



int rpmdbFindByProvides(rpmdb db,

                        char * provides,

                        dbiIndexSet * matches);



Page 315

This function returns the following status values:

-1—An error occurred while reading a database record.
0—The search completed normally.
1—The search term was not found.

21.2.7.6. rpmdbFindByRequiredBy()—Search RPM Database by Requires

This function searches the RPM database specified by db for the packages that need the requires information specified by requires. It returns matching records in matches:


#include  <rpm/rpmlib.h>

#include  <rpm/dbindex.h>



int rpmdbFindByRequiredBy(rpmdb db,

                          char * requires,

                          dbiIndexSet * matches);

This function returns the following status values:

-1—An error occurred while reading a database record.
0—The search completed normally.
1—The search term was not found.

21.2.7.7. rpmdbFindByConflicts()—Search RPM Database by Conflicts

This function searches the RPM database specified by db for the packages that conflict with the conflicts information specified by conflicts. It returns matching records in matches:


#include  <rpm/rpmlib.h>

#include  <rpm/dbindex.h>



int rpmdbFindByConflicts(rpmdb db,

                         char * conflicts,

                         dbiIndexSet * matches);

This function returns the following status values:

-1—An error occurred while reading a database record.
0—The search completed normally.
1—The search term was not found.

21.2.8. Package Manipulation

The functions described in this section perform the operations most RPM users are familiar with. Functions that install and erase packages are here, along with a few related, lower-level support functions.

Page 316

21.2.8.1. rpmInstallSourcePackage()—Install Source Package File

This function installs the source package file specified by fd:


#include <rpm/rpmlib.h>



int  rpmInstallSourcePackage(char * root,

                            int fd,

                             char ** specFile,

                              rpmNotifyFunction notify,

                            char * labelFormat);

If root is not NULL, it is prepended to the variables RPMVAR_SOURCEDIR and RPMVAR_SPECDIR prior to the actual installation. If specFile is not NULL, the complete path and filename of the just-installed spec file are returned.

The notify parameter is used to specify a progress-tracking function that will be called during the installation. See section 21.2.8.3 for more information on this parameter.

The labelFormat parameter can be used to specify how the package label should be formatted. It is used when printing the package label (once the package install is ready to proceed). If labelFormat is NULL, the package label is not printed.

This function returns the following status values:

0—The source package was installed successfully.
1—The source package file contained incorrect magic numbers.
2—Another type of error occurred.

21.2.8.2. rpmInstallPackage()—Install Binary Package File

This function installs the binary package specified by fd:


#include  <rpm/rpmlib.h>



int rpmInstallPackage(char * rootdir,

                      rpmdb db,

                       int fd,

                       char * prefix,

                       int flags,

                        rpmNotifyFunction notify,

                      char * labelFormat,

                       char * netsharedPath);

If a path is specified in rootdir, the package will be installed with that path acting as the root directory. If a path is specified in prefix, it will be used as the prefix for relocatable packages. The RPM database specified by db is updated to reflect the newly installed package.

The flags parameter is used to control the installation behavior. The flags are defined in rpmlib.h and take the form RPMINSTALL_xxx, where xxx is the name of the flag.

Page 317

The following flags are currently defined:

The notify parameter is used to specify a progress-tracking_function that will be called during the installation. See section 21.2.8.3 for more information on this parameter.

The labelFormat parameter can be used to specify how the package label should be formatted. This information is used when printing the package label once the package install is ready to proceed. If labelFormat is NULL, the package label is not printed.

The netsharedPath parameter is used to specify that part of the local filesystem that is shared with other systems. If there is more than one path that is shared, the paths should be separated with a colon.

This function returns the following status values:

0—The binary package was installed successfully.
1—The binary package file contained incorrect magic numbers.
2—Another type of error occurred.

21.2.8.3. rpmNotifyFunction()—Track Package Installation Progress

A function can be passed to rpmInstallSourcePackage or rpmInstallPackage via the notify parameter:


#include  <rpm/rpmlib.h>



typedef void (*rpmNotifyFunction)(const unsigned long amount,

                                 const unsigned long total);



Previous | Table of Contents | Next