psm.c File Reference
RPMTS Transaction Set API. | PAYLOAD.

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

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmcb.h>`
`#include <rpmmacro.h>`
`#include <rpmurl.h>`
`#include <rpmficl.h>`
`#include <rpmjs.h>`
`#include <rpmlua.h>`
`#include <rpmperl.h>`
`#include <rpmpython.h>`
`#include <rpmruby.h>`
`#include <rpmtcl.h>`
`#include <rpmtag.h>`
`#include <rpmtypes.h>`
`#include <rpmlib.h>`
`#include "rpmfi.h"`
`#include "fsm.h"`
`#include "psm.h"`
`#include "rpmds.h"`
`#include "rpmte.h"`
`#include "rpmts.h"`
`#include <pkgio.h>`
`#include "misc.h"`
`#include "rpmdb.h"`
`#include "signature.h"`
`#include <rpmcli.h>`
`#include "debug.h"`
Include dependency graph for psm.c:

Go to the source code of this file.

## Macros

#define | _MIRE_INTERNAL /* XXX mireApply doesn't tell which pattern matched. */
#define | _RPMFI_INTERNAL
#define | _RPMSQ_INTERNAL
#define | F_ISSET(_psm, _FLAG) ((_psm)->flags & (RPMPSM_FLAGS_##_FLAG))
#define | F_SET(_psm, _FLAG) ((_psm)->flags |= (RPMPSM_FLAGS_##_FLAG))
#define | F_CLR(_psm, _FLAG) ((_psm)->flags &= ~(RPMPSM_FLAGS_##_FLAG))
#define | _RPMEVR_INTERNAL
#define | _RPMTE_INTERNAL
#define | _RPMTS_INTERNAL /* XXX ts->notify */
#define | _PSM_DEBUG 0

## Functions

static rpmRC | markReplacedFiles (const rpmpsm psm)
| Mark files in database shared with this package as "replaced". More...
static rpmRC | createDir (rpmts ts, const char **fn, const char *name)
rpmRC | rpmInstallSourcePackage (rpmts ts, void *_fd, const char **specFilePtr, const char **cookie)
| Install source package. More...
static const char * | tag2sln (rpmTag tag)
| Return scriptlet name from tag. More...
static rpmScriptID | tag2slx (rpmTag tag)
| Return scriptlet id from tag. More...
static pid_t | psmWait (rpmpsm psm)
| Wait for child process to be reaped. More...
static rpmRC | runScript (rpmpsm psm, Header h, const char *sln, HE_t Phe, const char *script, int arg1, int arg2)
| Run scriptlet with args. More...
static rpmRC | runInstScript (rpmpsm psm)
| Retrieve and run scriptlet from header. More...
static rpmRC | handleOneTrigger (const rpmpsm psm, Header sourceH, Header triggeredH, int arg2)
| Execute triggers. More...
static int | rpmdbTriggerGlobs (rpmpsm psm)
static rpmRC | runTriggersLoop (rpmpsm psm, rpmTag tagno, int arg2)
| Run a dependency set loop against rpmdb triggers. More...
static rpmRC | runTriggers (rpmpsm psm)
| Run trigger scripts in the database that are fired by this header. More...
static rpmRC | runImmedTriggers (rpmpsm psm)
| Run triggers from this header that are fired by headers in the database. More...
static const char * | pkgStageString (pkgStage a)
static void | rpmpsmFini (void *_psm)
static rpmpsm | rpmpsmGetPool (rpmioPool pool)
rpmpsm | rpmpsmNew (rpmts ts, rpmte te, rpmfi fi)
| Create and load a package state machine. More...
static rpmuint32_t | hLoadTID (Header h, rpmTag tag)
| Load a transaction id from a header. More...
static int | hCopyTag (Header sh, Header th, rpmTag tag)
| Copy a tag from a source to a target header. More...
static int | hSaveBlinks (Header h, const struct rpmChainLink_s *blink)
| Save backward link(s) of an upgrade chain into a header. More...
static int | hSaveFlinks (Header h, const struct rpmChainLink_s *flink)
| Save forward link(s) of an upgrade chain into a header. More...
static int | populateInstallHeader (const rpmts ts, const rpmte te, rpmfi fi)
| Add per-transaction data to an install header. More...
static int | postPopulateInstallHeader (const rpmts ts, const rpmte te, rpmfi fi)
| Add fi->states to an install header. More...
static int | rpmpsmNext (rpmpsm psm, pkgStage nstage)
rpmRC | rpmpsmStage (rpmpsm psm, pkgStage stage)
| Package state machine driver. More...

## Variables

int | _psm_debug = 0
int | _psm_threads = 0
static char * | SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"
static int | ldconfig_done = 0
static const char * | ldconfig_path = "/sbin/ldconfig"
static rpmTag | _trigger_tag
rpmioPool | _psmPool

## Detailed Description

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

Definition in file psm.c.

## Macro Definition Documentation

#define _MIRE_INTERNAL /* XXX mireApply doesn't tell which pattern matched. */

Definition at line 8 of file psm.c.

#define _PSM_DEBUG 0

Definition at line 54 of file psm.c.

#define _RPMEVR_INTERNAL

Definition at line 36 of file psm.c.

#define _RPMFI_INTERNAL

Definition at line 27 of file psm.c.

#define _RPMSQ_INTERNAL

Definition at line 30 of file psm.c.

#define _RPMTE_INTERNAL

Definition at line 39 of file psm.c.

#define _RPMTS_INTERNAL /* XXX ts->notify */

Definition at line 42 of file psm.c.

#define F_CLR | ( |  | _psm,
|  |  | _FLAG
| ) |  | ((_psm)->flags &= ~(RPMPSM_FLAGS_##_FLAG))

Definition at line 34 of file psm.c.

Referenced by rpmpsmStage().

#define F_ISSET | ( |  | _psm,
|  |  | _FLAG
| ) |  | ((_psm)->flags & (RPMPSM_FLAGS_##_FLAG))

Definition at line 32 of file psm.c.

Referenced by rpmpsmStage(), and runScript().

#define F_SET | ( |  | _psm,
|  |  | _FLAG
| ) |  | ((_psm)->flags |= (RPMPSM_FLAGS_##_FLAG))

Definition at line 33 of file psm.c.

Referenced by rpmpsmStage().

## Function Documentation

static rpmRC createDir | ( | rpmts | ts,
|  | const char ** | fn,
|  | const char * | name
| ) |  |

static

Definition at line 158 of file psm.c.

References _, _free(), Access(), Chown(), rpmGenPath(), rpmlog(), RPMLOG_ERR, rpmMkdirPath(), RPMRC_OK, rpmtsRootDir(), W_OK, and xstrdup().

Referenced by rpmInstallSourcePackage().

static rpmRC handleOneTrigger | ( | const rpmpsm | psm,
|  | Header | sourceH,
|  | Header | triggeredH,
|  | int | arg2
| ) |  |

static

Execute triggers.

Parameters

  psm | package state machine data
  sourceH |
  triggeredH |
  arg2 |

Returns
  RPMRC_OK on success

Definition at line 1171 of file psm.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, rpmpsm_s::countCorrection, Glob_pattern_p(), headerGet(), mireClean(), mireFree(), mireNew(), mireRegcomp(), mireRegexec(), _HE_s::p, rpmDataType_u::ptr, rpmpsm_s::rc, RPM_STRING_ARRAY_TYPE, rpmdbCountPackages(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsLink(), rpmdsMatch(), rpmdsN(), rpmdsNegateRC(), rpmdsNew(), rpmdsNext(), rpmdsSetNoPromote(), RPMMIRE_GLOB, RPMRC_FAIL, RPMRC_OK, RPMTAG_BASENAMES, RPMTAG_DIRNAMES, RPMTAG_NAME, RPMTAG_PROVIDENAME, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, rpmtsGetRdb(), runScript(), rpmpsm_s::sense, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmpsm_s::ts, rpmDataType_u::ui32p, and xmalloc().

Referenced by runImmedTriggers(), and runTriggersLoop().

static int hCopyTag | ( | Header | sh,
|  | Header | th,
|  | rpmTag | tag
| ) |  |

static

Copy a tag from a source to a target header.

Parameters

  sh | source header
  th | target header
  tag | tag to copy

Returns
  0 always

Definition at line 1785 of file psm.c.

References _free(), alloca(), _HE_s::c, headerGet(), headerPut(), _HE_s::p, rpmDataType_u::ptr, and _HE_s::tag.

Referenced by rpmpsmStage().

static rpmuint32_t hLoadTID | ( | Header | h,
|  | rpmTag | tag
| ) |  |

static

Load a transaction id from a header.

Parameters

  h | header
  tag | tag to load

Returns
  tag value (0 on failure)

Definition at line 1763 of file psm.c.

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

Referenced by rpmpsmStage().

static int hSaveBlinks | ( | Header | h,
|  | const struct rpmChainLink_s * | blink
| ) |  |

static

Save backward link(s) of an upgrade chain into a header.

Parameters

  h | header
  *blink | backward links

Returns
  0 always

< End of chain marker.

Definition at line 1805 of file psm.c.

References alloca(), rpmDataType_u::argv, argvCount(), argvData(), _HE_s::c, headerPut(), _HE_s::p, RPM_STRING_ARRAY_TYPE, RPMTAG_BLINKHDRID, RPMTAG_BLINKNEVRA, RPMTAG_BLINKPKGID, RPMTE_CHAIN_END, _HE_s::t, and _HE_s::tag.

Referenced by populateInstallHeader().

static int hSaveFlinks | ( | Header | h,
|  | const struct rpmChainLink_s * | flink
| ) |  |

static

Save forward link(s) of an upgrade chain into a header.

Parameters

  h | header
  *flink | forward links

Returns
  0 always

Definition at line 1860 of file psm.c.

References alloca(), rpmDataType_u::argv, argvCount(), argvData(), _HE_s::c, headerPut(), _HE_s::p, RPM_STRING_ARRAY_TYPE, RPMTAG_FLINKHDRID, RPMTAG_FLINKNEVRA, RPMTAG_FLINKPKGID, RPMTE_CHAIN_END, _HE_s::t, and _HE_s::tag.

Referenced by rpmpsmStage().

static rpmRC markReplacedFiles | ( | const rpmpsm | psm | ) |

static

Mark files in database shared with this package as "replaced".

Parameters

  psm | package state machine data

Returns
  0 always

Definition at line 77 of file psm.c.

References _free(), alloca(), _HE_s::c, rpmpsm_s::fi, headerGet(), _HE_s::p, rpmDataType_u::ptr, RPMDBI_PACKAGES, rpmfiFC(), RPMFILE_STATE_REPLACED, rpmmiFree(), rpmmiGrow(), rpmmiInstance(), rpmmiNext(), rpmmiSetModified(), rpmmiSetRewrite(), RPMRC_OK, RPMTAG_FILESTATES, rpmtsInitIterator(), _HE_s::tag, rpmpsm_s::te, rpmpsm_s::ts, and rpmDataType_u::ui8p.

Referenced by rpmpsmStage().

static const char* pkgStageString | ( | pkgStage | a | ) |

static

Definition at line 1647 of file psm.c.

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

Referenced by rpmpsmStage().

static int populateInstallHeader | ( | const rpmts | ts,
|  | const rpmte | te,
|  | rpmfi | fi
| ) |  |

static

Add per-transaction data to an install header.

Parameters

  ts | transaction set
  te | transaction element
  fi | file info set

Returns
  0 always

Definition at line 1927 of file psm.c.

References _free(), alloca(), _HE_s::c, headerGetDigest(), headerGetOrigin(), headerGetStatbuf(), headerPut(), hSaveBlinks(), _HE_s::p, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_STRING_TYPE, RPM_UINT32_TYPE, RPMTAG_INSTALLCOLOR, RPMTAG_INSTALLTIME, RPMTAG_ORIGINTID, RPMTAG_ORIGINTIME, RPMTAG_PACKAGECOLOR, RPMTAG_PACKAGEDIGEST, RPMTAG_PACKAGEORIGIN, RPMTAG_PACKAGESTAT, rpmteColor(), rpmteOriginTid(), rpmteOriginTime(), RPMTRANS_TYPE_ROLLBACK, rpmtsColor(), rpmtsType(), Stat(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, URL_IS_HTTP, URL_IS_HTTPS, urlPath(), and xstrdup().

Referenced by rpmpsmStage().

static int postPopulateInstallHeader | ( | const rpmts | ts,
|  | const rpmte | te,
|  | rpmfi | fi
| ) |  |

static

Add fi->states to an install header.

Parameters

  ts | transaction set
  te | transaction element
  fi | file info set

Returns
  0 always

Definition at line 2043 of file psm.c.

References alloca(), _HE_s::c, headerPut(), _HE_s::p, RPM_UINT8_TYPE, rpmfiFC(), RPMTAG_FILESTATES, _HE_s::t, _HE_s::tag, and rpmDataType_u::ui8p.

Referenced by rpmpsmStage().

static pid_t psmWait | ( | rpmpsm | psm | ) |

static

Wait for child process to be reaped.

Parameters

  psm | package state machine data

Returns

Definition at line 486 of file psm.c.

References D_, rpmlog(), RPMLOG_DEBUG, RPMSCRIPT_STATE_REAPED, rpmsqWait(), rpmswAdd(), RPMTS_OP_SCRIPTLETS, rpmtsOp(), rpmpsm_s::scriptTag, rpmpsm_s::sq, rpmpsm_s::sstates, rpmpsm_s::stepName, tag2slx(), and rpmpsm_s::ts.

Referenced by runScript().

static int rpmdbTriggerGlobs | ( | rpmpsm | psm | ) |

static

Definition at line 1340 of file psm.c.

References argvAdd(), argvCount(), argvFree(), Glob_pattern_p(), mireAppend(), rpmpsm_s::nTmires, rpmdbMireApply(), RPMMIRE_GLOB, RPMMIRE_STRCMP, RPMTAG_TRIGGERNAME, rpmtsGetRdb(), rpmpsm_s::Tmires, rpmpsm_s::Tpats, and rpmpsm_s::ts.

Referenced by runTriggers().

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 _, _fd, _free(), alloca(), rpmDataType_u::argv, createDir(), FA_CREATE, Fclose(), fdLink(), headerFree(), headerGet(), headerIsEntry(), headerLink(), headerMacrosLoad(), IOSM_MAP_GID, IOSM_MAP_MODE, IOSM_MAP_PATH, IOSM_MAP_UID, _HE_s::p, PSM_FINI, PSM_PKGINSTALL, PSM_PROCESS, rpmExpand(), rpmfiFree(), RPMFILE_SPECFILE, rpmfiLink(), rpmfiNew(), rpmlog(), RPMLOG_ERR, rpmpsmStage(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), RPMTAG_ARCH, RPMTAG_BASENAMES, RPMTAG_COOKIE, RPMTAG_FILEPATHS, RPMTAG_SOURCERPM, rpmteSetHeader(), rpmtsAddInstallElement(), rpmtsClean(), rpmtsElement(), rpmtsFree(), rpmtsLink(), stpcpy(), rpmDataType_u::str, _HE_s::tag, and xmalloc().

Referenced by rpmInstallSource().

static void rpmpsmFini | ( | void * | _psm | ) |

static

Definition at line 1688 of file psm.c.

References _free(), rpmpsm_s::fi, rpmpsm_s::IPhe, rpmpsm_s::NVRA, _HE_s::p, rpmDataType_u::ptr, rpmdsFree(), rpmfiFree(), rpmtsFree(), rpmpsm_s::sstates, rpmpsm_s::te, rpmpsm_s::triggers, and rpmpsm_s::ts.

Referenced by rpmpsmGetPool().

static rpmpsm rpmpsmGetPool | ( | rpmioPool | pool | ) |

static

Definition at line 1718 of file psm.c.

References _psm_debug, _psmPool, rpmioGetPool(), rpmioNewPool(), and rpmpsmFini().

Referenced by rpmpsmNew().

rpmpsm rpmpsmNew | ( | rpmts | ts,
|  | rpmte | te,
|  | rpmfi | fi
| ) |  |

Create and load a package state machine.

Parameters

  ts | transaction set
  te | transaction set element
  fi | file info set

Returns
  new package state machine

Definition at line 1732 of file psm.c.

References rpmpsm_s::fi, rpmpsm_s::IPhe, rpmpsm_s::NVRA, rpmfiLink(), rpmpsmGetPool(), rpmpsmLink(), RPMSCRIPT_MAX, rpmtsLink(), rpmpsm_s::sstates, rpmpsm_s::te, rpmpsm_s::triggers, rpmpsm_s::ts, and xcalloc().

Referenced by _processFailedPackage(), rpmtsRun(), and rpmVerifyScript().

static int rpmpsmNext | ( | rpmpsm | psm,
|  | pkgStage | nstage
| ) |  |

static

Definition at line 2074 of file psm.c.

References _psm_threads, rpmpsm_s::nstage, rpmpsmStage(), rpmsqJoin(), and rpmsqThread().

Referenced by rpmpsmStage().

rpmRC rpmpsmStage | ( | rpmpsm | 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 2091 of file psm.c.

References _, _free(), alloca(), rpmpsm_s::amount, rpmDataType_u::argv, _HE_s::c, rpmpsm_s::cfd, Chdir(), Chroot(), rpmpsm_s::countCorrection, D_, dbiOpen(), errno, F_CLR, F_ISSET, F_SET, FA_COPYOUT, rpmpsm_s::failedFile, Fclose(), rpmpsm_s::fd, fdDup(), Fdopen(), FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, FDSTAT_WRITE, Ferror(), Fflush(), rpmpsm_s::fi, Fileno(), Fopen(), fsmSetup(), fsmTeardown(), Fstrerror(), rpmpsm_s::goal, hCopyTag(), headerCopyLoad(), headerFini(), headerFree(), headerGet(), headerGetInstance(), headerInit(), headerIsEntry(), headerLink(), headerNew(), headerNext(), headerPut(), headerRegenSigHeader(), headerReload(), headerSetInstance(), headerSprintf(), hLoadTID(), hSaveFlinks(), IOSM_MAP_GID, IOSM_MAP_MODE, IOSM_MAP_PATH, IOSM_MAP_UID, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, IOSM_SBIT_CHECK, iosmStrerror(), markReplacedFiles(), rpmpsm_s::mi, rpmpsm_s::npkgs_installed, rpmpsm_s::oh, _HE_s::p, rpmpsm_s::payload_format, rpmpsm_s::pkgfn, pkgStageString(), rpmpsm_s::pkgURL, populateInstallHeader(), postPopulateInstallHeader(), rpmpsm_s::progTag, PSM_CHROOT_IN, PSM_CHROOT_OUT, PSM_COMMIT, PSM_CREATE, PSM_DESTROY, PSM_FINI, PSM_IMMED_TRIGGERS, PSM_INIT, PSM_NOTIFY, PSM_PKGCOMMIT, PSM_PKGERASE, PSM_PKGINSTALL, PSM_PKGSAVE, PSM_POST, PSM_PRE, PSM_PROCESS, PSM_RPMDB_ADD, PSM_RPMDB_LOAD, PSM_RPMDB_REMOVE, PSM_RPMIO_FLAGS, PSM_SCRIPT, PSM_TRIGGERS, PSM_UNDO, PSM_UNKNOWN, rpmDataType_u::ptr, rpmpsm_s::rc, RPM_BIN_TYPE, RPM_STRING_TYPE, RPM_UINT32_TYPE, RPMCALLBACK_CPIO_ERROR, RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP, RPMCALLBACK_UNPACK_ERROR, rpmdbAdd(), rpmdbCountPackages(), RPMDBI_PACKAGES, rpmdbRemove(), rpmdsNew(), rpmfiFC(), RPMFILE_STATE_NORMAL, rpmGenPath(), rpmGetPath(), rpmHeaderFormats, rpmpsm_s::rpmio_flags, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_INFO, rpmmiAddPattern(), rpmmiFree(), rpmmiInstance(), rpmmiNext(), RPMMIRE_STRCMP, rpmMkdirPath(), rpmpkgSizeof(), rpmpkgWrite(), rpmpsmNext(), RPMRC_FAIL, RPMRC_OK, rpmswAdd(), rpmswEnter(), rpmswExit(), RPMTAG_ARCH, RPMTAG_ARCHIVESIZE, RPMTAG_BLINKHDRID, RPMTAG_BLINKNEVRA, RPMTAG_BLINKPKGID, RPMTAG_DEFAULTPREFIX, RPMTAG_DISTEPOCH, RPMTAG_EPOCH, RPMTAG_FILEGROUPNAME, RPMTAG_FILEPATHS, RPMTAG_FILEUSERNAME, RPMTAG_HEADERIMAGE, RPMTAG_HEADERIMMUTABLE, RPMTAG_HEADERSIGNATURES, RPMTAG_INSTALLTID, RPMTAG_NAME, RPMTAG_ORIGBASENAMES, RPMTAG_ORIGPATHS, RPMTAG_OS, RPMTAG_PACKAGEDIGEST, RPMTAG_PACKAGEORIGIN, RPMTAG_PACKAGESTAT, RPMTAG_PAYLOADCOMPRESSOR, RPMTAG_PAYLOADFORMAT, RPMTAG_POSTIN, RPMTAG_POSTINPROG, RPMTAG_POSTUN, RPMTAG_POSTUNPROG, RPMTAG_PREIN, RPMTAG_PREINPROG, RPMTAG_PREUN, RPMTAG_PREUNPROG, RPMTAG_RELEASE, RPMTAG_REMOVETID, RPMTAG_SHA1HEADER, RPMTAG_TRIGGERNAME, RPMTAG_VERSION, rpmTagTable, rpmteA(), rpmteE(), rpmteFd(), rpmteHdrid(), rpmteN(), rpmteNEVR(), rpmteO(), rpmteR(), rpmteSetDBInstance(), rpmteSetHeader(), rpmteV(), RPMTRANS_FLAG_APPLYONLY, RPMTRANS_FLAG_JUSTDB, RPMTRANS_FLAG_NOPOST, RPMTRANS_FLAG_NOPOSTUN, RPMTRANS_FLAG_NOPRE, RPMTRANS_FLAG_NOPREUN, RPMTRANS_FLAG_NORPMDB, RPMTRANS_FLAG_NOTRIGGERIN, RPMTRANS_FLAG_NOTRIGGERPOSTUN, RPMTRANS_FLAG_NOTRIGGERPREIN, RPMTRANS_FLAG_NOTRIGGERUN, RPMTRANS_FLAG_PKGCOMMIT, RPMTRANS_FLAG_TEST, RPMTRANS_TYPE_AUTOROLLBACK, RPMTRANS_TYPE_ROLLBACK, RPMTS_OP_COMPRESS, RPMTS_OP_DBADD, RPMTS_OP_DBREMOVE, RPMTS_OP_DIGEST, RPMTS_OP_UNCOMPRESS, rpmtsChrootDone(), rpmtsColor(), rpmtsCurrDir(), rpmtsFlags(), rpmtsGetRdb(), rpmtsGetTid(), rpmtsInitIterator(), rpmtsNotify(), rpmtsOp(), rpmtsRootDir(), rpmtsSetChrootDone(), rpmtsType(), rpmtsVSFlags(), RPMVSF_NOHDRCHK, runImmedTriggers(), runInstScript(), runTriggers(), rpmpsm_s::scriptArg, rpmpsm_s::scriptTag, rpmpsm_s::sense, snprintf(), rpmpsm_s::stepName, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tag2sln(), rpmpsm_s::te, rpmpsm_s::total, rpmpsm_s::triggers, rpmpsm_s::ts, rpmDataType_u::ui32p, urlPath(), rpmpsm_s::what, xmalloc(), and xstrdup().

Referenced by _processFailedPackage(), rpmInstallSourcePackage(), rpmpsmNext(), rpmtsRun(), and rpmVerifyScript().

static rpmRC runImmedTriggers | ( | rpmpsm | psm | ) |

static

Run triggers from this header that are fired by headers in the database.

Parameters

  psm | package state machine data

Returns
  0 on success

Definition at line 1527 of file psm.c.

References _free(), _trigger_tag, alloca(), argiAdd(), argiCount(), argiData(), argiFree(), argiSort(), argvAdd(), argvFree(), _HE_s::c, rpmpsm_s::fi, Glob_pattern_p(), handleOneTrigger(), headerGet(), rpmpsm_s::mi, _HE_s::p, rpmDataType_u::ptr, rpmpsm_s::rc, rpmdbMireApply(), rpmdsEVR(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsLink(), rpmdsN(), rpmdsNext(), rpmExpand(), rpmmiCount(), rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmmiPrune(), RPMMIRE_GLOB, RPMRC_OK, RPMTAG_DIRNAMES, RPMTAG_FILEPATHS, RPMTAG_NAME, RPMTAG_PROVIDENAME, RPMTAG_TRIGGERINDEX, rpmtsGetRdb(), rpmtsInitIterator(), rpmpsm_s::sense, _HE_s::tag, rpmpsm_s::triggers, rpmpsm_s::ts, and rpmDataType_u::ui32p.

Referenced by rpmpsmStage().

static rpmRC runInstScript | ( | rpmpsm | psm | ) |

static

Retrieve and run scriptlet from header.

Parameters

  psm | package state machine data

Returns
  rpmRC return code

Definition at line 1116 of file psm.c.

References _free(), alloca(), rpmDataType_u::argv, rpmpsm_s::fi, headerGet(), _HE_s::p, rpmpsm_s::progTag, rpmDataType_u::ptr, rpmpsm_s::rc, RPM_STRING_TYPE, rpmExpand(), RPMRC_OK, runScript(), rpmpsm_s::scriptArg, rpmpsm_s::scriptTag, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tag2sln(), and xmalloc().

Referenced by rpmpsmStage().

static rpmRC runScript | ( | rpmpsm | psm,
|  | Header | h,
|  | const char * | sln,
|  | HE_t | Phe,
|  | const char * | script,
|  | int | arg1,
|  | int | arg2
| ) |  |

static

Run scriptlet with args.

Run a script with an interpreter. If the interpreter is not specified, /bin/sh will be used.

Parameters

  psm | package state machine data
  h | header
  sln | name of scriptlet section
  Phe | scriptlet args, Phe->p.argv[0] is interpreter to use
  script | scriptlet body
  arg1 | no. instances of package installed after scriptlet exec (-1 is no arg)
  arg2 | ditto, but for the target package

Returns
  RPMRC_OK on success

Definition at line 759 of file psm.c.

References _, _free(), alloca(), rpmDataType_u::argv, _HE_s::c, Chdir(), Chroot(), D_, doputenv(), errno, F_ISSET, Fclose(), rpmpsm_s::fd, fdDup(), Ferror(), Fileno(), Fopen(), Fwrite(), headerGet(), IP, rpmpsm_s::IPhe, rpmpsm_s::NVRA, _HE_s::p, psmWait(), rpmDataType_u::ptr, rpmpsm_s::rc, rpm_execcon, RPM_STRING_ARRAY_TYPE, RPMCALLBACK_SCRIPT_ERROR, rpmExpand(), rpmIsDebug, rpmIsVerbose, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, RPMSCRIPT_STATE_EXEC, RPMSCRIPT_STATE_SELINUX, RPMSCRIPT_STATE_UNKNOWN, rpmsqFork(), RPMTAG_INSTALLPREFIX, RPMTAG_INSTPREFIXES, RPMTAG_NVRA, rpmTempFile(), rpmtsChrootDone(), rpmtsNotify(), rpmtsRootDir(), rpmtsScriptFd(), rpmtsSELinuxEnabled(), SCRIPT_PATH, rpmpsm_s::scriptTag, rpmpsm_s::sq, rpmpsm_s::sstates, rpmpsm_s::stepName, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tag2sln(), tag2slx(), rpmpsm_s::te, rpmpsm_s::ts, Unlink(), unsetenv(), and xmalloc().

Referenced by handleOneTrigger(), and runInstScript().

static rpmRC runTriggers | ( | rpmpsm | psm | ) |

static

Run trigger scripts in the database that are fired by this header.

Parameters

  psm | package state machine data

Returns
  0 on success

Definition at line 1461 of file psm.c.

References _free(), _trigger_tag, argvFree(), rpmpsm_s::countCorrection, rpmpsm_s::fi, mireFreeAll(), rpmpsm_s::nTmires, rpmpsm_s::rc, rpmdbCountPackages(), rpmdbTriggerGlobs(), rpmExpand(), RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_BASENAMES, RPMTAG_DIRNAMES, RPMTAG_NAME, RPMTAG_PROVIDENAME, rpmteN(), rpmtsGetRdb(), runTriggersLoop(), rpmpsm_s::te, rpmpsm_s::Tmires, rpmpsm_s::Tpats, and rpmpsm_s::ts.

Referenced by rpmpsmStage().

static rpmRC runTriggersLoop | ( | rpmpsm | psm,
|  | rpmTag | tagno,
|  | int | arg2
| ) |  |

static

Run a dependency set loop against rpmdb triggers.

Parameters

  psm | package state machine data
  tagno | dependency set to run against rpmdb
  arg2 | scriptlet arg2

Returns
  RPMRC_OK on success

Definition at line 1371 of file psm.c.

References _free(), argiAdd(), argiCount(), argiData(), argiFree(), argiSort(), rpmpsm_s::fi, handleOneTrigger(), rpmpsm_s::mi, mireRegexec(), rpmpsm_s::nTmires, rpmpsm_s::rc, rpmdsFree(), rpmdsInit(), rpmdsN(), rpmdsNew(), rpmdsNext(), rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmmiPrune(), RPMRC_OK, RPMTAG_DIRNAMES, RPMTAG_TRIGGERNAME, rpmtsInitIterator(), stpcpy(), rpmpsm_s::Tmires, rpmpsm_s::Tpats, rpmpsm_s::ts, xmalloc(), and xstrdup().

Referenced by runTriggers().

static const char* tag2sln | ( | rpmTag | tag | ) |

static

Return scriptlet name from tag.

Parameters

  tag | scriptlet tag

Returns
  name of scriptlet

Definition at line 434 of file psm.c.

References RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_SANITYCHECK, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERUN, and RPMTAG_VERIFYSCRIPT.

Referenced by rpmpsmStage(), runInstScript(), and runScript().

static rpmScriptID tag2slx | ( | rpmTag | tag | ) |

static

Return scriptlet id from tag.

Parameters

  tag | scriptlet tag

Returns
  id of scriptlet

Definition at line 460 of file psm.c.

References RPMSCRIPT_POSTIN, RPMSCRIPT_POSTTRANS, RPMSCRIPT_POSTUN, RPMSCRIPT_PREIN, RPMSCRIPT_PRETRANS, RPMSCRIPT_PREUN, RPMSCRIPT_SANITYCHECK, RPMSCRIPT_TRIGGERIN, RPMSCRIPT_TRIGGERPOSTUN, RPMSCRIPT_TRIGGERPREIN, RPMSCRIPT_TRIGGERUN, RPMSCRIPT_UNKNOWN, RPMSCRIPT_VERIFY, RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_SANITYCHECK, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERUN, and RPMTAG_VERIFYSCRIPT.

Referenced by psmWait(), and runScript().

## Variable Documentation

int _psm_debug = 0

Definition at line 56 of file psm.c.

Referenced by rpmpsmGetPool().

int _psm_threads = 0

Definition at line 58 of file psm.c.

Referenced by rpmpsmNext().

rpmioPool _psmPool

Definition at line 1716 of file psm.c.

Referenced by rpmpsmGetPool().

rpmTag _trigger_tag

static

Definition at line 1161 of file psm.c.

Referenced by runImmedTriggers(), and runTriggers().

int ldconfig_done = 0

static

Definition at line 738 of file psm.c.

const char* ldconfig_path = "/sbin/ldconfig"

static

Definition at line 741 of file psm.c.

char* SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"

static

Definition at line 427 of file psm.c.

Referenced by runScript().