#include "system.h"
#include <rpmio_internal.h>
#include <header_internal.h>
#include <rpmlib.h>
#include <rpmmacro.h>
#include <rpmurl.h>
#include <rpmlua.h>
#include "cpio.h"
#include "fsm.h"
#include "psm.h"
#include "rpmds.h"
#include "rpmfi.h"
#include "rpmte.h"
#include "rpmts.h"
#include "rpmlead.h"
#include "signature.h"
#include "legacy.h"
#include "misc.h"
#include "rpmdb.h"
#include "debug.h"
Include dependency graph for psm.c:
Go to the source code of this file.
Defines | |
#define | _RPMEVR_INTERNAL |
#define | _RPMFI_INTERNAL |
#define | _RPMTE_INTERNAL |
#define | _RPMTS_INTERNAL |
#define | _PSM_DEBUG 0 |
Functions | |
int | rpmVersionCompare (Header first, Header second) |
Compare headers to determine which header is "newer". | |
static rpmRC | markReplacedFiles (const rpmpsm psm) |
Mark files in database shared with this package as "replaced". | |
rpmRC | rpmInstallSourcePackage (rpmts ts, FD_t fd, const char **specFilePtr, const char **cookie) |
Install source package. | |
static const char * | tag2sln (int tag) |
Return scriptlet name from tag. | |
static rpmScriptID | tag2slx (int tag) |
Return scriptlet id from tag. | |
static pid_t | psmWait (rpmpsm psm) |
Wait for child process to be reaped. | |
static rpmRC | runScript (rpmpsm psm, Header h, const char *sln, int progArgc, const char **progArgv, const char *script, int arg1, int arg2) |
Run scriptlet with args. | |
static rpmRC | runInstScript (rpmpsm psm) |
Retrieve and run scriptlet from header. | |
static rpmRC | handleOneTrigger (const rpmpsm psm, Header sourceH, Header triggeredH, int arg2, unsigned char *triggersAlreadyRun) |
Execute triggers. | |
static rpmRC | runTriggers (rpmpsm psm) |
Run trigger scripts in the database that are fired by this header. | |
static rpmRC | runImmedTriggers (rpmpsm psm) |
Run triggers from this header that are fired by headers in the database. | |
static const char * | pkgStageString (pkgStage a) |
rpmpsm | XrpmpsmUnlink (rpmpsm psm, const char *msg, const char *fn, unsigned ln) |
rpmpsm | XrpmpsmLink (rpmpsm psm, const char *msg, const char *fn, unsigned ln) |
rpmpsm | rpmpsmFree (rpmpsm psm) |
Destroy a package state machine. | |
rpmpsm | rpmpsmNew (rpmts ts, rpmte te, rpmfi fi) |
Create and load a package state machine. | |
static uint_32 | hLoadTID (Header h, int_32 tag) |
Load a transaction id from a header. | |
static int | hCopyTag (Header sh, Header th, int_32 tag) |
Copy a tag from a source to a target header. | |
static int | hSaveBlinks (Header h, const struct rpmChainLink_s *blink) |
Save backward link(s) of an upgrade chain into a header. | |
static int | hSaveFlinks (Header h, const struct rpmChainLink_s *flink) |
Save forward link(s) of an upgrade chain into a header. | |
static int | populateInstallHeader (const rpmts ts, const rpmte te, rpmfi fi) |
Add per-transaction data to an install header. | |
static int | postPopulateInstallHeader (const rpmts ts, const rpmte te, rpmfi fi) |
Add fi->states to an install header. | |
static void * | rpmpsmThread (void *arg) |
static int | rpmpsmNext (rpmpsm psm, pkgStage nstage) |
static void | replace_lzma_with_gzip (Header h) |
rpmRC | rpmpsmStage (rpmpsm psm, pkgStage stage) |
Package state machine driver. | |
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" |
Definition in file psm.c.
|
|
|
|
|
|
|
|
|
|
|
Execute triggers.
Definition at line 1029 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, headerFreeData(), headerNVR(), rpmdbCountPackages(), rpmdsAnyMatchesDep(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsN(), rpmdsNew(), rpmdsNext(), rpmdsSetNoPromote(), RPMRC_FAIL, RPMRC_OK, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, rpmtsGetRdb(), runScript(), rpmpsm_s::sense, and rpmpsm_s::ts. Referenced by runImmedTriggers(), and runTriggers(). |
|
Copy a tag from a source to a target header.
Definition at line 1376 of file psm.c. References headerAddEntry(), headerFreeData(), and headerGetEntry(). Referenced by rpmpsmStage(). |
|
Load a transaction id from a header.
Definition at line 1354 of file psm.c. References headerFreeData(), headerGetEntry(), and RPM_INT32_TYPE. Referenced by rpmpsmStage(). |
|
Save backward link(s) of an upgrade chain into a header.
Definition at line 1397 of file psm.c. References argvCount(), argvData(), headerAddEntry(), RPM_STRING_ARRAY_TYPE, RPMTAG_BLINKHDRID, RPMTAG_BLINKNEVRA, RPMTAG_BLINKPKGID, and RPMTE_CHAIN_END. Referenced by populateInstallHeader(). |
|
Save forward link(s) of an upgrade chain into a header.
Definition at line 1441 of file psm.c. References argvCount(), argvData(), headerAddEntry(), RPM_STRING_ARRAY_TYPE, RPMTAG_FLINKHDRID, RPMTAG_FLINKNEVRA, RPMTAG_FLINKPKGID, and RPMTE_CHAIN_END. Referenced by rpmpsmStage(). |
|
Mark files in database shared with this package as "replaced".
Definition at line 91 of file psm.c. References alloca(), rpmpsm_s::fi, rpmdbAppendIterator(), rpmdbFreeIterator(), rpmdbGetIteratorOffset(), RPMDBI_PACKAGES, rpmdbNextIterator(), rpmdbSetIteratorModified(), rpmdbSetIteratorRewrite(), rpmfiFC(), RPMFILE_STATE_REPLACED, RPMRC_OK, RPMTAG_FILESTATES, rpmtsInitIterator(), and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Definition at line 1229 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(). |
|
Add per-transaction data to an install header.
Definition at line 1495 of file psm.c. References headerAddEntry(), headerGetOrigin(), hSaveBlinks(), RPM_INT32_TYPE, RPM_STRING_TYPE, rpmfiFC(), RPMTAG_INSTALLCOLOR, RPMTAG_INSTALLTIME, RPMTAG_PACKAGECOLOR, RPMTAG_PACKAGEORIGIN, rpmteColor(), RPMTRANS_TYPE_ROLLBACK, rpmtsColor(), and rpmtsType(). Referenced by rpmpsmStage(). |
|
Add fi->states to an install header.
Definition at line 1543 of file psm.c. References alloca(), headerAddEntry(), RPM_CHAR_TYPE, rpmfiFC(), and RPMTAG_FILESTATES. Referenced by rpmpsmStage(). |
|
Wait for child process to be reaped.
Definition at line 434 of file psm.c. References rpmsqElem::child, D_, rpmsqElem::op, rpmsqElem::reaped, RPMMESS_DEBUG, rpmMessage, RPMSCRIPT_STATE_REAPED, rpmsqWait(), rpmswAdd(), RPMTS_OP_SCRIPTLETS, rpmtsOp(), rpmpsm_s::scriptTag, rpmpsm_s::sq, rpmpsm_s::sstates, rpmsqElem::status, rpmpsm_s::stepName, tag2slx(), rpmpsm_s::ts, and rpmop_s::usecs. Referenced by runScript(). |
|
Definition at line 1577 of file psm.c. References indexEntry_s::data, headerToken_s::index, indexEntry_s::info, RPMTAG_PAYLOADCOMPRESSOR, and entryInfo_s::tag. Referenced by rpmpsmStage(). |
|
Install source package.
Definition at line 166 of file psm.c. References _, _free(), Access(), CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, FA_CREATE, Fclose(), fdLink, headerFree(), headerIsEntry(), headerLink(), headerMacrosLoad(), PSM_FINI, PSM_PKGINSTALL, PSM_PROCESS, RPMERR_CREATE, RPMERR_NOSPEC, RPMERR_NOTSRPM, rpmError, rpmfiBuildFNames(), rpmfiFree(), RPMFILE_SPECFILE, rpmfiLink, rpmfiNew(), rpmGenPath(), rpmMkdirPath(), rpmpsmStage(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), RPMTAG_BASENAMES, RPMTAG_COOKIE, RPMTAG_SOURCERPM, rpmtsAddInstallElement(), rpmtsClean(), rpmtsElement(), rpmtsFree(), rpmtsLink, rpmtsRootDir(), stpcpy(), W_OK, xmalloc(), and xstrdup(). Referenced by rpmInstall(), and rpmInstallSource(). |
|
Destroy a package state machine.
Definition at line 1293 of file psm.c. References _free(), rpmpsm_s::fi, rpmpsm_s::nrefs, rpmfiFree(), rpmpsmUnlink, rpmteFree(), rpmtsFree(), rpmpsm_s::sstates, rpmpsm_s::te, and rpmpsm_s::ts. Referenced by _processFailedPackage(), rpmtsRun(), and rpmVerifyScript(). |
|
Create and load a package state machine.
Definition at line 1328 of file psm.c. References rpmfiLink, rpmpsmLink, RPMSCRIPT_MAX, rpmtsLink, and xcalloc(). Referenced by _processFailedPackage(), rpmtsRun(), and rpmVerifyScript(). |
|
Definition at line 1567 of file psm.c. References _psm_threads, rpmpsm_s::nstage, rpmpsmStage(), rpmpsmThread(), rpmsqJoin(), and rpmsqThread(). Referenced by rpmpsmStage(). |
|
|
Definition at line 1557 of file psm.c. References rpmpsm_s::nstage, and rpmpsmStage(). Referenced by rpmpsmNext(). |
|
Compare headers to determine which header is "newer".
Definition at line 53 of file psm.c. References headerGetEntry(), RPMTAG_EPOCH, RPMTAG_RELEASE, RPMTAG_VERSION, and rpmvercmp. Referenced by hdr_compare(), and rpmInstall(). |
|
Run triggers from this header that are fired by headers in the database.
Definition at line 1173 of file psm.c. References alloca(), rpmpsm_s::fi, handleOneTrigger(), headerFreeData(), rpmpsm_s::mi, rpmdbFreeIterator(), rpmdbGetIteratorCount(), rpmdbNextIterator(), RPMRC_OK, RPMTAG_NAME, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, rpmtsInitIterator(), and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Retrieve and run scriptlet from header.
Definition at line 974 of file psm.c. References _free(), alloca(), rpmpsm_s::fi, headerFreeData(), rpmpsm_s::progTag, RPM_STRING_TYPE, rpmExpand(), RPMRC_OK, runScript(), rpmpsm_s::scriptArg, rpmpsm_s::scriptTag, and tag2sln(). Referenced by rpmpsmStage(). |
|
|
Run trigger scripts in the database that are fired by this header.
Definition at line 1131 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, handleOneTrigger(), rpmpsm_s::mi, rpmdbCountPackages(), rpmdbFreeIterator(), rpmdbNextIterator(), RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_TRIGGERNAME, rpmteN(), rpmtsGetRdb(), rpmtsInitIterator(), rpmpsm_s::te, and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Return scriptlet name from tag.
Definition at line 386 of file psm.c. References RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERUN, and RPMTAG_VERIFYSCRIPT. Referenced by rpmpsmStage(), runInstScript(), and runScript(). |
|
Return scriptlet id from tag.
Definition at line 410 of file psm.c. References RPMSCRIPT_POSTIN, RPMSCRIPT_POSTTRANS, RPMSCRIPT_POSTUN, RPMSCRIPT_PREIN, RPMSCRIPT_PRETRANS, RPMSCRIPT_PREUN, 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_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERUN, and RPMTAG_VERIFYSCRIPT. Referenced by psmWait(), and runScript(). |
|
Definition at line 1280 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
Definition at line 1269 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
|
|
Definition at line 42 of file psm.c. Referenced by rpmpsmNext(). |
|
|
|
|
|
Definition at line 379 of file psm.c. Referenced by runScript(). |