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

# Transaction Set API.

## Files

file | depends.c
file | psm.c
| Package state machine to handle a package from a transaction set.

file | rpmte.h
| Structures used for an "rpmte" transaction element.

file | rpmts.h
| Structures and prototypes used for an "rpmts" transaction set.

file | rpmvercmp.c
file | transaction.c

## Functions

int | rpmtsCheck (rpmts ts)
int | rpmtsOrder (rpmts ts)
int | rpmtsRun (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
rpmts | rpmtsUnlink (rpmts ts, const char *msg)
rpmts | rpmtsLink (rpmts ts, const char *msg)
int | rpmtsCloseDB (rpmts ts)
int | rpmtsOpenDB (rpmts ts, int dbmode)
int | rpmtsInitDB (rpmts ts, int dbmode)
int | rpmtsRebuildDB (rpmts ts)
int | rpmtsVerifyDB (rpmts ts)
rpmdbMatchIterator | rpmtsInitIterator (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
int | rpmtsCloseSDB (rpmts ts)
int | rpmtsOpenSDB (rpmts ts, int dbmode)
void | rpmtsCleanDig (rpmts ts)
void | rpmtsClean (rpmts ts)
void | rpmtsEmpty (rpmts ts)
rpmts | rpmtsFree (rpmts ts)
rpmVSFlags | rpmtsVSFlags (rpmts ts)
rpmVSFlags | rpmtsSetVSFlags (rpmts ts, rpmVSFlags vsflags)
int | rpmtsUnorderedSuccessors (rpmts ts, int first)
const char * | rpmtsRootDir (rpmts ts)
void | rpmtsSetRootDir (rpmts ts, const char *rootDir)
const char * | rpmtsCurrDir (rpmts ts)
void | rpmtsSetCurrDir (rpmts ts, const char *currDir)
FD_t | rpmtsScriptFd (rpmts ts)
void | rpmtsSetScriptFd (rpmts ts, FD_t scriptFd)
int | rpmtsChrootDone (rpmts ts)
int | rpmtsSetChrootDone (rpmts ts, int chrootDone)
int_32 | rpmtsGetTid (rpmts ts)
int_32 | rpmtsSetTid (rpmts ts, int_32 tid)
int_32 | rpmtsSigtag (const rpmts ts)
int_32 | rpmtsSigtype (const rpmts ts)
const void * | rpmtsSig (const rpmts ts)
int_32 | rpmtsSiglen (const rpmts ts)
int | rpmtsSetSig (rpmts ts, int_32 sigtag, int_32 sigtype, const void *sig, int_32 siglen)
pgpDig | rpmtsDig (rpmts ts)
pgpDigParams | rpmtsSignature (const rpmts ts)
pgpDigParams | rpmtsPubkey (const rpmts ts)
rpmdb | rpmtsGetRdb (rpmts ts)
int | rpmtsInitDSI (const rpmts ts)
void | rpmtsUpdateDSI (const rpmts ts, dev_t dev, uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize, fileAction action)
void | rpmtsCheckDSIProblems (const rpmts ts, const rpmte te)
rpmprobFilterFlags | rpmtsFilterFlags (rpmts ts)
rpmtransFlags | rpmtsFlags (rpmts ts)
rpmtransFlags | rpmtsSetFlags (rpmts ts, rpmtransFlags transFlags)
int | rpmtsSetNotifyCallback (rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
rpmts | rpmtsCreate (void)
int | rpmtsAddInstallElement (rpmts ts, Header h, const fnpyKey key, int upgrade, rpmRelocation *relocs)
int | rpmtsAddEraseElement (rpmts ts, Header h, int dboffset)
int | rpmtsGetKeys (rpmts ts, fnpyKey **ep, int *nep)

## Function Documentation

int rpmtsAddEraseElement | ( | rpmts | ts,
|  | Header | h,
|  | int | dboffset
| ) |

Add package to be erased to transaction set.

Parameters:

  ts | transaction set
  h | header
  dboffset | rpm database instance

Returns:
  0 on success

Definition at line 322 of file depends.c.

Referenced by rpmErase, rpmRollback, and rpmts_AddErase.

int rpmtsAddInstallElement | ( | rpmts | ts,
|  | Header | h,
|  | const fnpyKey | key,
|  | int | upgrade,
|  | rpmRelocation * | relocs
| ) |

Add package to be installed to transaction set.

The transaction set is checked for duplicate package names. If found, the package with the "newest" EVR will be replaced.

Parameters:

  ts | transaction set
  h | header
  key | package retrieval key (e.g. file name)
  upgrade | is package being upgraded?
  relocs | package file relocations

Returns:
  0 on success, 1 on I/O error, 2 needs capabilities

Definition at line 127 of file depends.c.

References rpmprobFilterFlags.

Referenced by checkSpec, rpmGraph, rpmInstall, rpmRollback, rpmts_AddInstall, rpmtsSolve, and verifyDependencies.

int rpmtsCheck | ( | rpmts | ts | ) |

Check that all dependencies can be resolved.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 1601 of file depends.c.

Referenced by checkSpec, rpmErase, rpmGraph, rpmInstall, rpmRollback, rpmts_Check, and verifyDependencies.

void rpmtsCheckDSIProblems | ( | const rpmts | ts,
|  | const rpmte | te
| ) |

Check a transaction element for disk space problems.

Parameters:

  ts | transaction set
  te | current transaction element

Definition at line 1010 of file rpmts.c.

int rpmtsChrootDone | ( | rpmts | ts | ) |

Get chrootDone flag, i.e. has chroot(2) been performed?

Parameters:

  ts | transaction set

Returns:
  chrootDone flag

Definition at line 762 of file rpmts.c.

void rpmtsClean | ( | rpmts | ts | ) |

Free memory needed only for dependency checks and ordering.

Parameters:

  ts | transaction set

Definition at line 558 of file rpmts.c.

Referenced by checkSpec, rpmcliImportPubkeys, rpmErase, rpmInstall, rpmRollback, rpmts_Clean, rpmtsEmpty, and rpmtsOrder.

void rpmtsCleanDig | ( | rpmts | ts | ) |

Free signature verification data.

Parameters:

  ts | transaction set

Definition at line 552 of file rpmts.c.

Referenced by headerCheck, rpmReadPackageFile, rpmtsClean, and rpmVerifySignatures.

int rpmtsCloseDB | ( | rpmts | ts | ) |

Close the database used by the transaction.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 107 of file rpmts.c.

References rpmds, rpmtransFlags, and rpmts.

Referenced by ftsCacheUpdate, rpmts_CloseDB, rpmts_InitDB, rpmtsCheck, rpmtsFree, and rpmtsOpenDB.

int rpmtsCloseSDB | ( | rpmts | ts | ) |

Close the database used by the transaction to solve dependencies.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 287 of file rpmts.c.

References rpmts.

Referenced by rpmtsFree.

rpmts rpmtsCreate | ( | void |  | ) |

Create an empty transaction set.

Returns:
  new transaction set

Definition at line 1144 of file rpmts.c.

const char* rpmtsCurrDir | ( | rpmts | ts | ) |

Get transaction currDir, i.e. current directory before chroot(2).

Parameters:

  ts | transaction set

Returns:
  transaction currDir

Definition at line 720 of file rpmts.c.

pgpDig rpmtsDig | ( | rpmts | ts | ) |

Get OpenPGP packet parameters, i.e. signature/pubkey constants.

Parameters:

  ts | transaction set

Returns:
  signature/pubkey constants.

Definition at line 850 of file rpmts.c.

Referenced by headerCheck, rpmReadPackageFile, rpmtsFindPubkey, rpmtsPubkey, rpmtsSignature, rpmtsStashKeyid, rpmVerifySignature, rpmVerifySignatures, verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, verifySHA1Signature, and verifySizeSignature.

void rpmtsEmpty | ( | rpmts | ts | ) |

Re-create an empty transaction set.

Parameters:

  ts | transaction set

Definition at line 582 of file rpmts.c.

Referenced by rpmcliQuery, rpmcliVerify, rpmErase, rpmInstall, rpmQueryVerify, rpmRollback, rpmtsFree, and verifyDependencies.

rpmprobFilterFlags rpmtsFilterFlags | ( | rpmts | ts | ) |

Get problem ignore bit mask, i.e. bits to filter encountered problems.

Parameters:

  ts | transaction set

Returns:
  ignore bit mask

Definition at line 1084 of file rpmts.c.

Referenced by rpmtsInitDSI.

rpmtransFlags rpmtsFlags | ( | rpmts | ts | ) |

Get transaction flags, i.e. bits that control rpmtsRun().

Parameters:

  ts | transaction set

Returns:
  transaction flags

Definition at line 1089 of file rpmts.c.

Referenced by rpmErase, rpmGraph, rpmInstall, rpmtsOrder, unsatisfiedDepend, and XrpmtsiInit.

rpmts rpmtsFree | ( | rpmts | ts | ) |

Destroy transaction set, closing the database as well.

Parameters:

  ts | transaction set

Returns:
  NULL always

Definition at line 609 of file rpmts.c.

References fileAction, int_32, rpmte, rpmts, and uint_32.

Referenced by cpio_doio, main, readRPM, rpmts_dealloc, and XrpmtsiFree.

int rpmtsGetKeys | ( | rpmts | ts,
|  | fnpyKey ** | ep,
|  | int * | nep
| ) |

Retrieve keys from ordered transaction set.

Todo:
  Removed packages have no keys, returned as interleaved NULL pointers.

Parameters:

  ts | transaction set

Return values:

  ep | address of returned element array pointer (or NULL)
  nep | address of no. of returned elements (or NULL)

Returns:
  0 always

Definition at line 1114 of file rpmts.c.

Referenced by rpmts_GetKeys.

rpmdb rpmtsGetRdb | ( | rpmts | ts | ) |

Get transaction set database handle.

Parameters:

  ts | transaction set

Returns:
  transaction database handle

Definition at line 879 of file rpmts.c.

Referenced by checkDependentConflicts, ftsCacheUpdate, rpmcliImportPubkey, rpmtsAddInstallElement, rpmtsCheck, and unsatisfiedDepend.

int_32 rpmtsGetTid | ( | rpmts | ts | ) |

Get transaction id, i.e. transaction time stamp.

Parameters:

  ts | transaction set

Returns:
  chrootDone flag

Definition at line 783 of file rpmts.c.

Referenced by ftsCacheUpdate, and rpmcliImportPubkey.

int rpmtsInitDB | ( | rpmts | ts,
|  | int | dbmode
| ) |

Initialize the database used by the transaction.

Deprecated:
  An explicit rpmdbInit() is almost never needed.

Parameters:

  ts | transaction set
  dbmode | O_RDONLY or O_RDWR

Returns:
  0 on success

Definition at line 141 of file rpmts.c.

Referenced by main, and rpmts_InitDB.

int rpmtsInitDSI | ( | const rpmts | ts | ) |

Initialize disk space info for each and every mounted file systems.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 890 of file rpmts.c.

rpmdbMatchIterator rpmtsInitIterator | ( | const rpmts | ts,
|  | rpmTag | rpmtag,
|  | const void * | keyp,
|  | size_t | keylen
| ) |

Return transaction database iterator.

Parameters:

  ts | transaction set
  rpmtag | rpm tag
  keyp | key data (NULL for sequential access)
  keylen | key data length (0 will use strlen(keyp))

Returns:
  NULL on failure

Definition at line 161 of file rpmts.c.

Referenced by checkDependentConflicts, checkDependentPackages, ftsCacheUpdate, IDTXload, rpmErase, rpmInstall, rpmQueryVerify, rpmts_AddErase, rpmts_Match, rpmtsAddInstallElement, rpmtsFindPubkey, and unsatisfiedDepend.

rpmts rpmtsLink | ( | rpmts | ts,
|  | const char * | msg
| ) |

Reference a transaction set instance.

Parameters:

  ts | transaction set
  msg |

Returns:
  new transaction set reference

int rpmtsOpenDB | ( | rpmts | ts,
|  | int | dbmode
| ) |

Open the database used by the transaction.

Parameters:

  ts | transaction set
  dbmode | O_RDONLY or O_RDWR

Returns:
  0 on success

Definition at line 118 of file rpmts.c.

Referenced by ftsCacheUpdate, rpmcliImportPubkey, rpmts_Match, rpmts_OpenDB, rpmtsAddInstallElement, rpmtsCheck, and rpmtsInitIterator.

int rpmtsOpenSDB | ( | rpmts | ts,
|  | int | dbmode
| ) |

Open the database used by the transaction to solve dependencies.

Parameters:

  ts | transaction set
  dbmode | O_RDONLY or O_RDWR

Returns:
  0 on success

Definition at line 298 of file rpmts.c.

References int_32, rpmds, rpmRC, rpmTag, rpmts, and rpmVSFlags.

Referenced by rpmtsSolve.

int rpmtsOrder | ( | rpmts | ts | ) |

Determine package order in a transaction set according to dependencies.

Order packages, returning error if circular dependencies cannot be eliminated by removing Requires's from the loop(s). Only dependencies from added or removed packages are used to determine ordering using a topological sort (Knuth vol. 1, p. 262). Use rpmtsCheck() to verify that all dependencies can be resolved.

The final order ends up as installed packages followed by removed packages, with packages removed for upgrades immediately following the new package to be installed.

Parameters:

  ts | transaction set

Returns:
  no. of (added) packages that could not be ordered

Definition at line 1149 of file depends.c.

Referenced by rpmGraph, rpmInstall, rpmRollback, and rpmts_Order.

pgpDigParams rpmtsPubkey | ( | const rpmts | ts | ) |

Get OpenPGP pubkey constants.

Parameters:

  ts | transaction set

Returns:
  pubkey constants.

Definition at line 870 of file rpmts.c.

int rpmtsRebuildDB | ( | rpmts | ts | ) |

Rebuild the database used by the transaction.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 146 of file rpmts.c.

Referenced by main, and rpmts_RebuildDB.

const char* rpmtsRootDir | ( | rpmts | ts | ) |

Get transaction rootDir, i.e. path to chroot(2).

Parameters:

  ts | transaction set

Returns:
  transaction rootDir

Definition at line 687 of file rpmts.c.

Referenced by rpmInstall, and rpmVerifyFile.

int rpmtsRun | ( | rpmts | ts,
|  | rpmps | okProbs,
|  | rpmprobFilterFlags | ignoreSet
| ) |

Process all package elements in a transaction set.

Parameters:

  ts | transaction set
  okProbs | previously known problems (or NULL)
  ignoreSet | bits to filter problem types

Returns:
  0 on success, -1 on error, >0 with newProbs set

Referenced by rpmErase, rpmInstall, rpmRollback, and rpmts_Run.

FD_t rpmtsScriptFd | ( | rpmts | ts | ) |

Get transaction script file handle, i.e. stdout/stderr on scriptlet execution

Parameters:

  ts | transaction set

Returns:
  transaction script file handle

Definition at line 738 of file rpmts.c.

int rpmtsSetChrootDone | ( | rpmts | ts,
|  | int | chrootDone
| ) |

Set chrootDone flag, i.e. has chroot(2) been performed?

Parameters:

  ts | transaction set
  chrootDone | new chrootDone flag

Returns:
  previous chrootDone flag

Definition at line 771 of file rpmts.c.

void rpmtsSetCurrDir | ( | rpmts | ts,
|  | const char * | currDir
| ) |

Set transaction currDir, i.e. current directory before chroot(2).

Parameters:

  ts | transaction set
  currDir | new transaction currDir (or NULL)

Definition at line 729 of file rpmts.c.

rpmtransFlags rpmtsSetFlags | ( | rpmts | ts,
|  | rpmtransFlags | transFlags
| ) |

Set transaction flags, i.e. bits that control rpmtsRun().

Parameters:

  ts | transaction set
  transFlags | new transaction flags

Returns:
  previous transaction flags

Definition at line 1094 of file rpmts.c.

Referenced by rpmErase, rpmGraph, rpmInstall, rpmRollback, rpmts_Rollback, and rpmts_SetFlags.

int rpmtsSetNotifyCallback | ( | rpmts | ts,
|  | rpmCallbackFunction | notify,
|  | rpmCallbackData | notifyData
| ) |

Set transaction notify callback function and argument.

Warning:
  This call must be made before rpmtsRun() for install/upgrade/freshen to function correctly.

Parameters:

  ts | transaction set
  notify | progress callback
  notifyData | progress callback private data

Returns:
  0 on success

Definition at line 1104 of file rpmts.c.

Referenced by rpmErase, rpmInstall, rpmRollback, and rpmts_Run.

void rpmtsSetRootDir | ( | rpmts | ts,
|  | const char * | rootDir
| ) |

Set transaction rootDir, i.e. path to chroot(2).

Parameters:

  ts | transaction set
  rootDir | new transaction rootDir (or NULL)

Definition at line 692 of file rpmts.c.

References rpmprobFilterFlags, rpmte, rpmtransFlags, and rpmts.

Referenced by main, and rpmts_Create.

void rpmtsSetScriptFd | ( | rpmts | ts,
|  | FD_t | scriptFd
| ) |

Set transaction script file handle, i.e. stdout/stderr on scriptlet execution

Parameters:

  ts | transaction set
  scriptFd | new script file handle (or NULL)

Definition at line 749 of file rpmts.c.

References rpmts.

Referenced by rpmts_setattr, and rpmVerifyScript.

int rpmtsSetSig | ( | rpmts | ts,
|  | int_32 | sigtag,
|  | int_32 | sigtype,
|  | const void * | sig,
|  | int_32 | siglen
| ) |

Set signature tag info, i.e. from header.

Parameters:

  ts | transaction set
  sigtag | signature tag
  sigtype | signature tag type
  sig | signature tag data
  siglen | signature tag data length

Returns:
  0 always

Definition at line 834 of file rpmts.c.

Referenced by headerCheck, rpmReadPackageFile, and rpmVerifySignatures.

int_32 rpmtsSetTid | ( | rpmts | ts,
|  | int_32 | tid
| ) |

Set transaction id, i.e. transaction time stamp.

Parameters:

  ts | transaction set
  tid | new transaction id

Returns:
  previous transaction id

Definition at line 792 of file rpmts.c.

Referenced by main.

rpmVSFlags rpmtsSetVSFlags | ( | rpmts | ts,
|  | rpmVSFlags | vsflags
| ) |

Set verify signatures flag(s).

Parameters:

  ts | transaction set
  vsflags | new verify signatures flags

Returns:
  previous value

Definition at line 666 of file rpmts.c.

Referenced by build, main, rpmcliQuery, rpmcliVerify, rpmErase, rpmGraph, rpmInstall, rpmInstallSource, rpmRollback, rpmts_Create, and rpmts_SetVSFlags.

const void* rpmtsSig | ( | const rpmts | ts | ) |

Get signature tag data, i.e. from header.

Parameters:

  ts | transaction set

Returns:
  signature tag data

Definition at line 818 of file rpmts.c.

Referenced by rpmtsFindPubkey, rpmtsStashKeyid, rpmVerifySignature, verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, verifySHA1Signature, and verifySizeSignature.

int_32 rpmtsSiglen | ( | const rpmts | ts | ) |

Get signature tag data length, i.e. no. of bytes of data.

Parameters:

  ts | transaction set

Returns:
  signature tag data length

Definition at line 826 of file rpmts.c.

Referenced by rpmVerifySignature, verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, and verifySHA1Signature.

pgpDigParams rpmtsSignature | ( | const rpmts | ts | ) |

Get OpenPGP signature constants.

Parameters:

  ts | transaction set

Returns:
  signature constants.

Definition at line 861 of file rpmts.c.

Referenced by rpmtsFindPubkey, rpmtsStashKeyid, rpmVerifySignatures, verifyGPGSignature, and verifyPGPSignature.

int_32 rpmtsSigtag | ( | const rpmts | ts | ) |

Get signature tag.

Parameters:

  ts | transaction set

Returns:
  signature tag

Definition at line 802 of file rpmts.c.

Referenced by rpmVerifySignature, verifyGPGSignature, and verifyPGPSignature.

int_32 rpmtsSigtype | ( | const rpmts | ts | ) |

Get signature tag type.

Parameters:

  ts | transaction set

Returns:
  signature tag type

Definition at line 810 of file rpmts.c.

rpmts rpmtsUnlink | ( | rpmts | ts,
|  | const char * | msg
| ) |

Unreference a transaction instance.

Parameters:

  ts | transaction set
  msg |

Returns:
  NULL always

int rpmtsUnorderedSuccessors | ( | rpmts | ts,
|  | int | first
| ) |

Set index of 1st element of successors.

Parameters:

  ts | transaction set
  first | new index of 1st element of successors

Returns:
  previous value

Definition at line 676 of file rpmts.c.

Referenced by rpmtsOrder.

void rpmtsUpdateDSI | ( | const rpmts | ts,
|  | dev_t | dev,
|  | uint_32 | fileSize,
|  | uint_32 | prevSize,
|  | uint_32 | fixupSize,
|  | fileAction | action
| ) |

Update disk space info for a file.

Parameters:

  ts | transaction set
  dev | mount point device
  fileSize | file size
  prevSize | previous file size (if upgrading)
  fixupSize | size difference (if
  action | file disposition

Definition at line 960 of file rpmts.c.

int rpmtsVerifyDB | ( | rpmts | ts | ) |

Verify the database used by the transaction.

Parameters:

  ts | transaction set

Returns:
  0 on success

Definition at line 156 of file rpmts.c.

References rpmte.

Referenced by main, and rpmts_VerifyDB.

rpmVSFlags rpmtsVSFlags | ( | rpmts | ts | ) |

Get verify signatures flag(s).

Parameters:

  ts | transaction set

Returns:
  verify signatures flags

Definition at line 658 of file rpmts.c.

Referenced by headerCheck, rpmInstallSource, and rpmReadPackageFile.