Product SiteDocumentation Site

A shortcut to header information

You can read in a Header using the shortcut utility method rpmReadPackageFile:
int rpmReadPackageFile(rpmts ts,
FD_t fd,
const char *filename,
Header *header);
You need to pass a transaction set to rpmReadPackageFile and an open file. The filename is just used for reporting errors. On success, rpmReadPackageFile fills in a Header object from the package file. The return value is 0 for success.
To get the necessary transaction set, you need to create one with rpmtsCreate, covered in the "Programming with the RPM Database" section, following.
In most cases, you should call rpmReadPackageFile in place of readLead, rpmReadSignature, and headerRead, since rpmReadPackageFile also verifies the package integrity.