|
rpm 6.1.90
The RPM Package Manager
|
How to manipulate package headers (which carries all information about a package). More...

Files | |
| file | header.h |
| file | rpmlib.h |
Enumerations | |
| enum | hMagic { HEADER_MAGIC_NO = 0 , HEADER_MAGIC_YES = 1 } |
| enum | headerGetFlags_e { HEADERGET_DEFAULT = 0 , HEADERGET_MINMEM = (1 << 0) , HEADERGET_EXT = (1 << 1) , HEADERGET_RAW = (1 << 2) , HEADERGET_ALLOC = (1 << 3) , HEADERGET_ARGV = (1 << 4) } |
| enum | rpmTagType_e { RPM_NULL_TYPE = 0 , RPM_CHAR_TYPE = 1 , RPM_INT8_TYPE = 2 , RPM_INT16_TYPE = 3 , RPM_INT32_TYPE = 4 , RPM_INT64_TYPE = 5 , RPM_STRING_TYPE = 6 , RPM_BIN_TYPE = 7 , RPM_STRING_ARRAY_TYPE = 8 , RPM_I18NSTRING_TYPE = 9 } |
| enum | rpmTagReturnType_e { RPM_ANY_RETURN_TYPE = 0 , RPM_SCALAR_RETURN_TYPE = 0x00010000 , RPM_ARRAY_RETURN_TYPE = 0x00020000 , RPM_MAPPING_RETURN_TYPE } |
Functions | |
| RPM_PUBLIC_API Header | headerNew (void) |
| RPM_PUBLIC_API Header | headerFree (Header h) |
| RPM_PUBLIC_API Header | headerLink (Header h) |
| RPM_PUBLIC_API unsigned int | headerSizeof (Header h, int magicp) |
| RPM_PUBLIC_API void * | headerExport (Header h, unsigned int *bsize) |
| RPM_PUBLIC_API Header | headerReload (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API Header | headerCopy (Header h) |
| RPM_PUBLIC_API Header | headerImport (void *blob, unsigned int bsize, headerImportFlags flags) |
| RPM_PUBLIC_API Header | headerRead (FD_t fd, int magicp) |
| RPM_PUBLIC_API int | headerWrite (FD_t fd, Header h, int magicp) |
| RPM_PUBLIC_API int | headerIsEntry (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API int | headerGet (Header h, rpmTagVal tag, rpmtd td, headerGetFlags flags) |
| RPM_PUBLIC_API int | headerPut (Header h, rpmtd td, headerPutFlags flags) |
| RPM_PUBLIC_API int | headerAddI18NString (Header h, rpmTagVal tag, const char *string, const char *lang) |
| RPM_PUBLIC_API int | headerMod (Header h, rpmtd td) |
| RPM_PUBLIC_API int | headerDel (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API char * | headerFormat (Header h, const char *fmt, errmsg_t *errmsg) |
| RPM_PUBLIC_API void | headerCopyTags (Header headerFrom, Header headerTo, const rpmTagVal *tagstocopy) |
| RPM_PUBLIC_API HeaderIterator | headerFreeIterator (HeaderIterator hi) |
| RPM_PUBLIC_API HeaderIterator | headerInitIterator (Header h) |
| RPM_PUBLIC_API int | headerNext (HeaderIterator hi, rpmtd td) |
| RPM_PUBLIC_API rpmTagVal | headerNextTag (HeaderIterator hi) |
| RPM_PUBLIC_API char * | headerGetAsString (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API const char * | headerGetString (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API uint64_t | headerGetNumber (Header h, rpmTagVal tag) |
| RPM_PUBLIC_API int | headerIsSource (Header h) |
| RPM_PUBLIC_API unsigned int | headerGetInstance (Header h) |
| RPM_PUBLIC_API int | headerConvert (Header h, int op) |
Variables | |
| RPM_PUBLIC_API const unsigned char | rpm_header_magic [8] |
| RPM_PUBLIC_API int | headerPutBin (Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutString (Header h, rpmTagVal tag, const char *val) |
| RPM_PUBLIC_API int | headerPutStringArray (Header h, rpmTagVal tag, const char **val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutChar (Header h, rpmTagVal tag, const char *val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutUint8 (Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutUint16 (Header h, rpmTagVal tag, const uint16_t *val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutUint32 (Header h, rpmTagVal tag, const uint32_t *val, rpm_count_t size) |
| RPM_PUBLIC_API int | headerPutUint64 (Header h, rpmTagVal tag, const uint64_t *val, rpm_count_t size) |
RPMRC | |
| RPM_PUBLIC_API rpmRC | headerCheck (rpmts ts, const void *uh, size_t uc, char **msg) |
| RPM_PUBLIC_API rpmRC | rpmReadHeader (rpmts ts, FD_t fd, Header *hdrp, char **msg) |
| RPM_PUBLIC_API rpmRC | rpmReadPackageFile (rpmts ts, FD_t fd, const char *fn, Header *hdrp) |
How to manipulate package headers (which carries all information about a package).
| enum headerGetFlags_e |
Modifier flags for headerGet() operation. For consistent behavior you'll probably want to use ALLOC to ensure the caller owns the data, but MINMEM is useful for avoiding extra copy of data when you are sure the header wont go away. Most of the time you'll probably want EXT too, but note that extensions tags don't generally honor the other flags, MINMEM, RAW, ALLOC and ARGV are only relevant for non-extension data.
| enum hMagic |
Include calculation for 8 bytes of (magic, 0)?
| enum rpmTagReturnType_e |
| enum rpmTagType_e |
The basic types of data in tags from headers.
| RPM_PUBLIC_API int headerAddI18NString | ( | Header | h, |
| rpmTagVal | tag, | ||
| const char * | string, | ||
| const char * | lang ) |
Add locale specific tag to header. A NULL lang is interpreted as the C locale. Here are the rules:
* - If the tag isn't in the header, it's added with the passed string * as new value. * - If the tag occurs multiple times in entry, which tag is affected * by the operation is undefined. * - If the tag is in the header w/ this language, the entry is * *replaced* (like headerMod()). *
This function is intended to just "do the right thing". If you need more fine grained control use headerPut() and headerMod().
| h | header |
| tag | tag |
| string | tag value |
| lang | locale |
Check header consistency, performing headerGetEntry() the hard way.
Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.
| ts | transaction set | |
| uh | unloaded header blob | |
| uc | no. of bytes in blob (or 0 to disable) | |
| [out] | *msg | verification error message (or NULL) |
| RPM_PUBLIC_API int headerConvert | ( | Header | h, |
| int | op ) |
Convert header to/from (legacy) data presentation
| h | header |
| op | one of headerConvOps operations |
Duplicate a header.
| h | header |
| RPM_PUBLIC_API void headerCopyTags | ( | Header | headerFrom, |
| Header | headerTo, | ||
| const rpmTagVal * | tagstocopy ) |
Duplicate tag values from one header into another.
| headerFrom | source header |
| headerTo | destination header |
| tagstocopy | array of tags that are copied |
| RPM_PUBLIC_API int headerDel | ( | Header | h, |
| rpmTagVal | tag ) |
Delete tag in header. Removes all entries of type tag from the header, returns 1 if none were found.
| h | header |
| tag | tag |
| RPM_PUBLIC_API void * headerExport | ( | Header | h, |
| unsigned int * | bsize ) |
Export header to on-disk representation.
| h | header (with pointers) | |
| [out] | bsize | on-disk header blob size in bytes |
| RPM_PUBLIC_API char * headerFormat | ( | Header | h, |
| const char * | fmt, | ||
| errmsg_t * | errmsg ) |
Return output formatted according to given rpm-queryformat(7) string. The returned string must be free()d.
| h | header | |
| fmt | format to use | |
| [out] | errmsg | error message (if any) |
Dereference a header instance.
| h | header |
| RPM_PUBLIC_API HeaderIterator headerFreeIterator | ( | HeaderIterator | hi | ) |
Destroy header tag iterator.
| hi | header tag iterator |
| RPM_PUBLIC_API int headerGet | ( | Header | h, |
| rpmTagVal | tag, | ||
| rpmtd | td, | ||
| headerGetFlags | flags ) |
Retrieve tag value.
| h | header | |
| tag | tag | |
| [out] | td | tag data container |
| flags | retrieval modifier flags |
| RPM_PUBLIC_API char * headerGetAsString | ( | Header | h, |
| rpmTagVal | tag ) |
Return any non-array tag from header, converted to string
| h | header |
| tag | tag to retrieve |
| RPM_PUBLIC_API unsigned int headerGetInstance | ( | Header | h | ) |
Return header instance, ie is the header from rpmdb.
| h | header |
| RPM_PUBLIC_API uint64_t headerGetNumber | ( | Header | h, |
| rpmTagVal | tag ) |
Return a simple number tag (or extension) from header
| h | header |
| tag | tag to retrieve |
| RPM_PUBLIC_API const char * headerGetString | ( | Header | h, |
| rpmTagVal | tag ) |
Return a simple string tag from header
| h | header |
| tag | tag to retrieve |
| RPM_PUBLIC_API Header headerImport | ( | void * | blob, |
| unsigned int | bsize, | ||
| headerImportFlags | flags ) |
Import header to in-memory representation.
| blob | on-disk header blob (i.e. with offsets) |
| bsize | on-disk header blob size in bytes (0 if unknown) |
| flags | flags to control operation |
| RPM_PUBLIC_API HeaderIterator headerInitIterator | ( | Header | h | ) |
Create header tag iterator.
| h | header |
| RPM_PUBLIC_API int headerIsEntry | ( | Header | h, |
| rpmTagVal | tag ) |
Check if tag is in header.
| h | header |
| tag | tag |
| RPM_PUBLIC_API int headerIsSource | ( | Header | h | ) |
Check if header is a source or binary package header
| h | header |
Reference a header instance.
| h | header |
| RPM_PUBLIC_API int headerMod | ( | Header | h, |
| rpmtd | td ) |
Modify tag in header. If there are multiple entries with this tag, the first one gets replaced.
| h | header |
| td | tag data container |
| RPM_PUBLIC_API Header headerNew | ( | void | ) |
Create new (empty) header instance.
| RPM_PUBLIC_API int headerNext | ( | HeaderIterator | hi, |
| rpmtd | td ) |
Return next tag contents from header.
| hi | header tag iterator | |
| [out] | td | tag data container |
| RPM_PUBLIC_API rpmTagVal headerNextTag | ( | HeaderIterator | hi | ) |
Return next tag number from header.
| hi | header tag iterator |
| RPM_PUBLIC_API int headerPut | ( | Header | h, |
| rpmtd | td, | ||
| headerPutFlags | flags ) |
Add or append tag to header.
| h | header |
| td | tag data container |
| flags | flags to control operation |
| RPM_PUBLIC_API int headerPutBin | ( | Header | h, |
| rpmTagVal | tag, | ||
| const uint8_t * | val, | ||
| rpm_count_t | size ) |
Type-safe methods for inserting tag data to header. Tag data type is validated to match the function type, ie things like headerPutUint32(h, RPMTAG_NAME, ...) will return failure. For non-array types size must equal 1, and data is checked to be non-NULL. For array types, add-or-append mode is always used.
headerPutString() can be used on both RPM_STRING_TYPE and RPM_STRING_ARRAY_TYPE (to add a single string into the array) tags, for others the type must match exactly.
These are intended to "do the right thing" in the common case, if you need more fine grained control use headerPut() & friends instead.
| h | header |
| tag | tag to insert |
| val | pointer to value(s) |
| size | number of items in array (1 or larger) |
Read (and load) header from file handle.
| fd | file handle |
| magicp | read (and verify) 8 bytes of (magic, 0)? |
Convert header to on-disk representation, and then reload. This is used to insure that all header data is in one chunk.
| h | header (with pointers) |
| tag | region tag |
| RPM_PUBLIC_API unsigned int headerSizeof | ( | Header | h, |
| int | magicp ) |
Return size of on-disk header representation in bytes.
| h | header |
| magicp | include size of 8 bytes for (magic, 0)? |
Write (with unload) header to file handle.
| fd | file handle |
| h | header |
| magicp | prefix write with 8 bytes of (magic, 0)? |
Return checked and loaded header.
| ts | unused | |
| fd | file handle | |
| [out] | hdrp | address of header (or NULL) |
| [out] | *msg | verification error message (or NULL) |
Return package header from file handle, verifying digests/signatures.
| ts | transaction set | |
| fd | file handle | |
| fn | file name | |
| [out] | hdrp | address of header (or NULL) |
|
extern |
Header magic value