4 #include <rpm/rpmcli.h>
9 #if !defined(__GLIBC__) && !defined(__APPLE__)
24 {
"initdb",
'\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode,
MODE_INITDB,
25 N_(
"initialize database"), NULL},
26 {
"rebuilddb",
'\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode,
MODE_REBUILDDB,
27 N_(
"rebuild database inverted lists from installed package headers"),
29 {
"verifydb",
'\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
31 {
"exportdb",
'\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode,
MODE_EXPORTDB,
32 N_(
"export database to stdout header list"),
34 {
"importdb",
'\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode,
MODE_IMPORTDB,
35 N_(
"import database from stdin header list"),
41 { NULL,
'\0', POPT_ARG_INCLUDE_TABLE,
dbOptsTable, 0,
42 N_(
"Database options:"), NULL },
44 N_(
"Common options for all rpm modes and executables:"), NULL },
92 int main(
int argc,
char *argv[])
94 int ec = EXIT_FAILURE;
95 poptContext optCon =
rpmcliInit(argc, argv, optionsTable);
98 if (argc < 2 || poptPeekArg(optCon)) {
126 argerror(
_(
"only one major mode may be specified"));
static struct poptOption dbOptsTable[]
struct rpmdbMatchIterator_s * rpmdbMatchIterator
void printUsage(poptContext con, FILE *fp, int flags)
static struct poptOption optionsTable[]
rpmtxn rpmtxnEnd(rpmtxn txn)
Destroy transaction (lock) handle.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
int main(int argc, char *argv[])
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
Destroy rpm database iterator.
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
rpmts rpmtsCreate(void)
Create an empty transaction set.
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
int rpmtsInitDB(rpmts ts, int dbmode)
Initialize the database used by the transaction.
void argerror(const char *desc)
struct _FD_s * FD_t
RPM IO file descriptor type.
int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
struct headerToken_s * Header
RPM header and data retrieval types.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
const char * rpmcliRootDir
rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
Import a header into the rpmdb.
static int exportDB(rpmts ts)
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
static int importDB(rpmts ts)
Header rpmdbNextIterator(rpmdbMatchIterator mi)
Return next package header from iteration.
int rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
rpmtxn rpmtxnBegin(rpmts ts, rpmtxnFlags flags)
Create a transaction (lock) handle.
int Fclose(FD_t fd)
fclose(3) clone.