rpm
5.4.14
|
![]() |
Files | |
file | rpmlib.h |
In Memoriam: Steve Taylor stayl was here, now he's not. or@r edhat .com | |
file | dbconfig.c |
file | hdrNVR.c |
file | rpmdb.c |
file | rpmdb.h |
Access RPM indices using Berkeley DB interface(s). | |
Typedefs | |
typedef struct _dbiIndexSet * | dbiIndexSet |
A single element (i.e. More... | |
typedef struct tagStore_s * | tagStore_t |
typedef struct rpmdb_s * | rpmdb |
Database of headers and tag value indices. More... | |
typedef struct rpmmi_s * | rpmmi |
Database iterator. More... | |
Functions | |
rpmdb | rpmdbUnlink (rpmdb db, const char *msg) |
Unreference a database instance. More... | |
rpmdb | rpmdbLink (rpmdb db, const char *msg) |
Reference a database instance. More... | |
int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, mode_t perms) |
Open rpm database. More... | |
int | rpmdbClose (rpmdb db) |
Close all database indices and free rpmdb. More... | |
int | rpmdbOpenAll (rpmdb db) |
Open all database indices. More... | |
int | rpmdbCount (rpmdb db, rpmTag tag, const void *keyp, size_t keylen) |
Return number of instances of key in a tag index. More... | |
int | rpmdbCountPackages (rpmdb db, const char *N) |
Return number of instances of package in Name index. More... | |
uint32_t | rpmmiInstance (rpmmi mi) |
Return header instance for current position of rpmdb iterator. More... | |
uint32_t | rpmmiBNTag (rpmmi mi) |
Return basename tag for current position of rpmdb iterator. More... | |
unsigned int | rpmmiCount (rpmmi mi) |
Return number of elements in rpm database iterator. More... | |
int | rpmmiGrow (rpmmi mi, const uint32_t *hdrNums, int nHdrNums) |
Append items to set of package instances to iterate. More... | |
int | rpmmiGrowBasename (rpmmi mi, const char *bn) |
Append packages containing common basename to iterator. More... | |
int | rpmmiSort (rpmmi mi) |
Sort iterator instances. More... | |
int | rpmmiPrune (rpmmi mi, uint32_t *hdrNums, int nHdrNums, int sorted) |
Remove items from set of package instances to iterate. More... | |
int | rpmmiAddPattern (rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern) |
Add pattern to iterator selector. More... | |
int | rpmmiSetRewrite (rpmmi mi, int rewrite) |
Prepare iterator for lazy writes. More... | |
int | rpmmiSetModified (rpmmi mi, int modified) |
Modify iterator to mark header for lazy write on release. More... | |
rpmmi | rpmmiInit (rpmdb db, rpmTag tag, const void *keyp, size_t keylen) |
Return database iterator. More... | |
Header | rpmmiNext (rpmmi mi) |
Return next package header from iteration. More... | |
int | rpmdbCheckTerminate (int terminate) |
Check rpmdb signal handler for trapped signal and/or requested exit. More... | |
int | rpmdbCheckSignals (void) |
Check for and exit on termination signals. More... | |
rpmmi | rpmmiUnlink (rpmmi mi) |
Unreference a rpm database iterator. More... | |
rpmmi | rpmmiLink (rpmmi mi) |
Reference a rpm database iterator. More... | |
rpmmi | rpmmiFree (rpmmi mi) |
Destroy rpm database iterator. More... | |
int | rpmdbMireApply (rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp) |
Return array of keys matching a pattern. More... | |
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts) |
Add package header to rpm database and indices. More... | |
int | rpmdbRemove (rpmdb db, int rid, uint32_t hdrNum, rpmts ts) |
Remove package header from rpm database and indices. More... | |
typedef struct _dbiIndexSet* dbiIndexSet |
<--%s(%p,%p,%p,%p) rc%d\n\tdbi%p(%s) rpmdb%ph%p%s\n",__FUNCTION__,db,key,data,_r,rc,dbi,tagName(dbi-> rpmdb |
Database of headers and tag value indices.
Definition at line 43 of file rpmtypes.h.
Database iterator.
Definition at line 48 of file rpmtypes.h.
typedef struct tagStore_s* tagStore_t |
Add package header to rpm database and indices.
db | rpm database |
iid | install transaction id (iid = 0 or -1 to skip) |
h | header |
ts | (unused) transaction set (or NULL) |
Definition at line 2883 of file rpmdb.c.
References _free(), _hton_ui(), alloca(), assert(), blockSignals(), _HE_s::c, __db_dbt::data, DB_KEYLAST, DB_WRITECURSOR, dbi, dbiOpen(), exit, fprintf(), hdrNum, headerFree, headerGet(), headerGetInstance(), headerIsEntry(), headerLink(), headerPut(), headerSetInstance(), headerUnload(), k, len, memset(), NULL, _HE_s::p, rpmDataType_u::ptr, rc, RPM_UINT32_TYPE, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPCACHE, RPMDBI_PACKAGES, RPMDBI_REMOVED, RPMDBI_SEQNO, RPMRC_FAIL, RPMRC_OK, RPMTAG_INSTALLTID, RPMTAG_PACKAGECOLOR, __db_dbt::size, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, UINT32_T, unblockSignals(), void, and xx.
Referenced by ftsCacheUpdate(), rpmcliImportPubkey(), and rpmpsmStage().
Check for and exit on termination signals.
Definition at line 523 of file rpmdb.c.
References D_, exit, EXIT_FAILURE, rpmdbCheckTerminate(), rpmlog(), RPMLOG_DEBUG, and rpmsqCaught.
Referenced by checkSignals(), rpmdbClose(), rpmgiShowMatches(), rpmmiFini(), rpmmiInit(), rpmQueryVerify(), rpmtsAddFingerprints(), rpmtsFindBaseNamesInDB(), rpmtsProcess(), rpmtsRepackage(), and unblockSignals().
Check rpmdb signal handler for trapped signal and/or requested exit.
Clean up any open iterators and databases on termination condition. On non-zero exit any open references to rpmdb are invalid and cannot be accessed anymore, calling process should terminate immediately.
terminate | 0 to only check for signals, 1 to terminate anyway |
Definition at line 476 of file rpmdb.c.
References mi, rpmmi_s::mi_next, newMask, NULL, oldMask, rpmdbClose(), rpmmiFree(), rpmsqCaught, and void.
Referenced by rpm_exithook(), rpmdbCheckSignals(), and rpmts_Die().
Close all database indices and free rpmdb.
db | rpm database |
Definition at line 866 of file rpmdb.c.
References _free(), fprintf(), L, msg, next, NULL, rc, rpmdbCheckSignals(), rpmdbRock, rpmioPutPool(), rpmsqEnable(), tagStoreFree(), void, and xx.
Referenced by rpmdb_dealloc(), rpmdbCheckTerminate(), rpmdbOpenDatabase(), rpmmiFini(), rpmtsCloseDB(), and rpmtsCloseSDB().
Return number of instances of key in a tag index.
db | rpm database |
tag | rpm tag |
keyp | key data |
keylen | key data length (0 will use strlen(keyp)) |
Definition at line 1188 of file rpmdb.c.
References _, count, __db_dbt::data, DB_NOTFOUND, DB_SET, dbi, dbiOpen(), k, NULL, rc, rpmlog(), RPMLOG_ERR, __db_dbt::size, tagName(), UINT32_T, and xx.
Referenced by rpmdbCountPackages().
Return number of instances of package in Name index.
db | rpm database |
N | rpm package name |
Definition at line 1238 of file rpmdb.c.
References rpmdbCount(), and RPMTAG_NAME.
Referenced by handleOneTrigger(), rpmpsmStage(), and runTriggers().
Reference a database instance.
db | rpm database |
msg |
Referenced by rpmdbNew(), and rpmmiInit().
int rpmdbMireApply | ( | rpmdb | db, |
rpmTag | tag, | ||
rpmMireMode | mode, | ||
const char * | pat, | ||
const char *** | argvp | ||
) |
Return array of keys matching a pattern.
db | rpm database |
tag | rpm tag |
mode | type of pattern match |
pat | pattern to match |
*argvp | array of keys that match |
Definition at line 1482 of file rpmdb.c.
References dbiMireKeys(), fprintf(), NULL, rc, and tagName().
Referenced by rpmdbTriggerGlobs(), rpmtsLoadNVRA(), rpmtsSanityCheck(), and runImmedTriggers().
Open rpm database.
prefix | path to top of install tree |
dbp | address of rpm database |
mode | open(2) flags: O_RDWR or O_RDONLY (O_CREAT also) |
perms | database permissions |
Definition at line 1175 of file rpmdb.c.
References _DB_MAJOR, NULL, rpmdbOpenDatabase(), and rpmExpandNumeric().
Referenced by rpmtsFindPubkey(), rpmtsOpenDB(), and rpmtsOpenSDB().
Open all database indices.
db | rpm database |
Definition at line 787 of file rpmdb.c.
References dbiOpen(), NULL, rc, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_BTREE, RPMDBI_DEPCACHE, RPMDBI_HASH, RPMDBI_HEAP, RPMDBI_QUEUE, RPMDBI_RECNO, RPMDBI_REMOVED, and void.
Referenced by rpmtsPrepare().
Remove package header from rpm database and indices.
db | rpm database |
rid | (unused) remove transaction id (rid = 0 or -1 to skip) |
hdrNum | package instance number in database |
ts | (unused) transaction set (or NULL) |
Definition at line 2772 of file rpmdb.c.
References _, _free(), _hton_ui(), alloca(), blockSignals(), __db_dbt::data, DB_SET, DB_WRITECURSOR, dbi, dbiOpen(), exit, h, headerFree, headerGet(), headerLink(), k, memset(), mi, NULL, _HE_s::p, rpmDataType_u::ptr, rc, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPCACHE, RPMDBI_PACKAGES, RPMDBI_REMOVED, RPMDBI_SEQNO, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, rpmmiFree(), rpmmiInit(), rpmmiNext(), RPMRC_FAIL, RPMRC_OK, RPMTAG_NVRA, __db_dbt::size, rpmDataType_u::str, _HE_s::tag, UINT32_T, unblockSignals(), void, and xx.
Referenced by rpmpsmStage(), and rpmtsRollback().
Unreference a database instance.
db | rpm database |
msg |
int rpmmiAddPattern | ( | rpmmi | mi, |
rpmTag | tag, | ||
rpmMireMode | mode, | ||
const char * | pattern | ||
) |
Add pattern to iterator selector.
mi | rpm database iterator |
tag | rpm tag |
mode | type of pattern match |
pattern | pattern to match |
Definition at line 1906 of file rpmdb.c.
References _free(), _mire_debug, _mirePool, assert(), exit, fprintf(), memset(), rpmmi_s::mi_nre, rpmmi_s::mi_re, mireCmp(), mireDup(), mireFree(), mireGetPool(), mireLink(), mireNew(), mireRegcomp(), NULL, qsort(), rc, rpmExpand(), RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, RPMMIRE_STRCMP, strcmp(), t, tagName(), and xrealloc.
Referenced by IDTXload(), rpmgiInitFilter(), rpmmi_pattern(), and rpmpsmStage().
uint32_t rpmmiBNTag | ( | rpmmi | mi | ) |
Return basename tag for current position of rpmdb iterator.
mi | rpm database iterator |
Definition at line 1752 of file rpmdb.c.
References fprintf(), rpmmi_s::mi_bntag, and rc.
Referenced by rpmtsCheckInstalledFiles().
Return number of elements in rpm database iterator.
mi | rpm database iterator |
Definition at line 1759 of file rpmdb.c.
References assert(), __db_dbt::data, DB_SET, dbi, dbiOpen(), fprintf(), if(), k, rpmmi_s::mi_cflags, rpmmi_s::mi_count, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_keylen, rpmmi_s::mi_keyp, rpmmi_s::mi_primary, rpmmi_s::mi_rpmtag, NULL, rc, __db_dbt::size, UINT32_T, and xx.
Referenced by ftsCacheUpdate(), if(), rpmcliInstall(), rpmmi_count_get(), rpmQueryVerify(), and runImmedTriggers().
Destroy rpm database iterator.
mi | rpm database iterator |
Referenced by _rpmtsCheck(), checkPackageSet(), ftsCacheUpdate(), IDTXload(), if(), nwlookupTag(), rpmcliEraseElement(), rpmcliInstall(), rpmcliShowMatches(), rpmdbCheckTerminate(), rpmdbRemove(), rpmErase(), rpmgiFini(), rpmgiInitFilter(), rpmgiNext(), rpmmi_dealloc(), rpmmi_free(), rpmpsmStage(), rpmQueryVerify(), rpmteDBHeader(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheckInstalledFiles(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsSanityCheck(), rpmtsSolve(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().
Append items to set of package instances to iterate.
mi | rpm database iterator |
hdrNums | array of package instances |
nHdrNums | number of elements in array |
Definition at line 2475 of file rpmdb.c.
References dbiAppendSet(), fprintf(), rpmmi_s::mi_set, NULL, rc, void, and xcalloc().
Append packages containing common basename to iterator.
mi | rpm database iterator |
bn | basename key |
Definition at line 1491 of file rpmdb.c.
References assert(), dbiAppendSet(), dbiFreeIndexSet(), dbiMireKeys(), exit, fprintf(), hashFunctionString(), i, if(), rpmmi_s::mi_db, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, NULL, rc, RPMMIRE_STRCMP, RPMTAG_BASENAMES, void, and xcalloc().
Referenced by rpmtsFindBaseNamesInDB().
Return database iterator.
db | rpm database |
tag | rpm tag |
keyp | key data (NULL for sequential access) |
keylen | key data length (0 will use strlen(keyp)) |
Definition at line 2491 of file rpmdb.c.
References _free(), _hton_ui(), _hton_us(), alloca(), assert(), __db_dbt::data, DB_SET, dbi, dbiFindMatches(), dbiFreeIndexSet(), dbiOpen(), exit, fprintf(), h, hdrNum, headerFree, headerGet(), headerLoad(), i, int, j, k, len, memset(), mi, rpmmi_s::mi_cflags, rpmmi_s::mi_count, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_h, rpmmi_s::mi_keylen, rpmmi_s::mi_keyp, rpmmi_s::mi_modified, rpmmi_s::mi_next, rpmmi_s::mi_nre, rpmmi_s::mi_offset, rpmmi_s::mi_prevoffset, rpmmi_s::mi_primary, rpmmi_s::mi_re, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, rpmmi_s::mi_setx, rpmmi_s::mi_sorted, NULL, offset, _HE_s::p, rpmDataType_u::ptr, rc, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, rpmdbCheckSignals(), RPMDBI_PACKAGES, rpmdbLink(), rpmioFreePoolItem(), rpmioLinkPoolItem(), rpmmiGetPool(), rpmmiRock, RPMRC_NOTFOUND, RPMTAG_ARCH, RPMTAG_BASENAMES, RPMTAG_DIRNAMES, RPMTAG_DISTEPOCH, RPMTAG_DISTTAG, RPMTAG_FILEPATHS, RPMTAG_GROUP, RPMTAG_NAME, RPMTAG_NVRA, RPMTAG_OS, RPMTAG_PROVIDENAME, RPMTAG_RELEASE, RPMTAG_VERSION, __db_dbt::size, size, stpcpy(), rpmDataType_u::str, _HE_s::tag, tag, tagName(), tagType(), rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, unsigned, void, xcalloc(), xmalloc, xrealloc, xstrdup(), and xx.
Referenced by nwlookupTag(), rpmdbRemove(), rpmtsFindBaseNamesInDB(), rpmtsFindPubkey(), rpmtsInitIterator(), rpmtsSolve(), and wnlookupTag().
uint32_t rpmmiInstance | ( | rpmmi | mi | ) |
Return header instance for current position of rpmdb iterator.
mi | rpm database iterator |
Definition at line 1743 of file rpmdb.c.
References _ntoh_ui(), fprintf(), rpmmi_s::mi_offset, and rc.
Referenced by IDTXload(), if(), nwlookupTag(), rpmcliEraseElement(), rpmErase(), rpmgiNext(), rpmmi_offset_get(), rpmpsmStage(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheckInstalledFiles(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), runImmedTriggers(), runTriggersLoop(), and wnlookupTag().
Reference a rpm database iterator.
mi | rpm database iterator |
Return next package header from iteration.
mi | rpm database iterator |
< Is 1st header region mmap'd?
< Is 1st header region rdonly?
Definition at line 2248 of file rpmdb.c.
References _, _hton_ui(), _ntoh_ui(), _rpmmi_usermem, assert(), __db_dbt::data, DB_NEXT, DB_NEXT_DUP, DB_NOTFOUND, DB_SET, dbi, dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiOpen(), headerToken_s::flags, fprintf(), hdrNum, headerCopyLoad(), HEADERFLAG_MAPPED, HEADERFLAG_RDONLY, headerFree, headerLoad(), headerSetInstance(), headerSetOrigin(), if(), k, rpmmi_s::mi_bf, rpmmi_s::mi_bntag, rpmmi_s::mi_cflags, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_h, rpmmi_s::mi_keylen, rpmmi_s::mi_keyp, rpmmi_s::mi_modified, rpmmi_s::mi_offset, rpmmi_s::mi_prevoffset, rpmmi_s::mi_primary, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, rpmmi_s::mi_setx, miFreeHeader(), mireSkip(), next, NULL, p, rc, RPMDBI_PACKAGES, rpmlog(), RPMLOG_ERR, rpmmiGet(), __db_dbt::size, sprintf(), tag, tagName(), uh, UINT32_T, void, and xx.
Referenced by checkPackageSet(), IDTXload(), if(), nwlookupTag(), rpmcliEraseElement(), rpmcliInstall(), rpmcliShowMatches(), rpmdbRemove(), rpmErase(), rpmgiNext(), rpmmi_each(), rpmmi_next(), rpmpsmStage(), rpmteDBHeader(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheckInstalledFiles(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsSanityCheck(), rpmtsSolve(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().
Remove items from set of package instances to iterate.
mi | rpm database iterator |
hdrNums | array of package instances |
nHdrNums | number of elements in array |
sorted | is the array sorted? (array will be sorted on return) |
Definition at line 2449 of file rpmdb.c.
References _hton_ui(), assert(), fprintf(), i, k, m, rpmmi_s::mi_bf, NULL, rc, and xx.
Referenced by checkPackageSet(), nwlookupTag(), rpmtsAddObsoletes(), rpmtsEraseDebuginfo(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().
Modify iterator to mark header for lazy write on release.
mi | rpm database iterator |
modified | new value of modified |
Definition at line 2179 of file rpmdb.c.
References rpmmi_s::mi_modified, NULL, and rc.
Prepare iterator for lazy writes.
mi | rpm database iterator |
rewrite | new value of rewrite |
Definition at line 2166 of file rpmdb.c.
References DB_WRITECURSOR, rpmmi_s::mi_cflags, NULL, and rc.
Sort iterator instances.
mi | rpm database iterator |
Definition at line 2416 of file rpmdb.c.
References fprintf(), hdrNumCmp(), i, rpmmi_s::mi_set, rpmmi_s::mi_sorted, qsort(), rc, and rpm_mergesort().
Referenced by rpmtsFindBaseNamesInDB().