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[]
int rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
void printUsage(poptContext con, FILE *fp, int flags)
int rpmtsInitDB(rpmts ts, int dbmode)
Initialize the database used by the transaction.
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
static struct poptOption optionsTable[]
struct _FD_s * FD_t
RPM IO file descriptor type.
rpmtxn rpmtxnEnd(rpmtxn txn)
Destroy transaction (lock) handle.
rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
Import a header into the rpmdb.
int main(int argc, char *argv[])
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
rpmtxn rpmtxnBegin(rpmts ts, rpmtxnFlags flags)
Create a transaction (lock) handle.
Header rpmdbNextIterator(rpmdbMatchIterator mi)
Return next package header from iteration.
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
Destroy rpm database iterator.
struct rpmdbMatchIterator_s * rpmdbMatchIterator
void argerror(const char *desc)
int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
int Fclose(FD_t fd)
fclose(3) clone.
const char * rpmcliRootDir
static int exportDB(rpmts ts)
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
static int importDB(rpmts ts)
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
struct headerToken_s * Header
RPM header and data retrieval types.