-->
Page 314
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:
-1An error occurred while reading a database record.
0The search completed normally.
1The search term was not found.
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:
-1An error occurred while reading a database record.
0The search completed normally.
1The search term was not found.
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:
-1An error occurred while reading a database record.
0The search completed normally.
1The search term was not found.
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:
-1An error occurred while reading a database record.
0The search completed normally.
1The search term was not found.
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:
-1An error occurred while reading a database record.
0The search completed normally.
1The search term was not found.
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
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:
0The source package was installed successfully.
1The source package file contained incorrect magic numbers.
2Another type of error occurred.
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:
0The binary package was installed successfully.
1The binary package file contained incorrect magic numbers.
2Another type of error occurred.
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);