Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lib/psm.c File Reference

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

#include "system.h"
#include "psm.h"
#include <rpmmacro.h>
#include <rpmurl.h>
#include "depends.h"
#include "rpmlead.h"
#include "signature.h"
#include "ugid.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...


RPMTS

int rpmVersionCompare (Header first, Header second)
 Compare headers to determine which header is "newer". More...

rpmRC rpmInstallSourcePackage (const char *rootDir, FD_t fd, const char **specFilePtr, rpmCallbackFunction notify, rpmCallbackData notifyData, char **cookie)
 Install source package. More...


Functions

void loadFi (Header h, TFI_t fi)
 Load data from header into transaction file element info. More...

void freeFi (TFI_t fi)
 Destroy transaction element file info. More...

const char* const fiTypeString (TFI_t fi)
 Return formatted string representation of package disposition. More...

int rpmInstallLoadMacros (TFI_t fi, Header h)
 Define per-header macros. More...

int mergeFiles (TFI_t fi, Header h, Header newH)
 Copy file data from h to newH. More...

int markReplacedFiles (PSM_t psm)
 Mark files in database shared with this package as "replaced". More...

rpmRC chkdir (const char *dpath, const char *dname)
 Create directory if it does not exist, make sure path is writable. More...

const char* const tag2sln (int tag)
 Return scriptlet name from tag. More...

int runScript (PSM_t psm, Header h, const char *sln, int progArgc, const char **progArgv, const char *script, int arg1, int arg2)
 Run scriptlet with args. More...

rpmRC runInstScript (PSM_t psm)
 Retrieve and run scriptlet from header. More...

int handleOneTrigger (PSM_t psm, Header sourceH, Header triggeredH, int arg2, unsigned char *triggersAlreadyRun)
int runTriggers (PSM_t psm)
 Run trigger scripts in the database that are fired by this header. More...

int runImmedTriggers (PSM_t psm)
 Run triggers from this header that are fired by headers in the database. More...

const char* const pkgStageString (pkgStage a)
int psmStage (PSM_t psm, pkgStage stage)
 Package state machine driver. More...


Variables

struct tagMacro  tagMacros []
 Macros to be defined from per-header tag values. More...

char* SCRIPT_PATH


Detailed Description

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

Definition in file psm.c.


Function Documentation

rpmRC chkdir ( const char * dpath,
const char * dname ) [static]
 

Create directory if it does not exist, make sure path is writable.

Note:
This will only create last component of directory path.
Parameters:
dpath   directory path
dname   directory use
Returns:
rpmRC return code

Definition at line 577 of file psm.c.

Referenced by rpmInstallSourcePackage().

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.

void freeFi ( TFI_t fi )
 

Destroy transaction element file info.

Parameters:
fi   transaction element file info

Definition at line 188 of file psm.c.

int handleOneTrigger ( PSM_t psm,
Header sourceH,
Header triggeredH,
int arg2,
unsigned char * triggersAlreadyRun ) [static]
 

Parameters:
psm   package state machine data
sourceH  
triggeredH  
arg2  
triggersAlreadyRun  
Returns:

Definition at line 1093 of file psm.c.

Referenced by runImmedTriggers(), and runTriggers().

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.

int markReplacedFiles ( PSM_t psm ) [static]
 

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

Parameters:
psm   package state machine data
Returns:
0 always

Definition at line 497 of file psm.c.

Referenced by psmStage().

int mergeFiles ( TFI_t fi,
Header h,
Header newH ) [static]
 

Copy file data from h to newH.

Parameters:
h   header from
newH   header to
actions   array of file dispositions
Returns:
0 on success, 1 on failure

Definition at line 314 of file psm.c.

Referenced by psmStage().

const char *const pkgStageString ( pkgStage a ) [static]
 

Definition at line 1298 of file psm.c.

Referenced by psmStage().

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.

int rpmInstallLoadMacros ( TFI_t fi,
Header h ) [static]
 

Define per-header macros.

Parameters:
fi   transaction element file info
h   header
Returns:
0 always

Definition at line 267 of file psm.c.

Referenced by rpmInstallSourcePackage().

rpmRC rpmInstallSourcePackage ( const char * rootDir,
FD_t fd,
const char ** specFilePtr,
rpmCallbackFunction notify,
rpmCallbackData notifyData,
char ** cookie )
 

Install source package.

Parameters:
rootDir   path to top of install tree (or NULL)
fd   file handle
Return values:
specFilePtr   address of spec file name (or NULL)
Parameters:
notify   progress callback
notifyData   progress callback private data
Return values:
cooke   address of cookie pointer (or NULL)
Returns:
rpmRC return code

Definition at line 612 of file psm.c.

int rpmVersionCompare ( Header first,
Header second )
 

Compare headers to determine which header is "newer".

Parameters:
first   1st header
second   2nd header
Returns:
result of comparison

Definition at line 36 of file psm.c.

int runImmedTriggers ( PSM_t 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, 1 on error

Definition at line 1246 of file psm.c.

Referenced by psmStage().

rpmRC runInstScript ( PSM_t psm ) [static]
 

Retrieve and run scriptlet from header.

Parameters:
psm   package state machine data
Returns:
rpmRC return code

Definition at line 1046 of file psm.c.

Referenced by psmStage().

int runScript ( PSM_t 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.

Parameters:
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
Returns:
0 on success, 1 on error

Definition at line 825 of file psm.c.

Referenced by handleOneTrigger(), and runInstScript().

int runTriggers ( PSM_t psm ) [static]
 

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

Parameters:
psm   package state machine data
Returns:
0 on success, 1 on error

Definition at line 1209 of file psm.c.

Referenced by psmStage().

const char *const tag2sln ( int tag ) [static]
 

Return scriptlet name from tag.

Parameters:
tag   scriptlet tag
Returns:
name of scriptlet

Definition at line 794 of file psm.c.

Referenced by psmStage(), and runInstScript().


Variable Documentation

char * SCRIPT_PATH [static]
 

Initial value:

        "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"

Definition at line 786 of file psm.c.

struct tagMacro tagMacros [static]
 

Macros to be defined from per-header tag values.

Todo:
Should other macros be added from header when installing a package?


Generated at Fri Feb 15 10:30:41 2002 for rpm by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001