lib/transaction.c File Reference

#include "system.h"
#include <rpmlib.h>
#include <rpmmacro.h>
#include "fsm.h"
#include "psm.h"
#include "rpmdb.h"
#include "rpmds.h"
#include "rpmlock.h"
#include "rpmfi.h"
#include "rpmte.h"
#include "rpmts.h"
#include "cpio.h"
#include "fprint.h"
#include "legacy.h"
#include "misc.h"
#include "debug.h"
#include "rpmcli.h"

Go to the source code of this file.

Defines

#define _RPMFI_INTERNAL
#define _RPMTE_INTERNAL
#define _RPMTS_INTERNAL
#define ISROOT(_d)   (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))
#define NOTIFY(_ts, _al)   /*@i@*/ if ((_ts)->notify) (void) (_ts)->notify _al

Functions

void * rpmShowProgress (const void *arg, const rpmCallbackType what, const unsigned long amount, const unsigned long total, fnpyKey key, void *data)
 The rpm CLI generic transaction callback handler.
static int archOkay (const char *pkgArch)
static int osOkay (const char *pkgOs)
static int sharedCmp (const void *one, const void *two)
static int handleInstInstalledFiles (const rpmts ts, rpmte p, rpmfi fi, sharedFileInfo shared, int sharedCount, int reportConflicts)
 
Parameters:
ts transaction set

static int handleRmvdInstalledFiles (const rpmts ts, rpmfi fi, sharedFileInfo shared, int sharedCount)
static int fpsCompare (const void *one, const void *two)
static int findFps (const struct fingerPrint_s *fiFps, const struct fingerPrint_s *otherFps, int otherFc)
static void handleOverlappedFiles (const rpmts ts, const rpmte p, rpmfi fi)
 Update disk space needs on each partition for this package's files.
static int ensureOlder (rpmts ts, const rpmte p, const Header h)
 Ensure that current package is newer than installed package.
static void skipFiles (const rpmts ts, rpmfi fi)
 Skip any files that do not match install policies.
static rpmfi rpmtsiFi (const rpmtsi tsi)
 Return transaction element's file info.
static rpmRC _rpmtsRollback (rpmts rollbackTransaction)
 This is not a generalized function to be called from outside librpm.
static rpmRC getRepackageHeaderFromTE (rpmts ts, rpmte te, Header *hdrp, const char **fnp)
 Get the repackaged header and filename from the repackage directory.
static rpmRC _rpmtsAddRollbackElement (rpmts rollbackTransaction, rpmts runningTransaction, rpmte te)
 This is not a generalized function to be called from outside librpm.
int rpmtsRun (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
 Process all package elements in a transaction set.

Variables

int _fps_debug = 0
static int _linear_fps_search = 0


Detailed Description

Definition in file transaction.c.


Define Documentation

#define _RPMFI_INTERNAL

Definition at line 19 of file transaction.c.

#define _RPMTE_INTERNAL

Definition at line 22 of file transaction.c.

#define _RPMTS_INTERNAL

Definition at line 25 of file transaction.c.

#define ISROOT ( _d   )     (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))

Definition at line 301 of file transaction.c.

Referenced by findFps(), and fpsCompare().

#define NOTIFY ( _ts,
_al   )     /*@i@*/ if ((_ts)->notify) (void) (_ts)->notify _al

Definition at line 1404 of file transaction.c.

Referenced by rpmtsRun().


Function Documentation

static rpmRC _rpmtsAddRollbackElement ( rpmts  rollbackTransaction,
rpmts  runningTransaction,
rpmte  te 
) [static]

This is not a generalized function to be called from outside librpm.

It is called internally by rpmtsRun() to add elements to its autorollback transaction.

Parameters:
rollbackTransaction rollback transaction
runningTransaction running transaction (the one you want to rollback)
te Transaction element.
Returns:
RPMRC_OK, or RPMRC_FAIL

Definition at line 1254 of file transaction.c.

References _, getRepackageHeaderFromTE(), headerFree(), headerLink(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbNextIterator(), RPMMESS_DEBUG, RPMMESS_FATALERROR, rpmMessage, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, rpmteDBInstance(), rpmteN(), rpmteNEVRA(), rpmteType(), rpmtsAddEraseElement(), rpmtsAddInstallElement(), rpmtsiFree, rpmtsiInit, rpmtsiNext(), rpmtsInitIterator(), TR_ADDED, and TR_REMOVED.

Referenced by rpmtsRun().

static rpmRC _rpmtsRollback ( rpmts  rollbackTransaction  )  [static]

This is not a generalized function to be called from outside librpm.

It is called internally by rpmtsRun() to rollback a failed transaction.

Parameters:
rollbackTransaction rollback transaction
Returns:
RPMRC_OK, or RPMRC_FAIL

Definition at line 990 of file transaction.c.

References _, RPMMESS_ERROR, RPMMESS_NORMAL, rpmMessage, RPMPROB_FILTER_OLDPACKAGE, RPMPROB_FILTER_REPLACENEWFILES, RPMPROB_FILTER_REPLACEOLDFILES, RPMPROB_FILTER_REPLACEPKG, rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), rpmteType(), rpmtsCheck(), rpmtsFree(), rpmtsGetTid(), rpmtsiFree, rpmtsiInit, rpmtsiNext(), rpmtsOrder(), rpmtsProblems(), rpmtsRun(), TR_ADDED, and TR_REMOVED.

Referenced by rpmtsRun().

static int archOkay ( const char *  pkgArch  )  [static]

Definition at line 75 of file transaction.c.

References RPM_MACHTABLE_INSTARCH, and rpmMachineScore().

Referenced by ftsStashLatest(), and rpmtsRun().

static int ensureOlder ( rpmts  ts,
const rpmte  p,
const Header  h 
) [static]

Ensure that current package is newer than installed package.

Parameters:
ts transaction set
p current transaction element
h installed header
Returns:
0 if not newer, 1 if okay

Definition at line 680 of file transaction.c.

References _free(), _rpmds_nopromote, alloca(), hGetNEVR(), rpmdsFree(), rpmdsNVRMatchesDep(), rpmdsSingle(), RPMPROB_OLDPACKAGE, rpmpsAppend(), rpmpsFree(), RPMSENSE_EQUAL, RPMSENSE_LESS, RPMTAG_REQUIRENAME, rpmteE(), rpmteKey(), rpmteN(), rpmteNEVR(), rpmteR(), rpmteV(), rpmtsProblems(), and stpcpy().

Referenced by rpmtsRun().

static int findFps ( const struct fingerPrint_s fiFps,
const struct fingerPrint_s otherFps,
int  otherFc 
) [static]

Definition at line 361 of file transaction.c.

References _fps_debug, _linear_fps_search, fingerPrint_s::baseName, fprintCacheEntry_s::dirName, fingerPrint_s::entry, FP_EQUAL, fpsCompare(), ISROOT, and fingerPrint_s::subDir.

Referenced by handleOverlappedFiles().

static int fpsCompare ( const void *  one,
const void *  two 
) [static]

Definition at line 306 of file transaction.c.

References _fps_debug, alloca(), fingerPrint_s::baseName, fprintCacheEntry_s::dirName, fingerPrint_s::entry, ISROOT, stpcpy(), and fingerPrint_s::subDir.

Referenced by findFps().

static rpmRC getRepackageHeaderFromTE ( rpmts  ts,
rpmte  te,
Header hdrp,
const char **  fnp 
) [static]

Get the repackaged header and filename from the repackage directory.

Todo:
Find a suitable home for this function.
Todo:
This function creates an IDTX everytime it is called. Needs to be made more efficient (only create on per running transaction).
Parameters:
ts rpm transaction
te transaction element
Return values:
hdrp Repackaged header
fnp Repackaged package's path (transaction key)
Returns:
RPMRC_NOTFOUND or RPMRC_OK

Definition at line 1115 of file transaction.c.

References _, _free(), IDT_s::h, headerFree(), headerGetEntry(), headerLink(), IDTindex_s::idt, IDTXfree(), IDTXglob(), IDT_s::key, IDTindex_s::nidt, rpmExpand(), RPMMESS_DEBUG, rpmMessage, RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_NAME, RPMTAG_REMOVETID, rpmteN(), rpmtsGetTid(), snprintf(), IDT_s::u32, and IDT_s::val.

Referenced by _rpmtsAddRollbackElement().

static int handleInstInstalledFiles ( const rpmts  ts,
rpmte  p,
rpmfi  fi,
sharedFileInfo  shared,
int  sharedCount,
int  reportConflicts 
) [static]

Parameters:
ts transaction set

Parameters:
p 
fi file info set
shared 
sharedCount 
reportConflicts 

Definition at line 117 of file transaction.c.

References _free(), CPIO_SBIT_CHECK, FA_CREATE, FA_SKIPCOLOR, hGetNEVR(), omode, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbNextIterator(), rpmfiBN(), rpmfiCompare(), rpmfiDecideFate(), rpmfiDN(), rpmfiFColor(), rpmfiFFlags(), rpmfiFMode(), rpmfiFree(), rpmfiFSize(), rpmfiInit(), RPMFILE_CONFIG, RPMFILE_GHOST, RPMFILE_STATE_NORMAL, rpmfiNew(), rpmfiNext(), rpmfiSetFX(), RPMPROB_FILE_CONFLICT, rpmpsAppend(), rpmpsFree(), RPMTAG_BASENAMES, rpmteColor(), rpmteKey(), rpmteNEVR(), RPMTRANS_FLAG_ALLFILES, rpmtsColor(), rpmtsFlags(), rpmtsInitIterator(), rpmtsPrefColor(), rpmtsProblems(), xcalloc(), XFA_SKIPPING, and xrealloc().

Referenced by rpmtsRun().

static void handleOverlappedFiles ( const rpmts  ts,
const rpmte  p,
rpmfi  fi 
) [static]

Update disk space needs on each partition for this package's files.

Definition at line 454 of file transaction.c.

References fprintCacheEntry_s::dev, domd5(), fingerPrint_s::entry, FA_ALTNAME, FA_BACKUP, FA_CREATE, FA_ERASE, FA_SKIP, FA_SKIPCOLOR, FA_UNKNOWN, findFps(), htGetEntry(), recs, rpmfiCompare(), rpmfiConfigConflict(), rpmfiFC(), rpmfiFColor(), rpmfiFFlags(), rpmfiFMode(), rpmfiFN(), rpmfiFSize(), rpmfiFState(), rpmfiInit(), RPMFILE_CONFIG, RPMFILE_NOREPLACE, RPMFILE_STATE_NORMAL, rpmfiMD5(), rpmfiNext(), rpmfiSetFX(), RPMPROB_FILTER_REPLACENEWFILES, RPMPROB_NEW_FILE_CONFLICT, rpmpsAppend(), rpmpsFree(), rpmteKey(), rpmteNEVR(), rpmteType(), rpmtsColor(), rpmtsFilterFlags(), rpmtsPrefColor(), rpmtsProblems(), rpmtsUpdateDSI(), TR_ADDED, TR_REMOVED, and XFA_SKIPPING.

Referenced by rpmtsRun().

static int handleRmvdInstalledFiles ( const rpmts  ts,
rpmfi  fi,
sharedFileInfo  shared,
int  sharedCount 
) [static]

Definition at line 261 of file transaction.c.

References FA_SKIP, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbNextIterator(), RPMFILE_STATE_NORMAL, RPMTAG_FILESTATES, and rpmtsInitIterator().

Referenced by rpmtsRun().

static int osOkay ( const char *  pkgOs  )  [static]

Definition at line 84 of file transaction.c.

References RPM_MACHTABLE_INSTOS, and rpmMachineScore().

Referenced by ftsStashLatest(), and rpmtsRun().

static rpmfi rpmtsiFi ( const rpmtsi  tsi  )  [static]

Return transaction element's file info.

Todo:
Take a rpmfi refcount here.
Parameters:
tsi transaction element iterator
Returns:
transaction element file info

Definition at line 964 of file transaction.c.

References rpmtsElement().

Referenced by rpmtsRun().

static int sharedCmp ( const void *  one,
const void *  two 
) [static]

Definition at line 93 of file transaction.c.

Referenced by rpmtsRun().

static void skipFiles ( const rpmts  ts,
rpmfi  fi 
) [static]

Skip any files that do not match install policies.

Parameters:
ts transaction set
fi file info set

Definition at line 733 of file transaction.c.

References _, _free(), alloca(), FA_SKIPCOLOR, FA_SKIPNETSHARED, FA_SKIPNSTATE, freeSplitString(), lang, rpmExpand(), rpmExpandNumeric(), rpmfiBN(), rpmfiDC(), rpmfiDN(), rpmfiDX(), rpmfiFColor(), rpmfiFFlags(), rpmfiFMode(), rpmfiInit(), rpmfiInitD(), RPMFILE_CONFIG, RPMFILE_DOC, rpmfiNext(), rpmfiNextD(), RPMMESS_DEBUG, rpmMessage, RPMTRANS_FLAG_NOCONFIGS, RPMTRANS_FLAG_NODOCS, rpmtsColor(), rpmtsFlags(), splitString(), whatis(), XDIR, and XFA_SKIPPING.

Referenced by rpmtsRun().


Variable Documentation

int _fps_debug = 0

Definition at line 304 of file transaction.c.

int _linear_fps_search = 0 [static]

Definition at line 359 of file transaction.c.

Referenced by findFps().


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2