# lib/psm.h File Reference

Package state machine to handle a package from a transaction set. More...

`#include "fsm.h"`
`#include "depends.h"`

Go to the source code of this file.

## Data Structures

struct | sharedFileInfo
struct | transactionFileInfo_s
struct | psm_s

## Defines

#define | TFIMAGIC 0x09697923
#define | PSM_VERBOSE 0x8000
#define | PSM_INTERNAL 0x4000
#define | PSM_SYSCALL 0x2000
#define | PSM_DEAD 0x1000
#define | _fv(_a) ((_a) | PSM_VERBOSE)
#define | _fi(_a) ((_a) | PSM_INTERNAL)
#define | _fs(_a) ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
#define | _fd(_a) ((_a) | (PSM_INTERNAL | PSM_DEAD))

## Typedefs

typedef enum pkgStage_e | pkgStage

## Enumerations

enum

pkgStage_e {
PSM_UNKNOWN = 0, PSM_INIT = 1, PSM_PRE = 2, PSM_PROCESS = 3,
PSM_POST = 4, PSM_UNDO = 5, PSM_FINI = 6, PSM_PKGINSTALL = 7,
PSM_PKGERASE = 8, PSM_PKGCOMMIT = 10, PSM_PKGSAVE = 12, PSM_CREATE = 17,
PSM_NOTIFY = 22, PSM_DESTROY = 23, PSM_COMMIT = 25, PSM_CHROOT_IN = 51,
PSM_CHROOT_OUT = 52, PSM_SCRIPT = 53, PSM_TRIGGERS = 54, PSM_IMMED_TRIGGERS = 55,
PSM_RPMIO_FLAGS = 56, PSM_RPMDB_LOAD = 97, PSM_RPMDB_ADD = 98, PSM_RPMDB_REMOVE = 99
}

## Functions

void | loadFi (Header h, TFI_t fi)
| Load data from header into transaction file element info.
void | freeFi (TFI_t fi)
| Destroy transaction element file info.
const char *const | fiTypeString (TFI_t fi)
| Return formatted string representation of package disposition.
int | psmStage (PSM_t psm, pkgStage stage)
| Package state machine driver.

## Detailed Description

Package state machine to handle a package from a transaction set.

Definition in file psm.h.

## Define Documentation

#define _fd | ( | _a |  | ) | ((_a) | (PSM_INTERNAL | PSM_DEAD))

| Definition at line 119 of file psm.h.

#define _fi | ( | _a |  | ) | ((_a) | PSM_INTERNAL)

| Definition at line 117 of file psm.h.

#define _fs | ( | _a |  | ) | ((_a) | (PSM_INTERNAL | PSM_SYSCALL))

| Definition at line 118 of file psm.h.

#define _fv | ( | _a |  | ) | ((_a) | PSM_VERBOSE)

| Definition at line 116 of file psm.h.

#define PSM_DEAD 0x1000

| Definition at line 115 of file psm.h.

#define PSM_INTERNAL 0x4000

| Definition at line 113 of file psm.h.

#define PSM_SYSCALL 0x2000

| Definition at line 114 of file psm.h.

#define PSM_VERBOSE 0x8000

| Definition at line 112 of file psm.h.

#define TFIMAGIC 0x09697923

| Definition at line 94 of file psm.h. Referenced by rpmVerifyScript().

## Typedef Documentation

typedef enum pkgStage_e pkgStage

## Enumeration Type Documentation

enum pkgStage_e

Enumerator:

  PSM_UNKNOWN |
  PSM_INIT |
  PSM_PRE |
  PSM_PROCESS |
  PSM_POST |
  PSM_UNDO |
  PSM_FINI |
  PSM_PKGINSTALL |
  PSM_PKGERASE |
  PSM_PKGCOMMIT |
  PSM_PKGSAVE |
  PSM_CREATE |
  PSM_NOTIFY |
  PSM_DESTROY |
  PSM_COMMIT |
  PSM_CHROOT_IN |
  PSM_CHROOT_OUT |
  PSM_SCRIPT |
  PSM_TRIGGERS |
  PSM_IMMED_TRIGGERS |
  PSM_RPMIO_FLAGS |
  PSM_RPMDB_LOAD |
  PSM_RPMDB_ADD |
  PSM_RPMDB_REMOVE |

Definition at line 120 of file psm.h.

## Function Documentation

const char* const fiTypeString | ( | TFI_t | fi | ) |

Return formatted string representation of package disposition.

Parameters:

  | a | package dispostion

Returns:
  formatted string

Definition at line 235 of file psm.c.

References transactionFileInfo_s::type.

void freeFi | ( | TFI_t | fi | ) |

Destroy transaction element file info.

Parameters:

  | fi | transaction element file info

Definition at line 188 of file psm.c.

References _free(), transactionFileInfo_s::actions, transactionFileInfo_s::apath, transactionFileInfo_s::bnl, transactionFileInfo_s::dil, transactionFileInfo_s::dnl, transactionFileInfo_s::fflags, transactionFileInfo_s::fgids, transactionFileInfo_s::fgroup, transactionFileInfo_s::flangs, transactionFileInfo_s::flinks, transactionFileInfo_s::fmapflags, transactionFileInfo_s::fmd5s, transactionFileInfo_s::fmodes, freeFSM(), transactionFileInfo_s::fsizes, transactionFileInfo_s::fsm, transactionFileInfo_s::fstates, transactionFileInfo_s::fuids, transactionFileInfo_s::fuser, transactionFileInfo_s::h, headerFree(), headerFreeData(), transactionFileInfo_s::hfd, transactionFileInfo_s::name, transactionFileInfo_s::obnl, transactionFileInfo_s::odnl, transactionFileInfo_s::release, transactionFileInfo_s::replaced, transactionFileInfo_s::replacedSizes, transactionFileInfo_s::type, and transactionFileInfo_s::version.

Referenced by freeFl(), freePackage(), freeSpec(), and rpmVerifyScript().

void loadFi | ( | Header | h,
|  | TFI_t | fi
| ) |

Load data from header into transaction file element info.

Parameters:

  | h | header
  | fi | transaction element file info

Definition at line 72 of file psm.c.

References transactionFileInfo_s::action, transactionFileInfo_s::actions, transactionFileInfo_s::archiveSize, transactionFileInfo_s::bnl, CPIO_ALL_HARDLINKS, CPIO_MAP_ABSOLUTE, CPIO_MAP_ADDDOT, CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, transactionFileInfo_s::dc, transactionFileInfo_s::dil, transactionFileInfo_s::dnl, transactionFileInfo_s::dnlmax, transactionFileInfo_s::epoch, FA_UNKNOWN, transactionFileInfo_s::fc, transactionFileInfo_s::fflags, transactionFileInfo_s::flags, transactionFileInfo_s::flangs, transactionFileInfo_s::flinks, transactionFileInfo_s::fmd5s, transactionFileInfo_s::fmodes, transactionFileInfo_s::fmtimes, transactionFileInfo_s::frdevs, transactionFileInfo_s::fsizes, transactionFileInfo_s::fsm, transactionFileInfo_s::fstates, transactionFileInfo_s::h, transactionFileInfo_s::hae, headerAddEntry(), headerFree(), headerFreeData(), headerGetEntry(), headerGetEntryMinMemory(), headerLink(), headerModifyEntry(), headerRemoveEntry(), transactionFileInfo_s::hfd, transactionFileInfo_s::hge, transactionFileInfo_s::hme, transactionFileInfo_s::hre, transactionFileInfo_s::mapflags, transactionFileInfo_s::name, newFSM(), transactionFileInfo_s::release, transactionFileInfo_s::replacedSizes, RPMTAG_ARCHIVESIZE, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, RPMTAG_EPOCH, RPMTAG_FILEFLAGS, RPMTAG_FILELANGS, RPMTAG_FILELINKTOS, RPMTAG_FILEMD5S, RPMTAG_FILEMODES, RPMTAG_FILEMTIMES, RPMTAG_FILERDEVS, RPMTAG_FILESIZES, RPMTAG_FILESTATES, RPMTAG_NAME, RPMTAG_RELEASE, RPMTAG_VERSION, transactionFileInfo_s::type, transactionFileInfo_s::version, xcalloc(), xmalloc(), and xstrdup().

Referenced by genCpioListAndHeader(), rpmInstallSourcePackage(), and rpmVerifyScript().

int psmStage | ( | PSM_t | psm,
|  | pkgStage | stage
| ) |

Package state machine driver.

Todo:
  Packages w/o files never get a callback, hence don't get displayed on install with -v.

Definition at line 1342 of file psm.c.

References _, _free(), transactionFileInfo_s::ap, transactionFileInfo_s::apath, buildOrigFileList(), psm_s::countCorrection, CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, transactionFileInfo_s::fc, psm_s::fd, Ferror(), transactionFileInfo_s::fgids, transactionFileInfo_s::fgroup, psm_s::fi, transactionFileInfo_s::fmodes, Fopen(), transactionFileInfo_s::fstates, Fstrerror(), transactionFileInfo_s::fuids, transactionFileInfo_s::fuser, transactionFileInfo_s::gid, gnameToGid(), psm_s::goal, transactionFileInfo_s::h, HEADER_MAGIC_YES, headerAddEntry(), headerCopy(), headerCopyLoad(), headerFree(), headerFreeData(), headerFreeIterator(), headerGetEntry(), headerInitIterator(), headerIsEntry(), headerNew(), headerNextIterator(), headerRegenSigHeader(), headerSprintf(), headerWrite(), transactionFileInfo_s::hfd, transactionFileInfo_s::hge, transactionFileInfo_s::hme, rpmTransactionSet_s::id, transactionFileInfo_s::mapflags, psm_s::mi, transactionFileInfo_s::name, psm_s::npkgs_installed, psm_s::oh, psm_s::pkgfn, psm_s::pkgURL, psm_s::progTag, PSM_CHROOT_IN, PSM_IMMED_TRIGGERS, PSM_INIT, PSM_PKGERASE, PSM_PKGINSTALL, PSM_PKGSAVE, PSM_PRE, PSM_PROCESS, PSM_RPMDB_LOAD, PSM_RPMIO_FLAGS, PSM_SCRIPT, PSM_TRIGGERS, PSM_UNKNOWN, psmStage(), psm_s::rc, transactionFileInfo_s::record, transactionFileInfo_s::release, RPM_INT32_TYPE, rpmBuildFileList(), rpmTransactionSet_s::rpmdb, rpmdbCountPackages(), rpmdbFreeIterator(), rpmdbGetIteratorOffset(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbSetIteratorRE(), RPMERR_NOSPACE, RPMERR_SCRIPT, rpmError, RPMFILE_STATE_NORMAL, rpmFreeSignature(), rpmGenPath(), rpmGetArchInfo(), rpmGetOsInfo(), rpmGetPath(), rpmHeaderFormats, RPMLEAD_BINARY, RPMMESS_DEBUG, RPMMESS_WARNING, rpmMessage, RPMMIRE_DEFAULT, RPMRC_FAIL, RPMRC_OK, RPMSENSE_TRIGGERUN, RPMSIGTYPE_HEADERSIG, RPMTAG_DEFAULTPREFIX, RPMTAG_FILEGROUPNAME, RPMTAG_FILEUSERNAME, RPMTAG_HEADERIMAGE, RPMTAG_HEADERIMMUTABLE, RPMTAG_NAME, RPMTAG_ORIGBASENAMES, RPMTAG_PREIN, RPMTAG_PREINPROG, RPMTAG_PREUN, RPMTAG_PREUNPROG, RPMTAG_RELEASE, RPMTAG_REMOVETID, RPMTAG_VERSION, rpmTagTable, RPMTRANS_FLAG_JUSTDB, RPMTRANS_FLAG_MULTILIB, RPMTRANS_FLAG_NOPRE, RPMTRANS_FLAG_NOPREUN, RPMTRANS_FLAG_NOTRIGGERPREIN, RPMTRANS_FLAG_NOTRIGGERUN, RPMTRANS_FLAG_TEST, rpmWriteSignature(), psm_s::scriptArg, psm_s::scriptTag, psm_s::sense, psm_s::stepName, transactionFileInfo_s::striplen, tag2sln(), rpmTransactionSet_s::transFlags, psm_s::ts, transactionFileInfo_s::uid, unameToUid(), urlPath(), transactionFileInfo_s::version, writeLead(), xcalloc(), and xmalloc().

Referenced by psmStage(), and rpmVerifyScript().