- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

# lib/rpmcli.h File Reference

`#include "rpmlib.h"`
`#include "rpmurl.h"`
`#include "rpmmacro.h"`

Go to the source code of this file.

## Data Structures
struct | rpmBuildArguments_s
| Describe build command line request. More...
struct | rpmQVArguments_s
| Describe query/verify command line request. More...
struct | rpmInstallArguments_s
| Describe database command line requests. More...
struct | IDT_s
| A rollback transaction id element. More...
struct | IDTindex_s
| A rollback transaction id index. More...
struct | rpmDatabaseArguments_s
| Describe database command line requests. More...
struct | rpmSignArguments_s
| Describe signature command line request. More...
## RPMQV
#define | VERIFY_ATTRS
#define | VERIFY_ALL ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST )
enum | rpmQueryFlags_e { QUERY_FOR_DEFAULT = 0, QUERY_MD5 = (1 << 0), QUERY_SIZE = (1 << 1), QUERY_LINKTO = (1 << 2), QUERY_USER = (1 << 3), QUERY_GROUP = (1 << 4), QUERY_MTIME = (1 << 5), QUERY_MODE = (1 << 6), QUERY_RDEV = (1 << 7), QUERY_FILES = (1 << 16), QUERY_DEPS = (1 << 17), QUERY_SCRIPT = (1 << 18), QUERY_DIGEST = (1 << 19), QUERY_FOR_LIST = (1 << 23), QUERY_FOR_STATE = (1 << 24), QUERY_FOR_DOCS = (1 << 25), QUERY_FOR_CONFIG = (1 << 26), QUERY_FOR_DUMPFILES = (1 << 27) }
| Bit(s) to control rpmQuery() operation, stored in qva_flags. More...
enum | rpmVerifyFlags_e { VERIFY_DEFAULT = 0, VERIFY_MD5 = (1 << 0), VERIFY_SIZE = (1 << 1), VERIFY_LINKTO = (1 << 2), VERIFY_USER = (1 << 3), VERIFY_GROUP = (1 << 4), VERIFY_MTIME = (1 << 5), VERIFY_MODE = (1 << 6), VERIFY_RDEV = (1 << 7), VERIFY_FILES = (1 << 16), VERIFY_DEPS = (1 << 17), VERIFY_SCRIPT = (1 << 18), VERIFY_DIGEST = (1 << 19), VERIFY_FOR_LIST = (1 << 23), VERIFY_FOR_STATE = (1 << 24), VERIFY_FOR_DOCS = (1 << 25), VERIFY_FOR_CONFIG = (1 << 26), VERIFY_FOR_DUMPFILES = (1 << 27) }
| Bit(s) to control rpmVerify() operation, stored in qva_flags. More...
rpmQVArguments_s | rpmQVArgs
poptOption | rpmQVSourcePoptTable []
| Common query/verify mode options.
int | specedit
poptOption | rpmQueryPoptTable []
| Query mode options.
poptOption | rpmVerifyPoptTable []
| Verify mode options.
typedef enum rpmQueryFlags_e | rpmQueryFlags
| Bit(s) to control rpmQuery() operation, stored in qva_flags.
typedef enum rpmVerifyFlags_e | rpmVerifyFlags
| Bit(s) to control rpmVerify() operation, stored in qva_flags.
typedef int(*) | QVF_t (QVA_t qva, rpmdb db, Header h)
  | Parameters:
  | qva | parsed query/verify options
int | showMatches (QVA_t qva, rpmdbMatchIterator mi, QVF_t showPackage)
| Display query/verify information for each header in iterator.
void | rpmDisplayQueryTags (FILE *fp)
| Display list of tags that can be used in --queryformat.
int | rpmQueryVerify (QVA_t qva, rpmQVSources source, const char *arg, rpmdb db, QVF_t showPackage)
| Common query/verify source interface, called once for each CLI arg.
int | showQueryPackage (QVA_t qva, rpmdb db, Header h)
| Display results of package query.
int | rpmQuery (QVA_t qva, rpmQVSources source, const char *arg)
| Display package information.
int | showVerifyPackage (QVA_t qva, rpmdb db, Header h)
| Display results of package verify.
int | rpmVerifyDigest (Header h)
| Check original header digest.
int | rpmVerify (QVA_t qva, rpmQVSources source, const char *arg)
| Verify package install.
## RPMK
#define | CHECKSIG_ALL (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG)
enum | rpmCheckSigFlags_e { CHECKSIG_NONE = 0, CHECKSIG_PGP = (1 << 0), CHECKSIG_MD5 = (1 << 1), CHECKSIG_GPG = (1 << 2) }
| Bit(s) to control rpmCheckSig() operation. More...
enum | rpmResignFlags_e { RESIGN_NONE = 0, RESIGN_CHK_SIGNATURE = 1, RESIGN_NEW_SIGNATURE, RESIGN_ADD_SIGNATURE }
| Bit(s) to control rpmReSign() operation. More...
rpmSignArguments_s | rpmKArgs
poptOption | rpmSignPoptTable []
typedef enum rpmCheckSigFlags_e | rpmCheckSigFlags
| Bit(s) to control rpmCheckSig() operation.
typedef enum rpmResignFlags_e | rpmResignFlags
| Bit(s) to control rpmReSign() operation.
int | rpmCheckSig (rpmCheckSigFlags flags, const char **argv)
| Check elements in signature header.
int | rpmReSign (rpmResignFlags add, char *passPhrase, const char **argv)
| Create/modify elements in signature header.
## RPMBT
rpmBuildArguments_s | rpmBTArgs
poptOption | rpmBuildPoptTable []
typedef rpmBuildArguments_s * | BTA_t
## RPMEIU
int | packagesTotal
rpmInstallArguments_s | rpmIArgs
poptOption | rpmInstallPoptTable []
typedef IDT_s * | IDT
| A rollback transaction id element.
typedef IDTindex_s * | IDTX
| A rollback transaction id index.
int | rpmInstall (const char *rootdir, const char **fileArgv, rpmtransFlags transFlags, rpmInstallInterfaceFlags interfaceFlags, rpmprobFilterFlags probFilter, rpmRelocation *relocations)
| Install/upgrade/freshen binary rpm package.
int | rpmInstallSource (const char *rootdir, const char *arg, const char **specFile, char **cookie)
| Install source rpm package.
int | rpmErase (const char *rootdir, const char **argv, rpmtransFlags transFlags, rpmEraseInterfaceFlags interfaceFlags)
| Erase binary rpm package.
IDTX | IDTXfree (IDTX idtx)
| Destroy id index.
IDTX | IDTXnew (void)
| Create id index.
IDTX | IDTXgrow (IDTX idtx, int need)
| Insure that index has room for "need" elements.
IDTX | IDTXsort (IDTX idtx)
| Sort tag (instance,value) pairs.
IDTX | IDTXload (rpmdb db, rpmTag tag)
| Load tag (instance,value) pairs from rpm databse, and return sorted id index.
IDTX | IDTXglob (const char *globstr, rpmTag tag)
| Load tag (instance,value) pairs from packages, and return sorted id index.
void * | rpmShowProgress (const void *arg, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void *pkgKey, void *data)
| The rpm CLI generic transaction callback.
int | rpmRollback (struct rpmInstallArguments_s *ia, const char **argv)
| Rollback transactions, erasing new, reinstalling old, package(s).
## Variables
int | _noDirTokens
| Should version 3 packages be produced?
RPMDB
rpmDatabaseArguments_s | rpmDBArgs
poptOption | rpmDatabasePoptTable []

## Detailed Description

Definition in file rpmcli.h.

## Define Documentation

#define CHECKSIG_ALL (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG)

Definition at line 514 of file rpmcli.h.

Referenced by main().

#define VERIFY_ALL ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST )

Definition at line 133 of file rpmcli.h.

Referenced by main().

#define VERIFY_ATTRS

Value:

    ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
        VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV )

Definition at line 130 of file rpmcli.h.

Referenced by verifyHeader().

## Typedef Documentation

typedef struct IDT_s * IDT

A rollback transaction id element.

typedef struct IDTindex_s * IDTX

A rollback transaction id index.

## Function Documentation

IDTX IDTXfree | ( | IDTX | idtx | ) |

Destroy id index.

Parameters:

  | idtx | id index

Returns:
  NULL always

Definition at line 738 of file rpminstall.c.

References _free(), IDT_s::h, headerFree(), IDTindex_s::idt, and IDTindex_s::nidt.

Referenced by rpmRollback().

IDTX IDTXglob | ( | const char * | globstr,
|  | rpmTag | tag |
| ) |  |  |

Load tag (instance,value) pairs from packages, and return sorted id index.

Parameters:

  | db | glob expression
  | tag | rpm tag

Returns:
  id index

Definition at line 831 of file rpminstall.c.

References _, _free(), Fclose(), rpmEIU::fd, Ferror(), Fopen(), Fstrerror(), rpmEIU::h, IDT_s::h, headerFree(), headerGetEntry(), headerLink(), headerNVR(), IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, rpmEIU::isSource, IDT_s::key, IDT_s::n, IDTindex_s::nidt, IDT_s::r, RPMERR_OPEN, rpmError, rpmGlob(), rpmEIU::rpmrc, RPMRC_OK, rpmReadPackageHeader(), IDT_s::u32, IDT_s::v, IDT_s::val, and xstrdup().

Referenced by rpmRollback().

IDTX IDTXgrow | ( | IDTX | idtx,
|  | int | need |
| ) |  |  |

Insure that index has room for "need" elements.

Parameters:

  | idtx | id index
  | need | additional no. of elements needed

Returns:
  id index (with room for "need" elements)

Definition at line 762 of file rpminstall.c.

References IDTindex_s::alloced, IDTindex_s::delta, IDTindex_s::idt, IDTXnew(), IDTindex_s::nidt, IDTindex_s::size, and xrealloc().

Referenced by IDTXglob(), and IDTXload().

IDTX IDTXload | ( | rpmdb | db,
|  | rpmTag | tag |
| ) |  |  |

Load tag (instance,value) pairs from rpm databse, and return sorted id index.

Parameters:

  | db | rpm database
  | tag | rpm tag

Returns:
  id index

Definition at line 786 of file rpminstall.c.

References rpmEIU::db, rpmEIU::h, IDT_s::h, headerGetEntry(), headerLink(), headerNVR(), IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, IDT_s::key, IDT_s::n, IDTindex_s::nidt, IDT_s::r, RPM_INT32_TYPE, RPM_NULL_TYPE, rpmdbFreeIterator(), rpmdbGetIteratorOffset(), rpmdbInitIterator(), rpmdbNextIterator(), IDT_s::u32, IDT_s::v, and IDT_s::val.

Referenced by rpmRollback().

IDTX IDTXnew | ( | void |  | ) |

Create id index.

Returns:
  new id index

Definition at line 754 of file rpminstall.c.

References xcalloc().

Referenced by IDTXgrow().

IDTX IDTXsort | ( | IDTX | idtx | ) |

Sort tag (instance,value) pairs.

Parameters:

  | idtx | id index

Returns:
  id index

Definition at line 779 of file rpminstall.c.

References IDTindex_s::idt, IDTintcmp(), IDTindex_s::nidt, and IDTindex_s::size.

Referenced by IDTXglob(), and IDTXload().

void* rpmShowProgress | ( | const void * | arg,
|  | const rpmCallbackType | what,
|  | const unsigned long | amount,
|  | const unsigned long | total,
|  | const void * | pkgKey,
|  | void * | data |
| ) |  |  |

The rpm CLI generic transaction callback.

Deprecated:
  Transaction callback arguments need to change, so don't rely on this routine in the rpmcli API.

Parameters:

  | arg | per-callback private data (e.g. an rpm header)
  | what | callback identifier
  | amount | per-callback progress info
  | total | per-callback progress info
  | pkgkey | opaque header key (e.g. file name or PyObject)
  | data | private data (e.g. rpmInstallInterfaceFlags)

Returns:
  per-callback data (e.g. an opened FD_t)

Definition at line 75 of file rpminstall.c.

References _, _free(), Fclose(), fdFree, fdLink, Fopen(), hashesPrinted, headerSprintf(), INSTALL_HASH, INSTALL_LABEL, INSTALL_PERCENT, packagesTotal, printHash(), progressCurrent, progressTotal, RPMCALLBACK_INST_CLOSE_FILE, RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START, RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP, RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP, rpmHeaderFormats, and rpmTagTable.

Referenced by rpmInstall(), and rpmRollback().

int rpmVerifyDigest | ( | Header | h | ) |

Check original header digest.

Todo:
  Make digest check part of rpmdb iterator.

Parameters:

  | h | header

Returns:
  0 on success (or unavailable), 1 on digest mismatch

Definition at line 305 of file verify.c.

References _free(), headerFreeData(), headerGetEntry(), PGPHASHALGO_SHA1, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), RPMTAG_BADSHA1HEADER, RPMTAG_HEADERIMMUTABLE, RPMTAG_SHA1HEADER, and RPMTAG_SHA1RHN.

Referenced by rhnLoad(), and showVerifyPackage().

## Variable Documentation

int packagesTotal

Definition at line 25 of file rpminstall.c.

Referenced by rpmInstall(), rpmRollback(), and rpmShowProgress().