#include "system.h"#include <sys/file.h>#include <rpmio.h>#include <rpmlog.h>#include <rpmpgp.h>#include <rpmurl.h>#include <rpmmacro.h>#include <rpmsq.h>#include "header_internal.h"#include <rpmevr.h>#include "rpmdb.h"#include "pkgio.h"#include "fprint.h"#include "legacy.h"#include "debug.h"
Go to the source code of this file.
Data Structures | |
| struct | pbm_set |
| union | _dbswap |
| struct | rpmdbMatchIterator_s |
Defines | |
| #define | _USE_COPY_LOAD |
| #define | _MIRE_INTERNAL |
| #define | _RPMTAG_INTERNAL |
| #define | _RPMEVR_INTERNAL |
| #define | _RPMDB_INTERNAL |
| #define | _DB_TAGGED_FILE_INDICES 1 |
| #define | _DBI_FLAGS 0 |
| #define | _DBI_PERMS 0644 |
| #define | _DBI_MAJOR -1 |
| #define | __PBM_NBITS /*@-sizeoftype@*/(8 * sizeof(__pbm_bits)) |
| #define | __PBM_IX(d) ((d) / __PBM_NBITS) |
| #define | __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) |
| #define | __PBM_BITS(set) ((set)->bits) |
| #define | PBM_FREE(s) _free(s); |
| #define | PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) |
| #define | PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) |
| #define | PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) |
| #define | PBM_ALLOC(d) xcalloc(__PBM_IX (d) + 1, __PBM_NBITS/8) |
| #define | DB1vec NULL |
| #define | DB2vec NULL |
| #define | DB3vec NULL |
| #define | SQLITEvec NULL |
| #define | _DBSWAP(_a) |
| #define | _DB_ROOT "/" |
| #define | _DB_HOME "%{?_dbpath}" |
| #define | _DB_FLAGS 0 |
| #define | _DB_MODE 0 |
| #define | _DB_PERMS 0644 |
| #define | _DB_MAJOR -1 |
| #define | _DB_ERRPFX "rpmdb" |
| #define | _RECNUM rpmdbGetIteratorOffset(mi) |
Typedefs | |
| typedef unsigned int | __pbm_bits |
Functions | |
| pgpDig | rpmtsDig (void *ts) |
| void | rpmtsCleanDig (void *ts) |
| static pbm_set * | PBM_REALLOC (pbm_set **sp, int *odp, int nd) |
| Reallocate a bit map. | |
| static unsigned char | nibble (char c) |
| Convert hex to binary nibble. | |
| static char * | bin2hex (const void *data, size_t size) |
| Convert binary blob to printable hex string. | |
| static size_t | dbiTagToDbix (rpmdb db, rpmTag rpmtag) |
| Return dbi index used for rpm tag. | |
| static void | dbiTagsInit (tagStore_t *dbiTagsP, size_t *dbiNTagsP) |
| Initialize database (index, tag) tuple from configuration. | |
| static int | checkfd (const char *devnull, int fdno, int flags) |
| dbiIndex | dbiOpen (rpmdb db, rpmTag rpmtag, unsigned int flags) |
| static dbiIndexItem | dbiIndexNewItem (unsigned int hdrNum, unsigned int tagNum) |
| Create and initialize item for index database set. | |
| static int | dbt2set (dbiIndex dbi, DBT *data, dbiIndexSet *setp) |
| Convert retrieved data to index set. | |
| static int | set2dbt (dbiIndex dbi, DBT *data, dbiIndexSet set) |
| Convert index set to database representation. | |
| static int | hdrNumCmp (const void *one, const void *two) |
| static int | dbiAppendSet (dbiIndexSet set, const void *recs, int nrecs, size_t recsize, int sortset) |
| Append element(s) to set of index database items. | |
| static int | dbiPruneSet (dbiIndexSet set, void *recs, int nrecs, size_t recsize, int sorted) |
| Remove element(s) from set of index database items. | |
| unsigned int | dbiIndexSetCount (dbiIndexSet set) |
| unsigned int | dbiIndexRecordOffset (dbiIndexSet set, int recno) |
| unsigned int | dbiIndexRecordFileNumber (dbiIndexSet set, int recno) |
| dbiIndexSet | dbiFreeIndexSet (dbiIndexSet set) |
| int | rpmdbCheckTerminate (int terminate) |
| Check rpmdb signal handler for trapped signal and/or requested exit. | |
| int | rpmdbCheckSignals (void) |
| Check for and exit on termination signals. | |
| static int | blockSignals (rpmdb db, sigset_t *oldMask) |
| Block all signals, returning previous signal mask. | |
| static int | unblockSignals (rpmdb db, sigset_t *oldMask) |
| Restore signal mask. | |
| static const char * | queryHeader (Header h, const char *qfmt) |
| Return header query string. | |
| static int | rpmdbExportInfo (rpmdb db, Header h, int adding) |
| Write added/removed header info. | |
| int | rpmdbOpenAll (rpmdb db) |
| Open all database indices. | |
| int | rpmdbBlockDBI (rpmdb db, int rpmtag) |
| Block access to a single database index. | |
| int | rpmdbCloseDBI (rpmdb db, int rpmtag) |
| Close a single database index. | |
| int | rpmdbClose (rpmdb db) |
| Close all database indices and free rpmdb. | |
| int | rpmdbSync (rpmdb db) |
| Sync all database indices. | |
| static const char * | rpmdbURIPath (const char *uri) |
| Return macro expanded absolute path to rpmdb. | |
| rpmdb | rpmdbNew (const char *root, const char *home, int mode, int perms, int flags) |
| int | rpmdbOpenDatabase (const char *prefix, const char *dbpath, int _dbapi, rpmdb *dbp, int mode, int perms, int flags) |
| rpmdb | XrpmdbUnlink (rpmdb db, const char *msg, const char *fn, unsigned ln) |
| rpmdb | XrpmdbLink (rpmdb db, const char *msg, const char *fn, unsigned ln) |
| int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms) |
| Open rpm database. | |
| int | rpmdbInit (const char *prefix, int perms) |
| Initialize database. | |
| int | rpmdbVerifyAllDBI (rpmdb db) |
| Verify all database components. | |
| int | rpmdbVerify (const char *prefix) |
| Open and verify all database components. | |
| static unsigned | taghash (const char *s) |
| Return a tagnum with hash on the (directory) path in upper 16 bits. | |
| static int | rpmdbFindByFile (rpmdb db, const char *filespec, DBT *key, DBT *data, dbiIndexSet *matches) |
| Find file matches in database. | |
| int | rpmdbCountPackages (rpmdb db, const char *name) |
| Return number of instances of package in rpm database. | |
| static rpmRC | dbiFindMatches (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, const char *name, const char *version, const char *release, dbiIndexSet *matches) |
| Attempt partial matches on name[-version[-release]] strings. | |
| static rpmRC | dbiFindByLabel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, const char *arg, dbiIndexSet *matches) |
| Lookup by name, name-version, and finally by name-version-release. | |
| void * | dbiStatsAccumulator (dbiIndex dbi, int opx) |
| static int | miFreeHeader (rpmdbMatchIterator mi, dbiIndex dbi) |
| Rewrite a header into packages (if necessary) and free the header. | |
| rpmdbMatchIterator | rpmdbFreeIterator (rpmdbMatchIterator mi) |
| Destroy rpm database iterator. | |
| unsigned int | rpmdbGetIteratorOffset (rpmdbMatchIterator mi) |
| Return header instance join key for current position of rpmdb iterator. | |
| unsigned int | rpmdbGetIteratorFileNum (rpmdbMatchIterator mi) |
| Return header tag index join key for current position of rpmdb iterator. | |
| int | rpmdbGetIteratorCount (rpmdbMatchIterator mi) |
| Return number of elements in rpm database iterator. | |
| static int | mireCmp (const void *a, const void *b) |
| Compare iterator selectors by rpm tag (qsort/bsearch). | |
| static char * | mireDup (rpmTag tag, rpmMireMode *modep, const char *pattern) |
| Copy pattern, escaping for appropriate mode. | |
| int | rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern) |
| Add pattern to iterator selector. | |
| static int | mireSkip (const rpmdbMatchIterator mi) |
| Return iterator selector match. | |
| int | rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite) |
| Prepare iterator for lazy writes. | |
| int | rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified) |
| Modify iterator to mark header for lazy write on release. | |
| int | rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts) |
| Modify iterator to verify retrieved header blobs. | |
| Header | rpmdbNextIterator (rpmdbMatchIterator mi) |
| Return next package header from iteration. | |
| static void | rpmdbSortIterator (rpmdbMatchIterator mi) |
| static int | rpmdbGrowIterator (rpmdbMatchIterator mi, int fpNum, unsigned int exclude, unsigned int tag) |
| int | rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted) |
| Remove items from set of package instances to iterate. | |
| int | rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums) |
| Append items to set of package instances to iterate. | |
| rpmdbMatchIterator | rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen) |
| Return database iterator. | |
| int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts) |
| Remove package header from rpm database and indices. | |
| int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts) |
| Add package header to rpm database and indices. | |
| int | rpmdbFindFpList (rpmdb db, fingerPrint *fpList, dbiIndexSet *matchList, int numItems, unsigned int exclude) |
| Find fingerprint matches in database. | |
| static int | rpmioFileExists (const char *urlfn) |
| Check if file exists using stat(2). | |
| static int | rpmdbRemoveDatabase (const char *prefix, const char *dbpath, int _dbapi, const tagStore_t dbiTags, size_t dbiNTags) |
| static int | rpmdbMoveDatabase (const char *prefix, const char *olddbpath, int _olddbapi, const char *newdbpath, int _newdbapi, const tagStore_t dbiTags, size_t dbiNTags) |
| int | rpmdbRebuild (const char *prefix, rpmts ts) |
| Rebuild database indices from package headers. | |
Variables | |
| int | _rpmdb_debug = 0 |
| static int | _rebuildinprogress = 0 |
| static int | _db_filter_dups = 0 |
| static int | _db_tagged_file_indices = 1 |
| static struct _dbiVec * | mydbvecs [] |
| static rpmdb | rpmdbRock |
| static rpmdbMatchIterator | rpmmiRock |
| static struct rpmdb_s | dbTemplate |
Definition in file rpmdb.c.
| #define __PBM_BITS | ( | set | ) | ((set)->bits) |
| #define __PBM_IX | ( | d | ) | ((d) / __PBM_NBITS) |
| #define __PBM_MASK | ( | d | ) | ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) |
| #define __PBM_NBITS /*@-sizeoftype@*/(8 * sizeof(__pbm_bits)) |
| #define _DB_ERRPFX "rpmdb" |
| #define _DB_HOME "%{?_dbpath}" |
| #define _DB_ROOT "/" |
| #define _DBSWAP | ( | _a | ) |
Value:
{ unsigned char _b, *_c = (_a).uc; \
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
}
Definition at line 455 of file rpmdb.c.
Referenced by dbt2set(), rpmdbAdd(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbRemove(), set2dbt(), sql_bind_key(), and sql_step().
| #define _RECNUM rpmdbGetIteratorOffset(mi) |
Referenced by rpmdbRebuild().
| #define PBM_ALLOC | ( | d | ) | xcalloc(__PBM_IX (d) + 1, __PBM_NBITS/8) |
| #define PBM_CLR | ( | d, | |||
| s | ) | (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) |
| #define PBM_FREE | ( | s | ) | _free(s); |
| #define PBM_ISSET | ( | d, | |||
| s | ) | ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) |
| #define PBM_SET | ( | d, | |||
| s | ) | (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) |
| typedef unsigned int __pbm_bits |
| static char* bin2hex | ( | const void * | data, | |
| size_t | size | |||
| ) | [static] |
Convert binary blob to printable hex string.
| data | binary data | |
| size | size of data in bytes |
Definition at line 139 of file rpmdb.c.
References xmalloc().
Referenced by mireSkip().
| static int blockSignals | ( | rpmdb | db, | |
| sigset_t * | oldMask | |||
| ) | [static] |
Block all signals, returning previous signal mask.
| db | rpm database |
| *oldMask | previous sigset |
Definition at line 801 of file rpmdb.c.
Referenced by miFreeHeader(), rpmdbAdd(), and rpmdbRemove().
| static int checkfd | ( | const char * | devnull, | |
| int | fdno, | |||
| int | flags | |||
| ) | [inline, static] |
| static int dbiAppendSet | ( | dbiIndexSet | set, | |
| const void * | recs, | |||
| int | nrecs, | |||
| size_t | recsize, | |||
| int | sortset | |||
| ) | [static] |
Append element(s) to set of index database items.
| set | set of index database items | |
| recs | array of items to append to set | |
| nrecs | number of items | |
| recsize | size of an array item | |
| sortset | should resulting set be sorted? |
Definition at line 615 of file rpmdb.c.
References hdrNumCmp(), and xrealloc().
Referenced by rpmdbAdd(), rpmdbAppendIterator(), rpmdbFindByFile(), and rpmdbFindFpList().
| static rpmRC dbiFindByLabel | ( | dbiIndex | dbi, | |
| DBC * | dbcursor, | |||
| DBT * | key, | |||
| DBT * | data, | |||
| const char * | arg, | |||
| dbiIndexSet * | matches | |||
| ) | [static] |
Lookup by name, name-version, and finally by name-version-release.
Both version and release can be patterns.
| dbi | index database handle (always RPMTAG_NAME) | |
| dbcursor | index database cursor | |
| key | search key/length/flags | |
| data | search data/length/flags | |
| arg | name[-version[-release]] string |
| matches | set of header instances that match |
Definition at line 1734 of file rpmdb.c.
References alloca(), dbiFindMatches(), dbiFreeIndexSet(), RPMRC_NOTFOUND, and stpcpy().
Referenced by rpmdbInitIterator().
| static rpmRC dbiFindMatches | ( | dbiIndex | dbi, | |
| DBC * | dbcursor, | |||
| DBT * | key, | |||
| DBT * | data, | |||
| const char * | name, | |||
| const char * | version, | |||
| const char * | release, | |||
| dbiIndexSet * | matches | |||
| ) | [static] |
Attempt partial matches on name[-version[-release]] strings.
| dbi | index database handle (always RPMTAG_NAME) | |
| dbcursor | index database cursor | |
| key | search key/length/flags | |
| data | search data/length/flags | |
| name | package name | |
| version | package version (can be a pattern) | |
| release | package release (can be a pattern) |
| matches | set of header instances that match |
Definition at line 1638 of file rpmdb.c.
References _, __db_dbt::data, DB_NOTFOUND, DB_SET, dbiFreeIndexSet(), dbiIndexRecordOffset(), dbiIndexSetCount(), dbt2set(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbNextIterator(), rpmdbSetIteratorRE(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_RELEASE, RPMTAG_VERSION, __db_dbt::size, and tagName().
Referenced by dbiFindByLabel().
| dbiIndexSet dbiFreeIndexSet | ( | dbiIndexSet | set | ) |
Definition at line 696 of file rpmdb.c.
References _free().
Referenced by dbiFindByLabel(), dbiFindMatches(), rpmdbAdd(), rpmdbCountPackages(), rpmdbFindByFile(), rpmdbFreeIterator(), rpmdbGrowIterator(), rpmdbInitIterator(), rpmdbRemove(), and rpmtsRun().
| static dbiIndexItem dbiIndexNewItem | ( | unsigned int | hdrNum, | |
| unsigned int | tagNum | |||
| ) | [static] |
Create and initialize item for index database set.
| hdrNum | header instance in db | |
| tagNum | tag index in header |
Definition at line 441 of file rpmdb.c.
References xcalloc().
Referenced by rpmdbAdd(), rpmdbFindByFile(), and rpmdbRemove().
| unsigned int dbiIndexRecordFileNumber | ( | dbiIndexSet | set, | |
| int | recno | |||
| ) |
Definition at line 691 of file rpmdb.c.
Referenced by rpmdbFindByFile(), rpmdbNextIterator(), and rpmtsRun().
| unsigned int dbiIndexRecordOffset | ( | dbiIndexSet | set, | |
| int | recno | |||
| ) |
Definition at line 686 of file rpmdb.c.
Referenced by dbiFindMatches(), rpmdbFindByFile(), rpmdbNextIterator(), and rpmtsRun().
| unsigned int dbiIndexSetCount | ( | dbiIndexSet | set | ) |
Definition at line 681 of file rpmdb.c.
Referenced by dbiFindMatches(), rpmdbCountPackages(), and rpmtsRun().
Definition at line 314 of file rpmdb.c.
References _, _rebuildinprogress, _rpmdb_debug, checkfd(), D_, DB_FAST_STAT, dbiTagToDbix(), errno, __db_h_stat::hash_nkeys, PBM_ALLOC, RPMDBI_PACKAGES, rpmExpandNumeric(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, and tagName().
Referenced by rpmdbAdd(), rpmdbCountPackages(), rpmdbFindByFile(), rpmdbFreeIterator(), rpmdbGrowIterator(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbOpenAll(), rpmdbOpenDatabase(), rpmdbRemove(), rpmpsmStage(), and unsatisfiedDepend().
| static int dbiPruneSet | ( | dbiIndexSet | set, | |
| void * | recs, | |||
| int | nrecs, | |||
| size_t | recsize, | |||
| int | sorted | |||
| ) | [static] |
Remove element(s) from set of index database items.
| set | set of index database items | |
| recs | array of items to remove from set | |
| nrecs | number of items | |
| recsize | size of an array item | |
| sorted | array is already sorted? |
Definition at line 654 of file rpmdb.c.
References hdrNumCmp().
Referenced by rpmdbPruneIterator(), and rpmdbRemove().
| static void dbiTagsInit | ( | tagStore_t * | dbiTagsP, | |
| size_t * | dbiNTagsP | |||
| ) | [static] |
Initialize database (index, tag) tuple from configuration.
Definition at line 198 of file rpmdb.c.
References _free(), RPMDBI_PACKAGES, rpmExpand(), tagStoreFree(), tagValue(), xcalloc(), xisspace(), xrealloc(), and xstrdup().
Referenced by rpmdbNew(), and rpmdbRebuild().
| static int dbt2set | ( | dbiIndex | dbi, | |
| DBT * | data, | |||
| dbiIndexSet * | setp | |||
| ) | [static] |
Convert retrieved data to index set.
| dbi | index database handle | |
| data | retrieved data |
| setp | (malloc'ed) index set |
Definition at line 468 of file rpmdb.c.
References _DBSWAP, __db_dbt::data, __db_dbt::size, _dbswap::ui, and xmalloc().
Referenced by dbiFindMatches(), rpmdbAdd(), rpmdbCountPackages(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbInitIterator(), and rpmdbRemove().
| static int hdrNumCmp | ( | const void * | one, | |
| const void * | two | |||
| ) | [static] |
Definition at line 599 of file rpmdb.c.
Referenced by dbiAppendSet(), dbiPruneSet(), and rpmdbSortIterator().
| static int miFreeHeader | ( | rpmdbMatchIterator | mi, | |
| dbiIndex | dbi | |||
| ) | [static] |
Rewrite a header into packages (if necessary) and free the header.
Note: this is called from a markReplacedFiles iteration, and *must* preserve the "join key" (i.e. offset) for the header.
| mi | database iterator | |
| dbi | index database handle |
Definition at line 1844 of file rpmdb.c.
References _, _free(), blockSignals(), __db_dbt::data, DB_KEYLAST, headerCheck(), headerFree(), headerGetMagic(), headerUnload(), rpmdbMatchIterator_s::mi_data, rpmdbMatchIterator_s::mi_dbc, rpmdbMatchIterator_s::mi_h, rpmdbMatchIterator_s::mi_key, rpmdbMatchIterator_s::mi_modified, rpmdbMatchIterator_s::mi_prevoffset, rpmdbMatchIterator_s::mi_ts, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, rpmtsCleanDig(), rpmtsDig(), __db_dbt::size, tagName(), and unblockSignals().
Referenced by rpmdbFreeIterator(), and rpmdbNextIterator().
| static int mireCmp | ( | const void * | a, | |
| const void * | b | |||
| ) | [static] |
Compare iterator selectors by rpm tag (qsort/bsearch).
| a | 1st iterator selector | |
| b | 2nd iterator selector |
Definition at line 1974 of file rpmdb.c.
Referenced by rpmdbSetIteratorRE().
| static char* mireDup | ( | rpmTag | tag, | |
| rpmMireMode * | modep, | |||
| const char * | pattern | |||
| ) | [static] |
Copy pattern, escaping for appropriate mode.
| tag | rpm tag |
| modep | type of pattern match |
| pattern | pattern to duplicate |
Definition at line 1990 of file rpmdb.c.
References RPMTAG_BASENAMES, RPMTAG_DIRNAMES, xmalloc(), and xstrdup().
Referenced by rpmdbSetIteratorRE().
| static int mireSkip | ( | const rpmdbMatchIterator | mi | ) | [static] |
Return iterator selector match.
| mi | rpm database iterator |
Definition at line 2155 of file rpmdb.c.
References _free(), alloca(), rpmDataType_u::argv, bin2hex(), _HE_s::c, headerGet(), rpmdbMatchIterator_s::mi_h, rpmdbMatchIterator_s::mi_nre, rpmdbMatchIterator_s::mi_re, _HE_s::p, rpmDataType_u::ptr, 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, RPMTAG_EPOCH, rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, and xcalloc().
Referenced by rpmdbNextIterator().
| static unsigned char nibble | ( | char | c | ) | [inline, static] |
Reallocate a bit map.
| sp | address of bit map pointer | |
| odp | no. of bits in map |
| nd | desired no. of bits |
Definition at line 95 of file rpmdb.c.
References __PBM_BITS, __PBM_IX, __PBM_NBITS, and xrealloc().
Referenced by rpmdbNextIterator().
| static const char* queryHeader | ( | Header | h, | |
| const char * | qfmt | |||
| ) | [inline, static] |
Return header query string.
| h | header | |
| qfmt | header sprintf format |
Definition at line 839 of file rpmdb.c.
References _, headerCompoundFormats, headerSprintf(), rpmlog(), and RPMLOG_ERR.
| int rpmdbBlockDBI | ( | rpmdb | db, | |
| int | rpmtag | |||
| ) |
Block access to a single database index.
| db | rpm database | |
| rpmtag | rpm tag (negative to block) |
Definition at line 953 of file rpmdb.c.
Referenced by rpmgiNext().
| int rpmdbCloseDBI | ( | rpmdb | db, | |
| int | rpmtag | |||
| ) |
Close a single database index.
| db | rpm database | |
| rpmtag | rpm tag |
Definition at line 971 of file rpmdb.c.
Referenced by rpmtsCheck().
Write added/removed header info.
| db | rpm database | |
| h | header | |
| adding | adding an rpmdb header? |
Definition at line 861 of file rpmdb.c.
References _free(), alloca(), Fclose(), Fopen(), headerGet(), _HE_s::p, rpmDataType_u::ptr, queryHeader(), rpmGetPath(), rpmlog(), RPMLOG_DEBUG, RPMTAG_INSTALLTID, _HE_s::tag, rpmDataType_u::ui32p, Unlink(), and Utime().
Referenced by rpmdbNew().
| static int rpmdbFindByFile | ( | rpmdb | db, | |
| const char * | filespec, | |||
| DBT * | key, | |||
| DBT * | data, | |||
| dbiIndexSet * | matches | |||
| ) | [static] |
Find file matches in database.
| db | rpm database | |
| filespec | ||
| key | ||
| data | ||
| matches |
Definition at line 1410 of file rpmdb.c.
References _, _db_tagged_file_indices, _free(), alloca(), rpmDataType_u::argv, __db_dbt::data, DB_SET, dbiAppendSet(), dbiFreeIndexSet(), dbiIndexNewItem(), dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiOpen(), dbt2set(), dirName, FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookup(), headerFree(), headerGet(), headerLink(), _HE_s::p, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbNextIterator(), rpmlog(), RPMLOG_ERR, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, __db_dbt::size, _HE_s::tag, tagName(), rpmDataType_u::ui32p, and xcalloc().
Referenced by rpmdbInitIterator().
| static int rpmdbGrowIterator | ( | rpmdbMatchIterator | mi, | |
| int | fpNum, | |||
| unsigned int | exclude, | |||
| unsigned int | tag | |||
| ) | [static] |
Definition at line 2539 of file rpmdb.c.
References _, _db_tagged_file_indices, __db_dbt::data, DB_NOTFOUND, DB_SET, dbiFreeIndexSet(), dbiOpen(), dbt2set(), rpmdbMatchIterator_s::mi_data, rpmdbMatchIterator_s::mi_db, rpmdbMatchIterator_s::mi_dbc, rpmdbMatchIterator_s::mi_key, rpmdbMatchIterator_s::mi_rpmtag, rpmdbMatchIterator_s::mi_set, rpmlog(), RPMLOG_ERR, tagName(), and xrealloc().
Referenced by rpmdbFindFpList().
| static int rpmdbMoveDatabase | ( | const char * | prefix, | |
| const char * | olddbpath, | |||
| int | _olddbapi, | |||
| const char * | newdbpath, | |||
| int | _newdbapi, | |||
| const tagStore_t | dbiTags, | |||
| size_t | dbiNTags | |||
| ) | [static] |
Definition at line 3792 of file rpmdb.c.
References _free(), Chmod(), Chown(), D_, Rename(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_REMOVED, rpmGetPath(), rpmioFileExists(), rpmlog(), RPMLOG_DEBUG, snprintf(), Stat(), tagName(), Unlink(), and Utime().
Referenced by rpmdbRebuild().
| rpmdb rpmdbNew | ( | const char * | root, | |
| const char * | home, | |||
| int | mode, | |||
| int | perms, | |||
| int | flags | |||
| ) |
Definition at line 1132 of file rpmdb.c.
References _, _DB_ERRPFX, _db_filter_dups, _DB_HOME, _DB_ROOT, _free(), _rpmdb_debug, dbiTagsInit(), rpmdbExportInfo(), rpmdbLink, rpmdbURIPath(), rpmExpand(), rpmExpandNumeric(), rpmlog(), RPMLOG_ERR, and xcalloc().
Referenced by rpmdbOpenDatabase().
| int rpmdbOpenDatabase | ( | const char * | prefix, | |
| const char * | dbpath, | |||
| int | _dbapi, | |||
| rpmdb * | dbp, | |||
| int | mode, | |||
| int | perms, | |||
| int | flags | |||
| ) |
Definition at line 1190 of file rpmdb.c.
References dbiOpen(), RPMDB_FLAG_JUSTCHECK, RPMDB_FLAG_MINIMAL, rpmdbClose(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbNew(), rpmsqEnable(), and RPMTAG_NAME.
Referenced by rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and rpmdbVerify().
| static int rpmdbRemoveDatabase | ( | const char * | prefix, | |
| const char * | dbpath, | |||
| int | _dbapi, | |||
| const tagStore_t | dbiTags, | |||
| size_t | dbiNTags | |||
| ) | [static] |
Definition at line 3742 of file rpmdb.c.
References _free(), Rmdir(), rpmGetPath(), rpmioFileExists(), snprintf(), tagName(), and Unlink().
Referenced by rpmdbRebuild().
| static void rpmdbSortIterator | ( | rpmdbMatchIterator | mi | ) | [static] |
Definition at line 2520 of file rpmdb.c.
References hdrNumCmp(), rpmdbMatchIterator_s::mi_set, rpmdbMatchIterator_s::mi_sorted, and rpm_mergesort().
Referenced by rpmdbFindFpList().
| static const char* rpmdbURIPath | ( | const char * | uri | ) | [static] |
Return macro expanded absolute path to rpmdb.
| uri | desired path |
Definition at line 1082 of file rpmdb.c.
References _free(), PATH_MAX, realpath(), rpmGetPath(), stpncpy(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().
Referenced by rpmdbNew().
| static int rpmioFileExists | ( | const char * | urlfn | ) | [static] |
Check if file exists using stat(2).
| urlfn | file name (may be URL) |
Definition at line 3709 of file rpmdb.c.
References errno, Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().
Referenced by rpmdbMoveDatabase(), and rpmdbRemoveDatabase().
| void rpmtsCleanDig | ( | void * | ts | ) |
| pgpDig rpmtsDig | ( | void * | ts | ) |
| static int set2dbt | ( | dbiIndex | dbi, | |
| DBT * | data, | |||
| dbiIndexSet | set | |||
| ) | [static] |
Convert index set to database representation.
| dbi | index database handle | |
| data | retrieved data | |
| set | index set |
Definition at line 538 of file rpmdb.c.
References _DBSWAP, __db_dbt::data, __db_dbt::size, _dbswap::ui, and xmalloc().
Referenced by rpmdbAdd(), and rpmdbRemove().
| static unsigned taghash | ( | const char * | s | ) | [inline, static] |
Return a tagnum with hash on the (directory) path in upper 16 bits.
| s | (directory) path |
Definition at line 1388 of file rpmdb.c.
Referenced by rpmdbAdd(), and rpmdbFindFpList().
| static int unblockSignals | ( | rpmdb | db, | |
| sigset_t * | oldMask | |||
| ) | [static] |
Restore signal mask.
| db | rpm database | |
| oldMask | previous sigset |
Definition at line 824 of file rpmdb.c.
References rpmdbCheckSignals().
Referenced by miFreeHeader(), rpmdbAdd(), and rpmdbRemove().
Definition at line 1299 of file rpmdb.c.
References _rpmdb_debug.
Definition at line 1289 of file rpmdb.c.
References _rpmdb_debug.
int _db_filter_dups = 0 [static] |
int _db_tagged_file_indices = 1 [static] |
Definition at line 61 of file rpmdb.c.
Referenced by rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), and rpmdbGrowIterator().
int _rebuildinprogress = 0 [static] |
| int _rpmdb_debug = 0 |
Definition at line 49 of file rpmdb.c.
Referenced by dbiOpen(), rpmdbNew(), XrpmdbLink(), and XrpmdbUnlink().
struct rpmdb_s dbTemplate [static] |
struct _dbiVec* mydbvecs[] [static] |
rpmdbMatchIterator rpmmiRock [static] |
1.5.6