# lib/rpmlib.h File Reference

In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not. More...

`#include <rpmtag.h>`
`#include <rpmversion.h>`

Include dependency graph for rpmlib.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | rpmRelocation_s

## Defines

#define | RPM_FORMAT_VERSION 5
#define | RPM_MAJOR_VERSION 0
#define | RPM_MINOR_VERSION 0
#define | RPMAL_NOMATCH ((alKey)-1L)

## Typedefs

typedef enum rpmRC_e | rpmRC
| Package read return codes.
typedef struct rpmts_s * | rpmts
| The RPM Transaction Set.
typedef struct Spec_s * | Spec
typedef void * | alKey
| An added/available package retrieval key.
typedef int | alNum
| An added/available package retrieval index.
typedef struct rpmds_s * | rpmds
| Dependency tag sets from a header, so that a header can be discarded early.
typedef struct rpmPRCO_s * | rpmPRCO
| Container for commonly extracted dependency set(s).
typedef struct rpmfi_s * | rpmfi
| File info tag sets from a header, so that a header can be discarded early.
typedef struct rpmte_s * | rpmte
| An element of a transaction set, i.e.
typedef struct rpmdb_s * | rpmdb
| Database of headers and tag value indices.
typedef struct rpmdbMatchIterator_s * | rpmdbMatchIterator
| Database iterator.
typedef struct rpmgi_s * | rpmgi
| Generalized iterator.
typedef enum rpmScriptID_e | rpmScriptID
| Scriptlet identifiers.
typedef enum rpmScriptState_e | rpmScriptState
| Scriptlet states (when installed).

## Enumerations

enum | rpmRC_e { RPMRC_OK = 0, RPMRC_NOTFOUND = 1, RPMRC_FAIL = 2, RPMRC_NOTTRUSTED = 3, RPMRC_NOKEY = 4 }
| Package read return codes. More...
enum | rpmScriptID_e { RPMSCRIPT_UNKNOWN = 0, RPMSCRIPT_PRETRANS = 1, RPMSCRIPT_TRIGGERPREIN = 2, RPMSCRIPT_PREIN = 3, RPMSCRIPT_POSTIN = 4, RPMSCRIPT_TRIGGERIN = 5, RPMSCRIPT_TRIGGERUN = 6, RPMSCRIPT_PREUN = 7, RPMSCRIPT_POSTUN = 8, RPMSCRIPT_TRIGGERPOSTUN = 9, RPMSCRIPT_POSTTRANS = 10, RPMSCRIPT_VERIFY = 16, RPMSCRIPT_SANITYCHECK = 17, RPMSCRIPT_MAX = 32 }
| Scriptlet identifiers. More...
enum | rpmScriptState_e { RPMSCRIPT_STATE_UNKNOWN = 0, RPMSCRIPT_STATE_EXEC = (1 << 16), RPMSCRIPT_STATE_REAPED = (1 << 17), RPMSCRIPT_STATE_SELINUX = (1 << 24), RPMSCRIPT_STATE_EMULATOR = (1 << 25), RPMSCRIPT_STATE_LUA = (1 << 26) }
| Scriptlet states (when installed). More...

## Variables

struct MacroContext_s * | rpmGlobalMacroContext
struct MacroContext_s * | rpmCLIMacroContext
const char * | RPMVERSION
const char * | rpmNAME
const char * | rpmEVR
int | rpmFLAGS
unsigned int * | keyids
headerSprintfExtension | rpmHeaderFormats
| Table of query format extensions.

## RPMRC

#define | RPM_MACHTABLE_COUNT 4
enum | rpm_machtable_e { RPM_MACHTABLE_INSTARCH = 0, RPM_MACHTABLE_INSTOS = 1, RPM_MACHTABLE_BUILDARCH = 2, RPM_MACHTABLE_BUILDOS = 3 }
| Build and install arch/os table identifiers. More...
void * | platpat
int | nplatpat
int | rpmReadConfigFiles (const char *file, const char *target)
| Read macro configuration file(s) for a target.
int | rpmPlatformScore (const char *platform, void *mi_re, int mi_nre)
| Return score of a platform string.
int | rpmShowRC (FILE *fp)
| Display current rpmrc (and macro) configuration.
void | rpmSetTables (int archTable, int osTable)
void | rpmFreeRpmrc (void)

## RPMTS

typedef struct rpmRelocation_s * | rpmRelocation
| We pass these around as an array with a sentinel.
typedef struct fsmIterator_s * | FSMI_t
| Iterator across package file info, forward on install, backward on erase.
typedef struct fsm_s * | FSM_t
| File state machine data.
typedef struct rpmpsm_s * | rpmpsm
| Package state machine data.
int | rpmVersionCompare (Header first, Header second)
| Compare headers to determine which header is "newer".
rpmRC | rpmReadPackageFile (rpmts ts, void *_fd, const char *fn, Header *hdrp)
| Return package header from file handle, verifying digests/signatures.
rpmRC | rpmInstallSourcePackage (rpmts ts, void *_fd, const char **specFilePtr, const char **cookie)
| Install source package.

## Detailed Description

In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.

Definition in file rpmlib.h.

## Define Documentation

#define RPM_FORMAT_VERSION 5

Definition at line 14 of file rpmlib.h.

#define RPM_MACHTABLE_COUNT 4

No. of arch/os tables.

Definition at line 175 of file rpmlib.h.

Referenced by rpmFreeRpmrc().

#define RPM_MAJOR_VERSION 0

Definition at line 15 of file rpmlib.h.

#define RPM_MINOR_VERSION 0

Definition at line 16 of file rpmlib.h.

#define RPMAL_NOMATCH ((alKey)-1L)

Definition at line 72 of file rpmlib.h.

Referenced by addRelation(), init_rpm(), rpmalAdd(), rpmalAllFileSatisfiesDepend(), rpmalAllSatisfiesDepend(), rpmteAddedKey(), rpmteSetAddedKey(), rpmtsAddEraseElement(), rpmtsAddInstallElement(), and rpmtsOrder().

## Typedef Documentation

typedef enum rpmRC_e rpmRC

Package read return codes.

typedef struct rpmRelocation_s* rpmRelocation

We pass these around as an array with a sentinel.

Definition at line 246 of file rpmlib.h.

typedef enum rpmScriptID_e rpmScriptID

Scriptlet identifiers.

typedef enum rpmScriptState_e rpmScriptState

Scriptlet states (when installed).

## Enumeration Type Documentation

enum rpmRC_e

Package read return codes.

Enumerator:

  RPMRC_OK | Generic success code
  RPMRC_NOTFOUND | Generic not found code.
  RPMRC_FAIL | Generic failure code.
  RPMRC_NOTTRUSTED | Signature is OK, but key is not trusted.
  RPMRC_NOKEY | Public key is unavailable.

Definition at line 21 of file rpmlib.h.

enum rpmScriptID_e

Scriptlet identifiers.

Enumerator:

  RPMSCRIPT_UNKNOWN | unknown scriptlet
  RPMSCRIPT_PRETRANS | pretrans scriptlet
  RPMSCRIPT_TRIGGERPREIN | triggerprein scriptlet
  RPMSCRIPT_PREIN | pre scriptlet
  RPMSCRIPT_POSTIN | post scriptlet
  RPMSCRIPT_TRIGGERIN | triggerin scriptlet
  RPMSCRIPT_TRIGGERUN | triggerun scriptlet
  RPMSCRIPT_PREUN | preun scriptlet
  RPMSCRIPT_POSTUN | postun scriptlet
  RPMSCRIPT_TRIGGERPOSTUN | triggerpostun scriptlet
  RPMSCRIPT_POSTTRANS | posttrans scriptlet
  RPMSCRIPT_VERIFY | verify scriptlet
  RPMSCRIPT_SANITYCHECK | sanitycheck scriptlet
  RPMSCRIPT_MAX |

Definition at line 128 of file rpmlib.h.

enum rpmScriptState_e

Scriptlet states (when installed).

Enumerator:

  RPMSCRIPT_STATE_UNKNOWN |
  RPMSCRIPT_STATE_EXEC | scriptlet was exec'd
  RPMSCRIPT_STATE_REAPED | scriptlet was reaped
  RPMSCRIPT_STATE_SELINUX | scriptlet exec by SELinux
  RPMSCRIPT_STATE_EMULATOR | scriptlet exec in emulator
  RPMSCRIPT_STATE_LUA | scriptlet exec with lua

Definition at line 149 of file rpmlib.h.

## Function Documentation

rpmRC rpmInstallSourcePackage | ( | rpmts | ts,
|  | void * | _fd,
|  | const char ** | specFilePtr,
|  | const char ** | cookie |
| ) |  |  |

Install source package.

Deprecated:
  This routine needs to DIE! DIE! DIE!.

Todo:
  Eliminate in rpm-5.1, insturment rpmtsRun() state machine instead.

Parameters:

  | ts | transaction set
  | _fd | file handle

Return values:

  | specFilePtr | address of spec file name (or NULL)
  | cookie | address of cookie pointer (or NULL)

Returns:
  rpmRC return code

Definition at line 184 of file psm.c.

References _, _free(), Access(), alloca(), rpmDataType_u::argv, CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, FA_CREATE, Fclose(), fdLink, headerFree(), headerGet(), headerIsEntry(), headerLink(), headerMacrosLoad(), _HE_s::p, PSM_FINI, PSM_PKGINSTALL, PSM_PROCESS, rpmExpand(), rpmfiFree(), RPMFILE_SPECFILE, rpmfiLink, rpmfiNew(), rpmGenPath(), rpmlog(), RPMLOG_ERR, rpmMkdirPath(), rpmpsmStage(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), rpmteSetHeader(), rpmtsAddInstallElement(), rpmtsClean(), rpmtsElement(), rpmtsFree(), rpmtsLink, rpmtsRootDir(), stpcpy(), rpmDataType_u::str, _HE_s::tag, W_OK, and xmalloc().

Referenced by rpmInstallSource().

rpmRC rpmReadPackageFile | ( | rpmts | ts,
|  | void * | _fd,
|  | const char * | fn,
|  | Header * | hdrp |
| ) |  |  |

Return package header from file handle, verifying digests/signatures.

Parameters:

  | ts | transaction set
  | _fd | file handle
  | fn | file name

Return values:

  | hdrp | address of header (or NULL)

Returns:
  RPMRC_OK on success

Todo:
  Implement disable/enable/warn/error/anal policy.

Definition at line 80 of file package.c.

References _, _chk, _free(), _print_pkts, alloca(), _HE_s::c, rpmop_s::count, fdInitDigest(), fdSetDig(), fdstat_op(), FDSTAT_READ, fdStealDigest(), Fileno(), Fread(), Fstrerror(), headerFree(), headerGet(), headerGetMagic(), headerIsEntry(), headerLink(), headerMergeLegacySigs(), _HE_s::p, pgpDigVSFlags, PGPHASHALGO_MD5, PGPHASHALGO_SHA1, pgpPrtPkts(), pgpSetSig(), pgpStashKeyid(), pgpStatsAccumulator(), rpmDataType_u::ptr, RPMDIGEST_NONE, rpmDigestInit(), rpmDigestUpdate(), rpmIsDebug, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmpkgRead(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, rpmswAdd(), rpmswEnter(), rpmswExit(), rpmswSub(), RPMTAG_HEADERIMMUTABLE, RPMTS_OP_DIGEST, RPMTS_OP_READHDR, rpmtsCleanDig(), rpmtsDig(), rpmtsOp(), rpmVerifySignature(), RPMVSF_NEEDPAYLOAD, RPMVSF_NODSAHEADER, RPMVSF_NOMD5, RPMVSF_NORSAHEADER, RPMVSF_NOSHA1HEADER, _FD_s::stats, _HE_s::t, and _HE_s::tag.

Referenced by IDTXglob(), rpmgiReadHeader(), rpmInstallSourcePackage(), rpmts_HdrFromFdno(), rpmtsRun(), and rpmtsSolve().

int rpmVersionCompare | ( | Header | first,
|  | Header | second |
| ) |  |  |

Compare headers to determine which header is "newer".

Deprecated:
  Use rpmdsCompare instead.

Todo:
  Eliminate in rpm-5.1.

Parameters:

  | first | 1st header
  | second | 2nd header

Returns:
  result of comparison

Definition at line 54 of file psm.c.

References _free(), alloca(), headerGet(), _HE_s::p, rpmDataType_u::ptr, rpmvercmp, rpmDataType_u::str, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by hdr_compare(), and rpmcliInstall().

## Variable Documentation

unsigned int* keyids

Definition at line 38 of file package.c.

Referenced by pgpStashKeyid(), and rpmcliFini().

int nplatpat

Definition at line 31 of file rpmrc.c.

Referenced by rpmFreeRpmrc(), rpmPlatform(), rpmPlatformScore(), and rpmtsAddInstallElement().

void* platpat

Definition at line 29 of file rpmrc.c.

Referenced by rpmFreeRpmrc(), rpmPlatform(), rpmPlatformScore(), and rpmtsAddInstallElement().

struct MacroContext_s* rpmCLIMacroContext

Definition at line 93 of file macro.c.

Referenced by rpmcliAllArgCallback(), rpmcliFini(), and rpmInitMacros().

const char* rpmEVR

Definition at line 58 of file depends.c.

Referenced by printVersion().

int rpmFLAGS

Definition at line 61 of file depends.c.

struct MacroContext_s* rpmGlobalMacroContext

Definition at line 88 of file macro.c.

Referenced by addMacro(), delMacro(), expandMacros(), findEntry(), newSpec(), rpmDefineMacro(), rpmDumpMacroTable(), rpmFreeMacros(), rpmGetMacroEntries(), rpmInitMacros(), rpmLoadMacros(), and rpmUndefineMacro().

headerSprintfExtension rpmHeaderFormats

Table of query format extensions.

Note:
  Chains *headerCompoundFormats -> *headerDefaultFormats.

Definition at line 292 of file formats.c.

Referenced by hdr_subscript(), hdrSprintf(), init_rpm(), packageBinaries(), parseForSimple(), printNewSpecfile(), queryHeader(), rpmcliImportPubkey(), rpmfiNew(), rpmpsmStage(), rpmShowProgress(), rpmtsImportPubkey(), and rpmtsSolve().

const char* rpmNAME

Definition at line 55 of file depends.c.

const char* RPMVERSION

Definition at line 8 of file misc.c.

Referenced by rpmcliImportPubkey(), and rpmtsImportPubkey().