#include "system.h"
#include <rpmio_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"
Go to the source code of this file.
Data Structures | |
struct | tagMacro |
Macros to be defined from per-header tag values. More... | |
Defines | |
#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 int | rpmInstallLoadMacros (rpmfi fi, Header h) |
Define per-header macros. | |
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 *const | tag2sln (int tag) |
Return scriptlet name from tag. | |
static pid_t | psmWait (rpmpsm psm) |
Wait for child process to be reaped. | |
static rpmRC | runLuaScript (rpmpsm psm, Header h, const char *sln, int progArgc, const char **progArgv, const char *script, int arg1, int arg2) |
Run internal Lua script. | |
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 *const | 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 void * | rpmpsmThread (void *arg) |
static int | rpmpsmNext (rpmpsm psm, pkgStage nstage) |
rpmRC | rpmpsmStage (rpmpsm psm, pkgStage stage) |
Package state machine driver. | |
Variables | |
int | _psm_debug = 0 |
int | _psm_threads = 0 |
unsigned int | myinstall_instance |
static struct tagMacro | tagMacros [] |
Macros to be defined from per-header tag values. | |
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 1015 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, headerFreeData(), headerNVR(), rpmpsm_s::rc, 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(). |
|
Mark files in database shared with this package as "replaced".
Definition at line 168 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 1213 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(). |
|
Wait for child process to be reaped.
Definition at line 475 of file psm.c. References _, rpmsqElem::child, rpmsqElem::op, rpmsqElem::reaped, RPMMESS_DEBUG, rpmMessage, rpmsqWait(), rpmswAdd(), RPMTS_OP_SCRIPTLETS, rpmtsOp(), rpmpsm_s::sq, rpmsqElem::status, rpmpsm_s::stepName, rpmpsm_s::ts, and rpmop_s::usecs. Referenced by runScript(). |
|
Define per-header macros.
Definition at line 120 of file psm.c. References addMacro(), body(), tagMacro::macroname, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, tagMacro::tag, and tagMacros. Referenced by rpmInstallSourcePackage(). |
|
Install source package.
Definition at line 243 of file psm.c. References _, _free(), CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, FA_CREATE, Fclose(), fdLink, headerFree(), headerIsEntry(), headerLink(), PSM_FINI, PSM_PKGINSTALL, PSM_PROCESS, RPMERR_NOSPEC, RPMERR_NOTSRPM, rpmError, rpmfiBuildFNames(), rpmfiFree(), RPMFILE_SPECFILE, rpmfiLink, rpmfiNew(), rpmGenPath(), rpmInstallLoadMacros(), rpmMkdirPath(), rpmpsmStage(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), RPMTAG_BASENAMES, RPMTAG_COOKIE, RPMTAG_SOURCEPACKAGE, rpmtsAddInstallElement(), rpmtsClean(), rpmtsElement(), rpmtsFree(), rpmtsLink, rpmtsRootDir(), stpcpy(), xmalloc(), and xstrdup(). Referenced by rpmInstall(). |
|
Destroy a package state machine.
Definition at line 1277 of file psm.c. References _free(), rpmpsm_s::fi, rpmpsm_s::nrefs, rpmfiFree(), rpmpsmUnlink, rpmteFree(), rpmtsFree(), rpmpsm_s::te, and rpmpsm_s::ts. Referenced by rpmtsRun(), and rpmVerifyScript(). |
|
Create and load a package state machine.
Definition at line 1310 of file psm.c. References rpmfiLink, rpmpsmLink, rpmtsLink, and xcalloc(). Referenced by rpmtsRun(), and rpmVerifyScript(). |
|
Definition at line 1338 of file psm.c. References _psm_threads, rpmpsm_s::nstage, rpmpsmStage(), rpmpsmThread(), rpmsqJoin(), and rpmsqThread(). Referenced by rpmpsmStage(). |
|
|
Definition at line 1328 of file psm.c. References rpmpsm_s::nstage, and rpmpsmStage(). Referenced by rpmpsmNext(). |
|
Compare headers to determine which header is "newer".
Definition at line 61 of file psm.c. References headerGetEntry(), RPMTAG_EPOCH, RPMTAG_RELEASE, RPMTAG_VERSION, and rpmvercmp(). Referenced by hdr_compare(), rpmInstall(), and rpmtsAddInstallElement(). |
|
Run triggers from this header that are fired by headers in the database.
Definition at line 1159 of file psm.c. References alloca(), rpmpsm_s::fi, handleOneTrigger(), headerFreeData(), rpmpsm_s::mi, rpmpsm_s::rc, 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 962 of file psm.c. References alloca(), rpmpsm_s::fi, headerFreeData(), rpmpsm_s::progTag, rpmpsm_s::rc, RPM_STRING_TYPE, RPMRC_OK, runScript(), rpmpsm_s::scriptArg, rpmpsm_s::scriptTag, and tag2sln(). Referenced by rpmpsmStage(). |
|
Run internal Lua script.
Definition at line 498 of file psm.c. References headerNVR(), rpmpsm_s::rc, rpmluaDelVar(), rpmluaPop(), rpmluaPushTable(), rpmluaRunScript(), rpmluaSetVar(), RPMLUAV_STRING, rpmluavFree(), rpmluavNew(), rpmluavSetListMode(), rpmluavSetValue(), rpmluavSetValueNum(), RPMRC_FAIL, RPMRC_OK, rpmtsChrootDone(), rpmtsRootDir(), rpmtsSetChrootDone(), snprintf(), and rpmpsm_s::ts. Referenced by runScript(). |
|
|
Run trigger scripts in the database that are fired by this header.
Definition at line 1117 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, handleOneTrigger(), rpmpsm_s::mi, rpmpsm_s::rc, 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 455 of file psm.c. References RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, and RPMTAG_VERIFYSCRIPT. Referenced by rpmpsmStage(), runInstScript(), and runScript(). |
|
Definition at line 1264 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
Definition at line 1253 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
|
|
Definition at line 40 of file psm.c. Referenced by rpmpsmNext(). |
|
Definition at line 581 of file psm.c. Referenced by runScript(). |
|
Definition at line 584 of file psm.c. Referenced by runScript(). |
|
Definition at line 69 of file rpmdb.c. Referenced by rpmdbAdd(), and rpmpsmStage(). |
|
Definition at line 448 of file psm.c. Referenced by runScript(). |
|
Macros to be defined from per-header tag values.
Referenced by rpmInstallLoadMacros(). |