rpm  4.18.0
About: RPM - The Red Hat Package Manager (rpm.org). See also the rpm 5 releases for Unix (not only Linux).
  Fossies Dox: rpm-4.18.0.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
Transaction Set API.

How to create, run & destroy a package transaction. More...

Collaboration diagram for Transaction Set API.:

Files

file  rpmte.h
 Structures used for an "rpmte" transaction element.
 
file  rpmts.h
 Structures and prototypes used for an "rpmts" transaction set.
 
file  depends.c
 
file  depends.c
 
file  psm.c
 Package state machine to handle a package from a transaction set.
 
file  transaction.c
 

Data Structures

struct  rpmts_s
 The set of packages to be installed/removed atomically. More...
 

Typedefs

typedef void *(* rpmCallbackFunction) (const void *h, const rpmCallbackType what, const rpm_loff_t amount, const rpm_loff_t total, fnpyKey key, rpmCallbackData data)
 Function pointer type for rpmtsSetNotifyCallback() triggered by rpmtsNotify() More...
 
typedef enum rpmtsOpX_e rpmtsOpX
 Indices for timestamps. More...
 
typedef int(* rpmtsChangeFunction) (int event, rpmte te, rpmte other, void *data)
 Transaction change callback type. More...
 

Enumerations

enum  rpmtransFlags_e {
  RPMTRANS_FLAG_NONE = 0 , RPMTRANS_FLAG_TEST = (1 << 0) , RPMTRANS_FLAG_BUILD_PROBS = (1 << 1) , RPMTRANS_FLAG_NOSCRIPTS = (1 << 2) ,
  RPMTRANS_FLAG_JUSTDB = (1 << 3) , RPMTRANS_FLAG_NOTRIGGERS = (1 << 4) , RPMTRANS_FLAG_NODOCS = (1 << 5) , RPMTRANS_FLAG_ALLFILES = (1 << 6) ,
  RPMTRANS_FLAG_NOPLUGINS = (1 << 7) , RPMTRANS_FLAG_NOCONTEXTS = (1 << 8) , RPMTRANS_FLAG_NOCAPS = (1 << 9) , RPMTRANS_FLAG_NODB = (1 << 10) ,
  RPMTRANS_FLAG_NOTRIGGERPREIN = (1 << 16) , RPMTRANS_FLAG_NOPRE = (1 << 17) , RPMTRANS_FLAG_NOPOST = (1 << 18) , RPMTRANS_FLAG_NOTRIGGERIN = (1 << 19) ,
  RPMTRANS_FLAG_NOTRIGGERUN = (1 << 20) , RPMTRANS_FLAG_NOPREUN = (1 << 21) , RPMTRANS_FLAG_NOPOSTUN = (1 << 22) , RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23) ,
  RPMTRANS_FLAG_NOPRETRANS = (1 << 24) , RPMTRANS_FLAG_NOPOSTTRANS = (1 << 25) , RPMTRANS_FLAG_NOMD5 = (1 << 27) , RPMTRANS_FLAG_NOFILEDIGEST = (1 << 27) ,
  RPMTRANS_FLAG_NOARTIFACTS = (1 << 29) , RPMTRANS_FLAG_NOCONFIGS = (1 << 30) , RPMTRANS_FLAG_DEPLOOPS = (1 << 31)
}
 Bit(s) to control rpmtsRun() operation. More...
 
enum  rpmVSFlags_e {
  RPMVSF_DEFAULT = 0 , RPMVSF_NOHDRCHK = (1 << 0) , RPMVSF_NEEDPAYLOAD = (1 << 1) , RPMVSF_NOSHA1HEADER = (1 << 8) ,
  RPMVSF_NOSHA256HEADER = (1 << 9) , RPMVSF_NODSAHEADER = (1 << 10) , RPMVSF_NORSAHEADER = (1 << 11) , RPMVSF_NOPAYLOAD = (1 << 16) ,
  RPMVSF_NOMD5 = (1 << 17) , RPMVSF_NODSA = (1 << 18) , RPMVSF_NORSA = (1 << 19)
}
 Bit(s) to control digest and signature verification. More...
 
enum  rpmtsOpX_e {
  RPMTS_OP_TOTAL = 0 , RPMTS_OP_CHECK = 1 , RPMTS_OP_ORDER = 2 , RPMTS_OP_FINGERPRINT = 3 ,
  RPMTS_OP_INSTALL = 5 , RPMTS_OP_ERASE = 6 , RPMTS_OP_SCRIPTLETS = 7 , RPMTS_OP_COMPRESS = 8 ,
  RPMTS_OP_UNCOMPRESS = 9 , RPMTS_OP_DIGEST = 10 , RPMTS_OP_SIGNATURE = 11 , RPMTS_OP_DBADD = 12 ,
  RPMTS_OP_DBREMOVE = 13 , RPMTS_OP_DBGET = 14 , RPMTS_OP_DBPUT = 15 , RPMTS_OP_DBDEL = 16 ,
  RPMTS_OP_VERIFY = 17 , RPMTS_OP_MAX = 18
}
 Indices for timestamps. More...
 

Functions

int rpmtsCheck (rpmts ts)
 Perform dependency resolution on the transaction set. More...
 
int rpmtsOrder (rpmts ts)
 Determine package order in a transaction set according to dependencies. More...
 
int rpmtsRun (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
 Process all package elements in a transaction set. More...
 
rpmts rpmtsLink (rpmts ts)
 Reference a transaction set instance. More...
 
int rpmtsCloseDB (rpmts ts)
 Close the database used by the transaction. More...
 
int rpmtsOpenDB (rpmts ts, int dbmode)
 Open the database used by the transaction. More...
 
int rpmtsInitDB (rpmts ts, int perms)
 Initialize the database used by the transaction. More...
 
int rpmtsGetDBMode (rpmts ts)
 Return the transaction database mode. More...
 
int rpmtsSetDBMode (rpmts ts, int dbmode)
 Set the transaction database mode. More...
 
int rpmtsRebuildDB (rpmts ts)
 Rebuild the database used by the transaction. More...
 
int rpmtsVerifyDB (rpmts ts)
 Verify the database used by the transaction. More...
 
rpmdbMatchIterator rpmtsInitIterator (const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)
 Return transaction database iterator. More...
 
rpmRC rpmtsImportHeader (rpmtxn txn, Header h, rpmFlags flags)
 Import a header into the rpmdb. More...
 
rpmRC rpmtsImportPubkey (rpmts ts, const unsigned char *pkt, size_t pktlen)
 Import public key packet(s). More...
 
rpmKeyring rpmtsGetKeyring (rpmts ts, int autoload)
 Retrieve handle for keyring used for this transaction set. More...
 
int rpmtsSetKeyring (rpmts ts, rpmKeyring keyring)
 Set keyring to use for this transaction set. More...
 
int rpmtsSetSolveCallback (rpmts ts, int(*solve)(rpmts ts, rpmds ds, const void *data), const void *solveData)
 Set dependency solver callback. More...
 
rpmps rpmtsProblems (rpmts ts)
 Return current transaction set problems. More...
 
void rpmtsCleanProblems (rpmts ts)
 Clean current transaction problem set. More...
 
void rpmtsClean (rpmts ts)
 Free memory needed only for dependency checks and ordering. More...
 
void rpmtsEmpty (rpmts ts)
 Re-create an empty transaction set. More...
 
rpmts rpmtsFree (rpmts ts)
 Destroy transaction set, closing the database as well. More...
 
rpmVSFlags rpmtsVSFlags (rpmts ts)
 Get verify signatures flag(s). More...
 
rpmVSFlags rpmtsSetVSFlags (rpmts ts, rpmVSFlags vsflags)
 Set verify signatures flag(s). More...
 
rpmVSFlags rpmtsVfyFlags (rpmts ts)
 Get package verify flag(s). More...
 
rpmVSFlags rpmtsSetVfyFlags (rpmts ts, rpmVSFlags vfyflags)
 Set package verify flag(s). More...
 
int rpmtsVfyLevel (rpmts ts)
 Get enforced package verify level. More...
 
int rpmtsSetVfyLevel (rpmts ts, int vfylevel)
 Set enforced package verify level. More...
 
const char * rpmtsRootDir (rpmts ts)
 Get transaction rootDir, i.e. More...
 
int rpmtsSetRootDir (rpmts ts, const char *rootDir)
 Set transaction rootDir, i.e. More...
 
FD_t rpmtsScriptFd (rpmts ts)
 Get transaction script file handle, i.e. More...
 
void rpmtsSetScriptFd (rpmts ts, FD_t scriptFd)
 Set transaction script file handle, i.e. More...
 
rpm_tid_t rpmtsGetTid (rpmts ts)
 Get transaction id, i.e. More...
 
rpm_tid_t rpmtsSetTid (rpmts ts, rpm_tid_t tid)
 Set transaction id, i.e. More...
 
rpmdb rpmtsGetRdb (rpmts ts)
 Get transaction set database handle. More...
 
void * rpmtsNotify (rpmts ts, rpmte te, rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total)
 Perform transaction progress notify callback. More...
 
int rpmtsNElements (rpmts ts)
 Return number of (ordered) transaction set elements. More...
 
rpmte rpmtsElement (rpmts ts, int ix)
 Return (ordered) transaction set element. More...
 
rpmprobFilterFlags rpmtsFilterFlags (rpmts ts)
 Get problem ignore bit mask, i.e. More...
 
rpmtransFlags rpmtsFlags (rpmts ts)
 Get transaction flags, i.e. More...
 
rpmtransFlags rpmtsSetFlags (rpmts ts, rpmtransFlags transFlags)
 Set transaction flags, i.e. More...
 
rpm_color_t rpmtsColor (rpmts ts)
 Retrieve color bits of transaction set. More...
 
rpm_color_t rpmtsPrefColor (rpmts ts)
 Retrieve preferred file color. More...
 
rpm_color_t rpmtsSetColor (rpmts ts, rpm_color_t color)
 Set color bits of transaction set. More...
 
rpm_color_t rpmtsSetPrefColor (rpmts ts, rpm_color_t color)
 Set preferred file color. More...
 
rpmop rpmtsOp (rpmts ts, rpmtsOpX opx)
 Retrieve operation timestamp from a transaction set. More...
 
rpmPlugins rpmtsPlugins (rpmts ts)
 Get the plugins associated with a transaction set. More...
 
int rpmtsSetNotifyCallback (rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
 Set transaction notify callback function and argument. More...
 
int rpmtsSetNotifyStyle (rpmts ts, int style)
 Set transaction notify callback style. More...
 
int rpmtsGetNotifyStyle (rpmts ts)
 Get transaction notify callback style. More...
 
int rpmtsSetChangeCallback (rpmts ts, rpmtsChangeFunction notify, void *data)
 Set transaction change callback function and argument. More...
 
rpmts rpmtsCreate (void)
 Create an empty transaction set. More...
 
int rpmtsAddInstallElement (rpmts ts, Header h, const fnpyKey key, int upgrade, rpmRelocation *relocs)
 Add package to be installed to transaction set. More...
 
int rpmtsAddReinstallElement (rpmts ts, Header h, const fnpyKey key)
 Add package to be reinstalled to transaction set. More...
 
int rpmtsAddRestoreElement (rpmts ts, Header h)
 Add package to be restored to transaction set. More...
 
int rpmtsAddEraseElement (rpmts ts, Header h, int dboffset)
 Add package to be erased to transaction set. More...
 
rpmtxn rpmtxnBegin (rpmts ts, rpmtxnFlags flags)
 Create a transaction (lock) handle. More...
 
rpmtxn rpmtxnEnd (rpmtxn txn)
 Destroy transaction (lock) handle. More...
 
RPM_GNUC_INTERNAL rpmstrPool rpmtsPool (rpmts ts)
 Return transaction global string pool handle, creating the pool if needed. More...
 

Detailed Description

How to create, run & destroy a package transaction.

Typedef Documentation

◆ rpmCallbackFunction

typedef void *(* rpmCallbackFunction) (const void *h, const rpmCallbackType what, const rpm_loff_t amount, const rpm_loff_t total, fnpyKey key, rpmCallbackData data)

Function pointer type for rpmtsSetNotifyCallback() triggered by rpmtsNotify()

Parameters
hrelated header or NULL
whatkind of notification (See RPMCALLBACK_ constants above)
amountnumber of bytes/packages already processed or tag of the scriptlet involved or 0 or some other number
totaltotal number of bytes/packages to be processed or return code of the scriptlet or 0
keyresult of rpmteKey() of related rpmte or 0
datauser data as passed to rpmtsSetNotifyCallback()

Definition at line 60 of file rpmcallback.h.

◆ rpmtsChangeFunction

typedef int(* rpmtsChangeFunction) (int event, rpmte te, rpmte other, void *data)

Transaction change callback type.

On explicit install/erase add events, "other" is NULL, on implicit add events (erasures due to obsolete/upgrade, replaced by newer) it points to the replacing package.

Parameters
eventChange event (see rpmtsEvent enum)
teTransaction element
otherRelated transaction element (or NULL)
dataApplication private data from rpmtsSetChangeCallback()

Definition at line 199 of file rpmts.h.

◆ rpmtsOpX

typedef enum rpmtsOpX_e rpmtsOpX

Indices for timestamps.

Enumeration Type Documentation

◆ rpmtransFlags_e

Bit(s) to control rpmtsRun() operation.

Enumerator
RPMTRANS_FLAG_NONE 
RPMTRANS_FLAG_TEST 

from –test

RPMTRANS_FLAG_BUILD_PROBS 

don't process payload

RPMTRANS_FLAG_NOSCRIPTS 

from –noscripts

RPMTRANS_FLAG_JUSTDB 

from –justdb

RPMTRANS_FLAG_NOTRIGGERS 

from –notriggers

RPMTRANS_FLAG_NODOCS 

from –excludedocs

RPMTRANS_FLAG_ALLFILES 

from –allfiles

RPMTRANS_FLAG_NOPLUGINS 

from –noplugins

RPMTRANS_FLAG_NOCONTEXTS 

from –nocontexts

RPMTRANS_FLAG_NOCAPS 

from –nocaps

RPMTRANS_FLAG_NODB 

from –nodb

RPMTRANS_FLAG_NOTRIGGERPREIN 

from –notriggerprein

RPMTRANS_FLAG_NOPRE 

from –nopre

RPMTRANS_FLAG_NOPOST 

from –nopost

RPMTRANS_FLAG_NOTRIGGERIN 

from –notriggerin

RPMTRANS_FLAG_NOTRIGGERUN 

from –notriggerun

RPMTRANS_FLAG_NOPREUN 

from –nopreun

RPMTRANS_FLAG_NOPOSTUN 

from –nopostun

RPMTRANS_FLAG_NOTRIGGERPOSTUN 

from –notriggerpostun

RPMTRANS_FLAG_NOPRETRANS 

from –nopretrans

RPMTRANS_FLAG_NOPOSTTRANS 

from –noposttrans

RPMTRANS_FLAG_NOMD5 

from –nomd5

RPMTRANS_FLAG_NOFILEDIGEST 

from –nofiledigest (alias to –nomd5)

RPMTRANS_FLAG_NOARTIFACTS 

from –noartifacts

RPMTRANS_FLAG_NOCONFIGS 

from –noconfigs

RPMTRANS_FLAG_DEPLOOPS 

from –deploops

Definition at line 27 of file rpmts.h.

◆ rpmtsOpX_e

enum rpmtsOpX_e

Indices for timestamps.

Enumerator
RPMTS_OP_TOTAL 
RPMTS_OP_CHECK 
RPMTS_OP_ORDER 
RPMTS_OP_FINGERPRINT 
RPMTS_OP_INSTALL 
RPMTS_OP_ERASE 
RPMTS_OP_SCRIPTLETS 
RPMTS_OP_COMPRESS 
RPMTS_OP_UNCOMPRESS 
RPMTS_OP_DIGEST 
RPMTS_OP_SIGNATURE 
RPMTS_OP_DBADD 
RPMTS_OP_DBREMOVE 
RPMTS_OP_DBGET 
RPMTS_OP_DBPUT 
RPMTS_OP_DBDEL 
RPMTS_OP_VERIFY 
RPMTS_OP_MAX 

Definition at line 155 of file rpmts.h.

◆ rpmVSFlags_e

Bit(s) to control digest and signature verification.

Enumerator
RPMVSF_DEFAULT 
RPMVSF_NOHDRCHK 
RPMVSF_NEEDPAYLOAD 
RPMVSF_NOSHA1HEADER 
RPMVSF_NOSHA256HEADER 
RPMVSF_NODSAHEADER 
RPMVSF_NORSAHEADER 
RPMVSF_NOPAYLOAD 
RPMVSF_NOMD5 
RPMVSF_NODSA 
RPMVSF_NORSA 

Definition at line 95 of file rpmts.h.

Function Documentation

◆ rpmtsAddEraseElement()

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

Add package to be erased to transaction set.

Parameters
tstransaction set
hheader
dboffsetununsed
Returns
0 on success, 1 on error (not installed)

Definition at line 507 of file depends.c.

References removePackage(), RPMRC_FAIL, and rpmtsSetupTransactionPlugins().

Referenced by rpmErase(), and rpmts_AddErase().

◆ rpmtsAddInstallElement()

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
tstransaction set
hheader
keypackage retrieval key (e.g. file name)
upgradeis package being upgraded?
relocspackage file relocations
Returns
0 on success, 1 on I/O error, 2 needs capabilities

Definition at line 473 of file depends.c.

References addPackage(), RPMRC_FAIL, RPMTE_INSTALL, RPMTE_UPGRADE, and rpmtsSetupTransactionPlugins().

Referenced by rpmGraph(), rpmInstall(), rpmInstallSourcePackage(), rpmSpecCheckDeps(), rpmts_AddInstall(), and verifyDependencies().

◆ rpmtsAddReinstallElement()

int rpmtsAddReinstallElement ( rpmts  ts,
Header  h,
const fnpyKey  key 
)

Add package to be reinstalled to transaction set.

Parameters
tstransaction set
hheader
keypackage retrieval key (e.g. file name)
Returns
0 on success

Definition at line 482 of file depends.c.

References addPackage(), RPMRC_FAIL, RPMTE_REINSTALL, and rpmtsSetupTransactionPlugins().

Referenced by rpmInstall(), and rpmts_AddReinstall().

◆ rpmtsAddRestoreElement()

int rpmtsAddRestoreElement ( rpmts  ts,
Header  h 
)

Add package to be restored to transaction set.

Parameters
tstransaction set
hheader
Returns
0 on success, 1 on error (not installed)

Definition at line 491 of file depends.c.

References addElement(), tsMembers_s::orderCount, RPMRC_FAIL, rpmteNew(), RPMTS_EVENT_ADD, rpmtsMembers(), rpmtsNotifyChange(), rpmtsSetupTransactionPlugins(), and TR_RESTORED.

Referenced by handleRestorePackage(), and rpmts_AddRestore().

◆ rpmtsCheck()

◆ rpmtsClean()

void rpmtsClean ( rpmts  ts)

Free memory needed only for dependency checks and ordering.

Parameters
tstransaction set

Definition at line 735 of file rpmts.c.

References tsMembers_s::addedPackages, rpmalFree(), rpmdsFree(), tsMembers_s::rpmlib, rpmteCleanDS(), rpmtsCleanProblems(), rpmtsiFree(), rpmtsiInit(), rpmtsiNext(), and rpmtsMembers().

Referenced by rpmcliTransaction(), rpmts_Clean(), and rpmtsEmpty().

◆ rpmtsCleanProblems()

void rpmtsCleanProblems ( rpmts  ts)

Clean current transaction problem set.

Parameters
tstransaction set

Definition at line 726 of file rpmts.c.

References rpmteCleanProblems(), rpmtsiFree(), rpmtsiInit(), and rpmtsiNext().

Referenced by rpmtsClean(), and rpmtsRun().

◆ rpmtsCloseDB()

int rpmtsCloseDB ( rpmts  ts)

Close the database used by the transaction.

Parameters
tstransaction set
Returns
0 on success

Definition at line 75 of file rpmts.c.

References RPMDB_OP_DBDEL, RPMDB_OP_DBGET, RPMDB_OP_DBPUT, rpmdbClose(), rpmdbOp(), rpmswAdd(), RPMTS_OP_DBDEL, RPMTS_OP_DBGET, RPMTS_OP_DBPUT, and rpmtsOp().

Referenced by rpmts_CloseDB(), rpmts_InitDB(), rpmtsCheck(), rpmtsFree(), and rpmtsOpenDB().

◆ rpmtsColor()

rpm_color_t rpmtsColor ( rpmts  ts)

Retrieve color bits of transaction set.

Parameters
tstransaction set
Returns
color bits

Definition at line 1068 of file rpmts.c.

Referenced by addPackage(), checkAdded(), checkFreshenStatus(), dbAdd(), handleColorConflict(), markReplacedInstance(), rpmalCreate(), rpmts_get_color(), rpmtsCheck(), and skipInstallFiles().

◆ rpmtsCreate()

◆ rpmtsElement()

rpmte rpmtsElement ( rpmts  ts,
int  ix 
)

Return (ordered) transaction set element.

Parameters
tstransaction set
ixtransaction element index
Returns
transaction element (or NULL)

Definition at line 1037 of file rpmts.c.

References tsMembers_s::order, and rpmtsMembers().

Referenced by rpmInstallSourcePackage(), rpmtsiNextElement(), and verifyDependencies().

◆ rpmtsEmpty()

◆ rpmtsFilterFlags()

rpmprobFilterFlags rpmtsFilterFlags ( rpmts  ts)

Get problem ignore bit mask, i.e.

bits to filter encountered problems.

Parameters
tstransaction set
Returns
ignore bit mask

Definition at line 1048 of file rpmts.c.

Referenced by checkProblems(), handleInstInstalledFile(), handleOverlappedFiles(), rpmPackageInstall(), and rpmtsPrepare().

◆ rpmtsFlags()

◆ rpmtsFree()

◆ rpmtsGetDBMode()

int rpmtsGetDBMode ( rpmts  ts)

Return the transaction database mode.

Parameters
tstransaction set
Returns
O_RDONLY, O_RDWR or -1 (lazy opens disabled)

Definition at line 123 of file rpmts.c.

Referenced by addPackage(), rpmts_OpenDB(), and rpmtsCheck().

◆ rpmtsGetKeyring()

rpmKeyring rpmtsGetKeyring ( rpmts  ts,
int  autoload 
)

Retrieve handle for keyring used for this transaction set.

Parameters
tstransaction set
autoloadload default keyring if keyring is not set
Returns
keyring handle (or NULL)

Definition at line 254 of file rpmts.c.

References loadKeyring(), and rpmKeyringLink().

Referenced by headerCheck(), rpmcliVerifySignatures(), rpmReadPackageFile(), rpmts_getKeyring(), rpmtsImportPubkey(), rpmVerifySignatures(), and verifyPackageFiles().

◆ rpmtsGetNotifyStyle()

int rpmtsGetNotifyStyle ( rpmts  ts)

Get transaction notify callback style.

Parameters
tstransaction set
Returns
current callback style (see above)

Definition at line 1136 of file rpmts.c.

Referenced by rpmts_get_cbstyle(), and rpmts_Run().

◆ rpmtsGetRdb()

◆ rpmtsGetTid()

rpm_tid_t rpmtsGetTid ( rpmts  ts)

Get transaction id, i.e.

transaction time stamp.

Parameters
tstransaction set
Returns
transaction id

Definition at line 964 of file rpmts.c.

Referenced by dbAdd(), rpmPackageFilesInstall(), rpmts_get_tid(), rpmtsImportPubkey(), send_ts_message(), syslog_tsm_post(), and syslog_tsm_pre().

◆ rpmtsImportHeader()

rpmRC rpmtsImportHeader ( rpmtxn  txn,
Header  h,
rpmFlags  flags 
)

Import a header into the rpmdb.

Parameters
txntransaction handle
hheader
flags(unused)
Returns
RPMRC_OK/RPMRC_FAIL

Definition at line 565 of file rpmts.c.

References rpmdbAdd(), RPMRC_FAIL, RPMRC_OK, rpmtsGetRdb(), rpmtsOpenDB(), and rpmtxn_s::ts.

Referenced by importDB(), and rpmtsImportPubkey().

◆ rpmtsImportPubkey()

rpmRC rpmtsImportPubkey ( rpmts  ts,
const unsigned char *  pkt,
size_t  pktlen 
)

◆ rpmtsInitDB()

int rpmtsInitDB ( rpmts  ts,
int  perms 
)

Initialize the database used by the transaction.

Parameters
tstransaction set
permsdatabase permissions (ie mode bits)
Returns
0 on success

Definition at line 113 of file rpmts.c.

References rpmdbInit(), RPMTXN_WRITE, rpmtxnBegin(), and rpmtxnEnd().

Referenced by main(), and rpmts_InitDB().

◆ rpmtsInitIterator()

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

Return transaction database iterator.

Parameters
tstransaction set
rpmtagdatabase index tag
keypkey data (NULL for sequential access)
keylenkey data length (0 will use strlen(keyp))
Returns
NULL on failure

Definition at line 177 of file rpmts.c.

References _, headerCheck(), loadKeyring(), risdigit(), RPMDBI_LABEL, rpmdbInitIterator(), rpmdbSetHdrChk(), rpmlog(), RPMLOG_ERR, rpmtsOpenDB(), RPMVSF_NOHDRCHK, and xmalloc.

Referenced by addSelfErasures(), checkAdded(), checkFreshenStatus(), checkRemoved(), exportDB(), initFilterIterator(), initQueryIterator(), loadKeyringFromDB(), markReplacedFiles(), matchesIterator(), rpmErase(), rpmteDBHeader(), rpmts_Match(), rpmtsPrunedIterator(), runImmedTriggers(), runTriggers(), and verifyHeader().

◆ rpmtsLink()

rpmts rpmtsLink ( rpmts  ts)

Reference a transaction set instance.

Parameters
tstransaction set
Returns
new transaction set reference

Definition at line 68 of file rpmts.c.

Referenced by rpmdbSetHdrChk(), rpmgiNew(), rpmpsmNew(), rpmtsCreate(), rpmtsiInit(), and rpmtxnBegin().

◆ rpmtsNElements()

int rpmtsNElements ( rpmts  ts)

Return number of (ordered) transaction set elements.

Parameters
tstransaction set
Returns
no. of transaction set elements

Definition at line 1027 of file rpmts.c.

References tsMembers_s::order, tsMembers_s::orderCount, and rpmtsMembers().

Referenced by audit_tsm_post(), rpmcliTransaction(), rpmtsCreateAl(), rpmtsiNextElement(), rpmtsOrder(), rpmtsRebuildDB(), and rpmtsRun().

◆ rpmtsNotify()

void * rpmtsNotify ( rpmts  ts,
rpmte  te,
rpmCallbackType  what,
rpm_loff_t  amount,
rpm_loff_t  total 
)

Perform transaction progress notify callback.

Parameters
tstransaction set
tecurrent transaction element
whattype of call back
amountcurrent value
totalfinal value
Returns
callback dependent pointer

Definition at line 992 of file rpmts.c.

References headerFree(), rpmteHeader(), and rpmteKey().

Referenced by rpmFindBaseNamesInDB(), rpmpsmNotify(), rpmpsmUnpack(), rpmteClose(), rpmteFDHeader(), rpmteProcess(), rpmtsPrepare(), runScript(), and verifyPackageFiles().

◆ rpmtsOp()

rpmop rpmtsOp ( rpmts  ts,
rpmtsOpX  opx 
)

Retrieve operation timestamp from a transaction set.

Parameters
tstransaction set
opxoperation timestamp index
Returns
pointer to operation timestamp.

Definition at line 1098 of file rpmts.c.

References RPMTS_OP_MAX.

Referenced by dbAdd(), dbRemove(), fpCachePopulate(), headerCheck(), rpmPackageErase(), rpmPackageFilesInstall(), rpmPackageInstall(), rpmPackageRestore(), rpmtsCheck(), rpmtsCloseDB(), rpmtsCreate(), rpmtsOrder(), rpmtsPrepare(), rpmtsPrintStats(), runScript(), and verifyPackageFiles().

◆ rpmtsOpenDB()

int rpmtsOpenDB ( rpmts  ts,
int  dbmode 
)

Open the database used by the transaction.

Parameters
tstransaction set
dbmodeO_RDONLY or O_RDWR
Returns
0 on success

Definition at line 92 of file rpmts.c.

References _, rpmdbOpen(), rpmGetPath(), rpmlog(), RPMLOG_ERR, and rpmtsCloseDB().

Referenced by addPackage(), rpmcliVerify(), rpmts_index(), rpmts_Match(), rpmts_OpenDB(), rpmtsCheck(), rpmtsImportHeader(), rpmtsInitIterator(), and rpmtsSetup().

◆ rpmtsOrder()

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
tstransaction set
Returns
no. of (added) packages that could not be ordered

Definition at line 562 of file order.c.

References tsMembers_s::addedPackages, addRelation(), tsMembers_s::order, rpmdsInit(), rpmdsNext(), rpmlog(), RPMLOG_DEBUG, rpmswEnter(), RPMTAG_ENHANCENAME, RPMTAG_ORDERNAME, RPMTAG_RECOMMENDNAME, RPMTAG_REQUIRENAME, RPMTAG_SUGGESTNAME, RPMTAG_SUPPLEMENTNAME, rpmteDS(), rpmteSetTSI(), rpmteType(), RPMTS_OP_ORDER, rpmtsCreateAl(), rpmtsiInit(), rpmtsiNext(), rpmtsMembers(), rpmtsNElements(), rpmtsOp(), rpmtsPrefColor(), tsortInfo_s::te, TR_REMOVED, and xcalloc.

Referenced by rpmcliTransaction(), rpmGraph(), and rpmts_Order().

◆ rpmtsPlugins()

rpmPlugins rpmtsPlugins ( rpmts  ts)

Get the plugins associated with a transaction set.

Parameters
tstransaction set
Returns
plugins

Definition at line 1107 of file rpmts.c.

References rpmpluginsNew().

Referenced by rpmPackageFilesInstall(), rpmPackageFilesRemove(), rpmpsmRun(), rpmtsRun(), rpmtsSetupTransactionPlugins(), and runScript().

◆ rpmtsPool()

RPM_GNUC_INTERNAL rpmstrPool rpmtsPool ( rpmts  ts)

Return transaction global string pool handle, creating the pool if needed.

Parameters
tstransaction set
Returns
string pool handle (weak ref)

Definition at line 1158 of file rpmts.c.

References tsMembers_s::pool, rpmstrPoolCreate(), and rpmtsMembers().

Referenced by addIndexToDepHashes(), addObsoleteErasures(), addTE(), checkAdded(), checkInstDeps(), checkInstFileDeps(), findPos(), getFiles(), rpmalCreate(), rpmdbProvides(), rpmFindBaseNamesInDB(), rpmtsPrepare(), and unsatisfiedDepend().

◆ rpmtsPrefColor()

rpm_color_t rpmtsPrefColor ( rpmts  ts)

Retrieve preferred file color.

Parameters
tstransaction set
Returns
color bits

Definition at line 1083 of file rpmts.c.

Referenced by handleColorConflict(), rpmalCreate(), rpmts_get_prefcolor(), and rpmtsOrder().

◆ rpmtsProblems()

rpmps rpmtsProblems ( rpmts  ts)

Return current transaction set problems.

Parameters
tstransaction set
Returns
current problem set (or NULL if no problems)

Definition at line 705 of file rpmts.c.

References rpmpsCreate(), rpmpsFree(), rpmpsMerge(), rpmpsNumProblems(), rpmteProblems(), rpmtsiFree(), rpmtsiInit(), and rpmtsiNext().

Referenced by checkProblems(), rpmcliTransaction(), rpmGraph(), rpmSpecCheckDeps(), rpmts_Problems(), and rpmtsRun().

◆ rpmtsRebuildDB()

int rpmtsRebuildDB ( rpmts  ts)

Rebuild the database used by the transaction.

Parameters
tstransaction set
Returns
0 on success

Definition at line 141 of file rpmts.c.

References headerCheck(), RPMDB_REBUILD_FLAG_SALVAGE, rpmdbRebuild(), rpmExpandNumeric(), rpmtsNElements(), RPMTXN_WRITE, rpmtxnBegin(), rpmtxnEnd(), and RPMVSF_NOHDRCHK.

Referenced by main(), and rpmts_RebuildDB().

◆ rpmtsRootDir()

const char * rpmtsRootDir ( rpmts  ts)

Get transaction rootDir, i.e.

path to chroot(2).

Parameters
tstransaction set
Returns
transaction rootDir

Definition at line 922 of file rpmts.c.

Referenced by audit_tsm_post(), buildForTarget(), fapolicyd_init(), getFiles(), open_dbus(), rpmcliVerify(), rpmInstall(), rpmts_get_rootDir(), rpmtsImportFSKey(), rpmtsSetup(), rpmtxnBegin(), and syslog_tsm_pre().

◆ rpmtsRun()

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

Process all package elements in a transaction set.

Before calling rpmtsRun be sure to have:

Additionally, though not required you may want to:

Parameters
tstransaction set
okProbsunused
ignoreSetbits to filter problem types
Returns
0 on success, -1 on error, >0 with newProbs set

Definition at line 1768 of file transaction.c.

References checkProblems(), PKG_POSTTRANS, PKG_PRETRANS, PKG_TRANSFILETRIGGERIN, PKG_TRANSFILETRIGGERUN, tsMembers_s::pool, rpmlog(), RPMLOG_DEBUG, rpmpluginsCallTsmPost(), rpmpluginsCallTsmPre(), rpmpsFree(), rpmpsNumProblems(), RPMRC_FAIL, RPMSCRIPT_TRANSFILETRIGGER, RPMSENSE_TRIGGERIN, RPMSENSE_TRIGGERUN, rpmstrPoolFree(), RPMTRANS_FLAG_BUILD_PROBS, RPMTRANS_FLAG_NOPOSTTRANS, RPMTRANS_FLAG_NOPRETRANS, RPMTRANS_FLAG_NOTRIGGERIN, RPMTRANS_FLAG_NOTRIGGERPOSTUN, RPMTRANS_FLAG_NOTRIGGERUN, RPMTRANS_FLAG_TEST, rpmtsCleanProblems(), rpmtsFinish(), rpmtsFlags(), rpmtsMembers(), rpmtsNElements(), rpmtsPlugins(), rpmtsPrepare(), rpmtsProblems(), rpmtsProcess(), rpmtsSetup(), rpmtsSync(), RPMTXN_WRITE, rpmtxnBegin(), rpmtxnEnd(), runFileTriggers(), runPostUnTransFileTrigs(), and runTransScripts().

Referenced by rpmcliTransaction(), and rpmts_Run().

◆ rpmtsScriptFd()

FD_t rpmtsScriptFd ( rpmts  ts)

Get transaction script file handle, i.e.

stdout/stderr on scriptlet execution

Parameters
tstransaction set
Returns
transaction script file handle

Definition at line 942 of file rpmts.c.

Referenced by runScript().

◆ rpmtsSetChangeCallback()

int rpmtsSetChangeCallback ( rpmts  ts,
rpmtsChangeFunction  notify,
void *  data 
)

Set transaction change callback function and argument.

The change callback gets called when transaction elements are added, replaced or removed from a transaction set.

Parameters
tstransaction set
notifyelement change callback
dataelement change callback private data
Returns
0 on success

Definition at line 1144 of file rpmts.c.

Referenced by rpmtsFree().

◆ rpmtsSetColor()

rpm_color_t rpmtsSetColor ( rpmts  ts,
rpm_color_t  color 
)

Set color bits of transaction set.

Parameters
tstransaction set
colornew color bits
Returns
previous color bits

Definition at line 1073 of file rpmts.c.

Referenced by rpmts_set_color().

◆ rpmtsSetDBMode()

int rpmtsSetDBMode ( rpmts  ts,
int  dbmode 
)

Set the transaction database mode.

Only permitted when when backing database hasn't been opened yet (ie rpmtsGetRdb(ts) == NULL)

Parameters
tstransaction set
dbmodeO_RDONLY, O_RDWR or -1 (disable lazy opens)
Returns
0 on success, 1 on error

Definition at line 129 of file rpmts.c.

References rpmtsGetRdb().

Referenced by rpmts_CloseDB().

◆ rpmtsSetFlags()

rpmtransFlags rpmtsSetFlags ( rpmts  ts,
rpmtransFlags  transFlags 
)

Set transaction flags, i.e.

bits that control rpmtsRun().

Parameters
tstransaction set
transFlagsnew transaction flags
Returns
previous transaction flags

Definition at line 1058 of file rpmts.c.

Referenced by main(), rpmErase(), rpmInstall(), rpmRestore(), rpmts_set_flags(), rpmtsSetup(), and selinux_tsm_pre().

◆ rpmtsSetKeyring()

int rpmtsSetKeyring ( rpmts  ts,
rpmKeyring  keyring 
)

Set keyring to use for this transaction set.

Keyring can be only changed while the underlying rpm database is not yet open.

Parameters
tstransaction set
keyringkeyring handle (NULL to free current keyring)
Returns
0 on success, -1 on error

Definition at line 266 of file rpmts.c.

References rpmKeyringFree(), and rpmKeyringLink().

Referenced by rpmts_setKeyring().

◆ rpmtsSetNotifyCallback()

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
tstransaction set
notifyprogress callback
notifyDataprogress callback private data
Returns
0 on success

Definition at line 1119 of file rpmts.c.

Referenced by rpmts_Run(), and setNotifyFlag().

◆ rpmtsSetNotifyStyle()

int rpmtsSetNotifyStyle ( rpmts  ts,
int  style 
)

Set transaction notify callback style.

Parameters
tstransaction set
style0 (default) for header, 1 for transaction element as the first argument
Returns
0 on success

Definition at line 1129 of file rpmts.c.

Referenced by rpmts_set_cbstyle().

◆ rpmtsSetPrefColor()

rpm_color_t rpmtsSetPrefColor ( rpmts  ts,
rpm_color_t  color 
)

Set preferred file color.

Parameters
tstransaction set
colornew color bits
Returns
previous color bits

Definition at line 1088 of file rpmts.c.

Referenced by rpmts_set_prefcolor().

◆ rpmtsSetRootDir()

int rpmtsSetRootDir ( rpmts  ts,
const char *  rootDir 
)

Set transaction rootDir, i.e.

path to chroot(2).

Note that rpm assumes the environment inside the root is set up by the caller, such as any mounts needed for the operation inside the root directory.

Parameters
tstransaction set
rootDirnew transaction rootDir (or NULL)
Returns
0 on success, -1 on error (invalid rootDir)

Definition at line 927 of file rpmts.c.

References _free, rpmGetPath(), rstrcat(), rstreq(), and xstrdup.

Referenced by main(), and rpmts_init().

◆ rpmtsSetScriptFd()

void rpmtsSetScriptFd ( rpmts  ts,
FD_t  scriptFd 
)

Set transaction script file handle, i.e.

stdout/stderr on scriptlet execution

Parameters
tstransaction set
scriptFdnew script file handle (or NULL)

Definition at line 951 of file rpmts.c.

References fdFree(), and fdLink().

Referenced by rpmcliVerify(), and rpmts_set_scriptFd().

◆ rpmtsSetSolveCallback()

int rpmtsSetSolveCallback ( rpmts  ts,
int(*)(rpmts ts, rpmds ds, const void *data)  solve,
const void *  solveData 
)

Set dependency solver callback.

Parameters
tstransaction set
(*solve)dependency solver callback
solveDatadependency solver callback data (opaque)
Returns
0 on success

Referenced by rpmts_Check().

◆ rpmtsSetTid()

rpm_tid_t rpmtsSetTid ( rpmts  ts,
rpm_tid_t  tid 
)

Set transaction id, i.e.

transaction time stamp.

Parameters
tstransaction set
tidnew transaction id
Returns
previous transaction id

Definition at line 973 of file rpmts.c.

Referenced by rpmtsSetup().

◆ rpmtsSetVfyFlags()

rpmVSFlags rpmtsSetVfyFlags ( rpmts  ts,
rpmVSFlags  vfyflags 
)

Set package verify flag(s).

Parameters
tstransaction set
vfyflagsnew package verify flags
Returns
old package verify flags

Definition at line 894 of file rpmts.c.

Referenced by rpmInstall(), and rpmts_set_vfyflags().

◆ rpmtsSetVfyLevel()

int rpmtsSetVfyLevel ( rpmts  ts,
int  vfylevel 
)

Set enforced package verify level.

Parameters
tstransaction set
vfylevelnew package verify level
Returns
old package verify level

Definition at line 912 of file rpmts.c.

Referenced by rpmcliVerifySignatures(), rpmInstall(), and rpmts_set_vfylevel().

◆ rpmtsSetVSFlags()

rpmVSFlags rpmtsSetVSFlags ( rpmts  ts,
rpmVSFlags  vsflags 
)

Set verify signatures flag(s).

Parameters
tstransaction set
vsflagsnew verify signatures flags
Returns
previous value

Definition at line 876 of file rpmts.c.

References vsflags.

Referenced by build(), main(), rpmcliQuery(), rpmcliVerify(), rpmErase(), rpmGraph(), rpmInstall(), rpmInstallSource(), rpmRestore(), rpmSignVerity(), rpmteFDHeader(), rpmts_init(), rpmts_set_vsflags(), and rpmtsImportPubkey().

◆ rpmtsVerifyDB()

int rpmtsVerifyDB ( rpmts  ts)

Verify the database used by the transaction.

Parameters
tstransaction set
Returns
0 on success

Definition at line 165 of file rpmts.c.

References rpmdbVerify(), RPMTXN_READ, rpmtxnBegin(), and rpmtxnEnd().

Referenced by main(), and rpmts_VerifyDB().

◆ rpmtsVfyFlags()

rpmVSFlags rpmtsVfyFlags ( rpmts  ts)

Get package verify flag(s).

Parameters
tstransaction set
Returns
verify signatures flags

Definition at line 886 of file rpmts.c.

Referenced by rpmcliVerifySignatures(), rpmInstall(), rpmts_get_vfyflags(), rpmVerifySignatures(), and verifyPackageFiles().

◆ rpmtsVfyLevel()

int rpmtsVfyLevel ( rpmts  ts)

Get enforced package verify level.

Parameters
tstransaction set
Returns
package verify level

Definition at line 904 of file rpmts.c.

Referenced by audit_tsm_post(), checkProblems(), rpmcliVerifySignatures(), rpmInstall(), rpmts_get_vfylevel(), rpmVerifySignatures(), and verifyPackageFiles().

◆ rpmtsVSFlags()

rpmVSFlags rpmtsVSFlags ( rpmts  ts)

Get verify signatures flag(s).

Parameters
tstransaction set
Returns
verify signatures flags

Definition at line 868 of file rpmts.c.

References vsflags.

Referenced by headerCheck(), loadKeyring(), rpmInstallSource(), rpmReadPackageFile(), rpmteFDHeader(), rpmts_get_vsflags(), and rpmtsImportPubkey().

◆ rpmtxnBegin()

rpmtxn rpmtxnBegin ( rpmts  ts,
rpmtxnFlags  flags 
)

Create a transaction (lock) handle.

Parameters
tstransaction set
flagsflags
Returns
transaction handle

Definition at line 1339 of file rpmts.c.

References _, rpmtxn_s::flags, rpmtxn_s::lock, rpmChrootDone(), rpmGenPath(), rpmioMkpath(), RPMLOCK_PATH, rpmlockAcquire(), rpmlockNew(), rpmsqBlock(), rpmtsLink(), rpmtsRootDir(), RPMTXN_WRITE, rpmtxn_s::ts, xcalloc, and xstrdup.

Referenced by exportDB(), importDB(), rpmtsImportPubkey(), rpmtsInitDB(), rpmtsRebuildDB(), rpmtsRun(), and rpmtsVerifyDB().

◆ rpmtxnEnd()

rpmtxn rpmtxnEnd ( rpmtxn  txn)

Destroy transaction (lock) handle.

Parameters
txntransaction handle
Returns
NULL always

Definition at line 1379 of file rpmts.c.

References rpmtxn_s::flags, rpmtxn_s::lock, rpmlockRelease(), rpmsqBlock(), rpmtsFree(), RPMTXN_WRITE, and rpmtxn_s::ts.

Referenced by exportDB(), importDB(), rpmtsImportPubkey(), rpmtsInitDB(), rpmtsRebuildDB(), rpmtsRun(), and rpmtsVerifyDB().