#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 | 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 [] |
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.
Mark files in database shared with this package as "replaced".
psm | package state machine data |
Definition at line 163 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.
static const char* const pkgStageString | ( | pkgStage | a | ) | [static] |
static pid_t psmWait | ( | rpmpsm | psm | ) | [static] |
Wait for child process to be reaped.
psm | package state machine data |
Definition at line 476 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.
Define per-header macros.
fi | transaction element file info | |
h | header |
Definition at line 115 of file psm.c.
References argv.
Referenced by rpmInstallSourcePackage().
rpmRC rpmInstallSourcePackage | ( | rpmts | ts, | |
FD_t | fd, | |||
const char ** | specFilePtr, | |||
const char ** | cookie | |||
) |
Install source package.
ts | transaction set | |
fd | file handle |
specFilePtr | address of spec file name (or NULL) | |
cookie | address of cookie pointer (or NULL) |
Definition at line 238 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(), and rpmInstallSource().
Destroy a package state machine.
psm | package state machine |
Definition at line 1272 of file psm.c.
Referenced by rpmtsRun(), and rpmVerifyScript().
Create and load a package state machine.
ts | transaction set | |
te | transaction set element | |
fi | file info set |
Definition at line 1305 of file psm.c.
Referenced by rpmtsRun(), and rpmVerifyScript().
Package state machine driver.
Definition at line 1348 of file psm.c.
Referenced by rpmInstallSourcePackage(), rpmpsmNext(), rpmtsRun(), and rpmVerifyScript().
Compare headers to determine which header is "newer".
first | 1st header | |
second | 2nd header |
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().
static rpmRC runScript | ( | rpmpsm | psm, | |
Header | h, | |||
const char * | sln, | |||
int | progArgc, | |||
const char ** | progArgv, | |||
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. If the interpreter is /bin/sh, then the args from the header will be ignored, passing instead arg1 and arg2.
psm | package state machine data | |
h | header | |
sln | name of scriptlet section | |
progArgc | no. of args from header | |
progArgv | args from header, progArgv[0] is the interpreter to use | |
script | scriptlet from header | |
arg1 | no. instances of package installed after scriptlet exec (-1 is no arg) | |
arg2 | ditto, but for the target package |
static const char* const tag2sln | ( | int | tag | ) | [static] |
Return scriptlet name from tag.
tag | scriptlet tag |
Definition at line 453 of file psm.c.
References RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERUN, and RPMTAG_VERIFYSCRIPT.
int _psm_debug = 0 |
int _psm_threads = 0 |
int ldconfig_done = 0 [static] |
const char* ldconfig_path = "/sbin/ldconfig" [static] |
unsigned int myinstall_instance |
char* SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin" [static] |