rpmdb.c File Reference
`#include "system.h"`
`#include <popt.h>`
`#include <rpm/rpmcli.h>`
`#include <rpm/rpmdb.h>`
`#include "cliutils.h"`
`#include "debug.h"`
Include dependency graph for rpmdb.c:

Go to the source code of this file.

## Enumerations

enum

modes {
MODE_BUILD = (1 << 4), MODE_REBUILD = (1 << 5), MODE_RECOMPILE = (1 << 8), MODE_TARBUILD = (1 << 11),
MODE_INITDB = (1 << 0), MODE_REBUILDDB = (1 << 1), MODE_VERIFYDB = (1 << 2), MODE_EXPORTDB = (1 << 3),
MODE_IMPORTDB = (1 << 4), MODE_CHECKSIG = (1 << 0), MODE_IMPORTKEY = (1 << 1), MODE_DELKEY = (1 << 2),
MODE_LISTKEY = (1 << 3), MODE_QUERY = (1 << 0), MODE_VERIFY = (1 << 3), MODE_INSTALL = (1 << 1),
MODE_ERASE = (1 << 2), MODE_UNKNOWN = 0, MODE_ADDSIGN = (1 << 0), MODE_RESIGN = (1 << 1),
MODE_DELSIGN = (1 << 2), MODE_UNKNOWN = 0, MODE_QUERY = (1 << 0), MODE_PARSE = (1 << 1)
}

## Functions

static int | exportDB (rpmts ts)
static int | importDB (rpmts ts)
int | main (int argc, char *argv[])

## Variables

char ** | environ = NULL
static int | mode = 0
static struct poptOption | dbOptsTable []
static struct poptOption | optionsTable []

## Enumeration Type Documentation

enum modes

Enumerator
MODE_BUILD |
MODE_REBUILD |
MODE_RECOMPILE |
MODE_TARBUILD |
MODE_INITDB |
MODE_REBUILDDB |
MODE_VERIFYDB |
MODE_EXPORTDB |
MODE_IMPORTDB |
MODE_CHECKSIG |
MODE_IMPORTKEY |
MODE_DELKEY |
MODE_LISTKEY |
MODE_QUERY |
MODE_VERIFY |
MODE_INSTALL |
MODE_ERASE |
MODE_UNKNOWN |
MODE_ADDSIGN |
MODE_RESIGN |
MODE_DELSIGN |
MODE_UNKNOWN |
MODE_QUERY |
MODE_PARSE |

Definition at line 13 of file rpmdb.c.

## Function Documentation

static int exportDB | ( | rpmts | ts | ) |

static

Definition at line 51 of file rpmdb.c.

References Fclose(), fdDup(), HEADER_MAGIC_YES, headerWrite(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbNextIterator(), rpmtsInitIterator(), RPMTXN_READ, rpmtxnBegin(), and rpmtxnEnd().

Referenced by main().

static int importDB | ( | rpmts | ts | ) |

static

Definition at line 73 of file rpmdb.c.

References Fclose(), fdDup(), HEADER_MAGIC_YES, headerRead(), rpmtsImportHeader(), RPMTXN_WRITE, rpmtxnBegin(), and rpmtxnEnd().

Referenced by main().

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 92 of file rpmdb.c.

References _, argerror(), exportDB(), importDB(), MODE_EXPORTDB, MODE_IMPORTDB, MODE_INITDB, MODE_REBUILDDB, MODE_VERIFYDB, printUsage(), rpmcliFini(), rpmcliInit(), rpmcliRootDir, rpmExpandNumeric(), rpmtsCreate(), rpmtsFree(), rpmtsInitDB(), rpmtsRebuildDB(), rpmtsSetRootDir(), rpmtsSetVSFlags(), and rpmtsVerifyDB().

## Variable Documentation

struct poptOption dbOptsTable[]

static

Initial value:
= {
{ "initdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_INITDB,
"initialize database" , NULL},
{ "rebuilddb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_REBUILDDB,
"rebuild database inverted lists from installed package headers" ,
NULL},
{ "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
&mode, MODE_VERIFYDB, "verify database files" , NULL},
{ "exportdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_EXPORTDB,
"export database to stdout header list" ,
NULL},
{ "importdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_IMPORTDB,
"import database from stdin header list" ,
NULL},
POPT_TABLEEND
}
MODE_VERIFYDB
Definition: rpmdb.c:16
MODE_INITDB
Definition: rpmdb.c:14
mode
static int mode
Definition: rpmdb.c:21
MODE_REBUILDDB
Definition: rpmdb.c:15
MODE_EXPORTDB
Definition: rpmdb.c:17
MODE_IMPORTDB
Definition: rpmdb.c:18

Definition at line 23 of file rpmdb.c.

char** environ = NULL

Definition at line 10 of file rpmdb.c.

int mode = 0

static

Definition at line 21 of file rpmdb.c.

Referenced by fill_archive_entry(), and process_package().

struct poptOption optionsTable[]

static

Initial value:
= {
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, dbOptsTable, 0,
"Database options:" , NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
"Common options for all rpm modes and executables:" , NULL },
POPT_AUTOALIAS
POPT_AUTOHELP
POPT_TABLEEND
}
dbOptsTable
static struct poptOption dbOptsTable[]
Definition: rpmdb.c:23
rpmcliAllPoptTable
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.

Definition at line 40 of file rpmdb.c.