# Command Line API.

## Data Structures
struct | rpmQVKArguments_s
| Describe query/verify/signature command line operation. More...
struct | rpmBuildArguments_s
| Describe build command line request. More...
struct | rpmInstallArguments_s
| Describe database command line requests. More...
struct | rpmDatabaseArguments_s
| Describe database command line requests. More...
## Files
file | rpmcli.h
file | rpmlib.h
| In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.

## Functions
static int | checkSpec (rpmts ts, Header h)
| Parse spec file and build package.
poptContext | rpmcliInit (int argc, char *const argv[], struct poptOption *optionsTable)
| Initialize most everything needed by an rpm CLI executable context.
void | rpmcliConfigured (void)
| Make sure that rpm configuration has been read.
poptContext | rpmcliFini (poptContext optCon)
| Destroy most everything needed by an rpm CLI executable context.
## Variables
int | _noDirTokens
| Should version 3 packages be produced?
struct poptOption | rpmcliAllPoptTable []
| Popt option table for options shared by all modes and executables.

## Define Documentation

#define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES

Definition at line 371 of file rpmcli.h.

Referenced by main().

#define UNINSTALL_NODEPS INSTALL_NODEPS

Definition at line 370 of file rpmcli.h.

Referenced by main().

#define UNINSTALL_NONE INSTALL_NONE

Bit(s) to control rpmErase() operation.

Definition at line 369 of file rpmcli.h.

## Typedef Documentation

typedef struct rpmBuildArguments_s* BTA_t

Definition at line 335 of file rpmcli.h.

typedef int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)

Function to query spec file.

Parameters:

  | ts | transaction set
  | qva | parsed query/verify options
  | arg | query argument

Returns:
  0 on success

Definition at line 168 of file rpmcli.h.

typedef struct rpmQVKArguments_s* QVA_t

Definition at line 148 of file rpmcli.h.

typedef int(* QVF_t)(QVA_t qva, rpmts ts, Header h)

Function to display iterator matches.

Parameters:

  | qva | parsed query/verify options
  | ts | transaction set
  | h | header to use for query/verify

Returns:
  0 on success

Definition at line 158 of file rpmcli.h.

typedef enum rpmInstallFlags_e rpmInstallFlags

Bit(s) to control rpmInstall() operation.

typedef enum rpmQueryFlags_e rpmQueryFlags

Bit(s) to control rpmQuery() operation, stored in qva_flags.

Todo:
  Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?.

typedef enum rpmQVSources_e rpmQVSources

Query/Verify argument qualifiers.

Todo:
  Reassign to tag values.

typedef enum rpmSignFlags_e rpmSignFlags

Bit(s) to control rpmReSign() operation.

## Enumeration Type Documentation

enum rpmInstallFlags_e

Bit(s) to control rpmInstall() operation.

Enumerator:

  INSTALL_NONE |
  INSTALL_PERCENT | from --percent
  INSTALL_HASH | from --hash
  INSTALL_NODEPS | from --nodeps
  INSTALL_NOORDER | from --noorder
  INSTALL_LABEL | from --verbose (notify)
  INSTALL_UPGRADE | from --upgrade
  INSTALL_FRESHEN | from --freshen
  INSTALL_INSTALL | from --install
  INSTALL_ERASE | from --erase
  INSTALL_ALLMATCHES | from --allmatches

Definition at line 352 of file rpmcli.h.

enum rpmQueryFlags_e

Bit(s) to control rpmQuery() operation, stored in qva_flags.

Todo:
  Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?.

Enumerator:

  QUERY_FOR_DEFAULT |
  QUERY_MD5 | from --nomd5
  QUERY_FILEDIGEST | from --nofiledigest, same as --nomd5
  QUERY_SIZE | from --nosize
  QUERY_LINKTO | from --nolink
  QUERY_USER | from --nouser)
  QUERY_GROUP | from --nogroup)
  QUERY_MTIME | from --nomtime)
  QUERY_MODE | from --nomode)
  QUERY_RDEV | from --nodev
  QUERY_CONTEXTS | verify: from --nocontexts
  QUERY_FILES | verify: from --nofiles
  QUERY_DEPS | verify: from --nodeps
  QUERY_SCRIPT | verify: from --noscripts
  QUERY_DIGEST | verify: from --nodigest
  QUERY_SIGNATURE | verify: from --nosignature
  QUERY_PATCHES | verify: from --nopatches
  QUERY_HDRCHK | verify: from --nohdrchk
  QUERY_FOR_LIST | query: from --list
  QUERY_FOR_STATE | query: from --state
  QUERY_FOR_DOCS | query: from --docfiles
  QUERY_FOR_CONFIG | query: from --configfiles
  QUERY_FOR_DUMPFILES | query: from --dump

Definition at line 110 of file rpmcli.h.

enum rpmQVSources_e

Query/Verify argument qualifiers.

Todo:
  Reassign to tag values.

Enumerator:

  RPMQV_PACKAGE | ... from package name db search.
  RPMQV_PATH | ... from file path db search.
  RPMQV_ALL | ... from each installed package.
  RPMQV_RPM | ... from reading binary rpm package.
  RPMQV_GROUP | ... from group db search.
  RPMQV_WHATPROVIDES | ... from provides db search.
  RPMQV_WHATREQUIRES | ... from requires db search.
  RPMQV_TRIGGEREDBY | ... from trigger db search.
  RPMQV_DBOFFSET | ... from database header instance.
  RPMQV_SPECFILE | ... from spec file parse (query only).
  RPMQV_PKGID | ... from package id (header+payload MD5).
  RPMQV_HDRID | ... from header id (immutable header SHA1).
  RPMQV_FILEID | ... from file id (file MD5).
  RPMQV_TID | ... from install transaction id (time stamp).
  RPMQV_HDLIST | ... from system hdlist.
  RPMQV_FTSWALK | ... from fts(3) walk.

Definition at line 87 of file rpmcli.h.

enum rpmSignFlags_e

Bit(s) to control rpmReSign() operation.

Enumerator:

  RPMSIGN_NONE |
  RPMSIGN_CHK_SIGNATURE | from --checksig
  RPMSIGN_NEW_SIGNATURE | from --resign
  RPMSIGN_ADD_SIGNATURE | from --addsign
  RPMSIGN_DEL_SIGNATURE | from --delsign
  RPMSIGN_IMPORT_PUBKEY | from --import

Definition at line 485 of file rpmcli.h.

## Function Documentation

static int checkSpec | ( | rpmts | ts,
|  | Header | h |
| ) |  |  | `[static]`

Parse spec file and build package.

Definition at line 26 of file build.c.

References _, headerIsEntry(), rpmlog(), RPMLOG_ERR, rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), RPMTAG_CONFLICTNAME, RPMTAG_REQUIRENAME, rpmtsAddInstallElement(), rpmtsCheck(), rpmtsClean(), and rpmtsProblems().

Referenced by buildForTarget().

int rpmcliArgIter | ( | rpmts | ts,
|  | QVA_t | qva,
|  | ARGV_const_t | argv |
| ) |  |  |

Iterate over query/verify arg list.

Parameters:

  | ts | transaction set
  | qva | parsed query/verify options
  | argv | query argument(s) (or NULL)

Returns:
  0 on success, else no. of failures

void rpmcliConfigured | ( | void |  | ) |

Make sure that rpm configuration has been read.

Warning:
  Options like --rcfile and --verbose must precede callers option.

Referenced by main().

poptContext rpmcliFini | ( | poptContext | optCon | ) |

Destroy most everything needed by an rpm CLI executable context.

Parameters:

  | optCon | popt context

Returns:
  NULL always

poptContext rpmcliInit | ( | int | argc,
|  | char *const | argv[],
|  | struct poptOption * | optionsTable |
| ) |  |  |

Initialize most everything needed by an rpm CLI executable context.

Parameters:

  | argc | no. of args
  | argv | arg array
  | optionsTable | popt option table

Returns:
  popt context (or NULL)

int rpmcliQuery | ( | rpmts | ts,
|  | QVA_t | qva,
|  | ARGV_const_t | argv |
| ) |  |  |

Display package information.

Todo:
  hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. Union?

Parameters:

  | ts | transaction set
  | qva | parsed query/verify options
  | argv | query argument(s) (or NULL)

Returns:
  0 on success, else no. of failures

Referenced by main().

int rpmcliShowMatches | ( | QVA_t | qva,
|  | rpmts | ts |
| ) |  |  |

Display query/verify information for each header in iterator.

This routine uses:

- qva->qva_mi rpm database iterator
- qva->qva_showPackage query/verify display routine

Parameters:

  | qva | parsed query/verify options
  | ts | transaction set

Returns:
  result of last non-zero showPackage() return

int rpmcliSign | ( | rpmts | ts,
|  | QVA_t | qva,
|  | ARGV_const_t | argv |
| ) |  |  |

Create/Modify/Check elements from signature header.

Parameters:

  | ts | transaction set
  | qva | mode flags and parameters
  | argv | array of arguments (NULL terminated)

Returns:
  0 on success

Referenced by main().

int rpmcliVerify | ( | rpmts | ts,
|  | QVA_t | qva,
|  | ARGV_const_t | argv |
| ) |  |  |

Verify package install.

Todo:
  hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. Union?

Parameters:

  | ts | transaction set
  | qva | parsed query/verify options
  | argv | verify argument(s) (or NULL)

Returns:
  0 on success, else no. of failures

Referenced by main().

void rpmDisplayQueryTags | ( | FILE * | fp | ) |

Display list of tags that can be used in --queryformat.

Parameters:

  | fp | file handle to use for display

int rpmErase | ( | rpmts | ts,
|  | struct rpmInstallArguments_s * | ia,
|  | ARGV_const_t | argv |
| ) |  |  |

Erase binary rpm package.

Parameters:

  | ts | transaction set
  | ia | control args/bits
  | argv | array of package file names (NULL terminated)

Returns:
  0 on success

Referenced by main().

int rpmInstall | ( | rpmts | ts,
|  | struct rpmInstallArguments_s * | ia,
|  | ARGV_t | fileArgv |
| ) |  |  |

Install/upgrade/freshen binary rpm package.

Parameters:

  | ts | transaction set
  | ia | mode flags and parameters
  | fileArgv | array of package file names (NULL terminated)

Returns:
  0 on success

Todo:
  fileArgv is modified on errors, should be ARGV_const_t

Referenced by main().

int rpmInstallSource | ( | rpmts | ts,
|  | const char * | arg,
|  | char ** | specFilePtr,
|  | char ** | cookie |
| ) |  |  |

Install source rpm package.

Parameters:

  | ts | transaction set
  | arg | source rpm file name

Return values:

  | *specFilePtr | (installed) spec file name
  | *cookie |

Returns:
  0 on success

Referenced by main().

int rpmQueryVerify | ( | QVA_t | qva,
|  | rpmts | ts,
|  | const char * | arg |
| ) |  |  |

Common query/verify source interface, called once for each CLI arg.

This routine uses:

- qva->qva_mi rpm database iterator
- qva->qva_showPackage query/verify display routine

Parameters:

  | qva | parsed query/verify options
  | ts | transaction set
  | arg | name of source to query/verify

Returns:
  showPackage() result, 1 if rpmdbInitIterator() is NULL

void* rpmShowProgress | ( | const void * | arg,
|  | const rpmCallbackType | what,
|  | const rpm_loff_t | amount,
|  | const rpm_loff_t | total,
|  | fnpyKey | key,
|  | void * | data |
| ) |  |  |

The rpm CLI generic transaction callback handler.

Todo:
  Remove headerFormat() from the progress 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
  | key | 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)

int showQueryPackage | ( | QVA_t | qva,
|  | rpmts | ts,
|  | Header | h |
| ) |  |  |

Display results of package query.

Todo:
  Devise a meaningful return code.

Parameters:

  | qva | parsed query/verify options
  | ts | transaction set
  | h | header to use for query

Returns:
  0 always

int showVerifyPackage | ( | QVA_t | qva,
|  | rpmts | ts,
|  | Header | h |
| ) |  |  |

Display results of package verify.

Parameters:

  | qva | parsed query/verify options
  | ts | transaction set
  | h | header to use for verify

Returns:
  result of last non-zero verify return

## Variable Documentation

int _noDirTokens

Should version 3 packages be produced?

struct rpmBuildArguments_s rpmBTArgs

Referenced by main().

struct poptOption rpmBuildPoptTable[]

struct poptOption rpmcliAllPoptTable[]

Popt option table for options shared by all modes and executables.

int rpmcliHashesCurrent

int rpmcliHashesTotal

int rpmcliPackagesTotal

int rpmcliProgressCurrent

int rpmcliProgressTotal

rpmQueryFlags rpmcliQueryFlags

Bit(s) from common command line options.

struct poptOption rpmDatabasePoptTable[]

struct rpmDatabaseArguments_s rpmDBArgs

Referenced by main().

struct rpmInstallArguments_s rpmIArgs

Referenced by main().

struct poptOption rpmInstallPoptTable[]

struct poptOption rpmQueryPoptTable[]

struct rpmQVKArguments_s rpmQVKArgs

Referenced by main().

struct poptOption rpmQVSourcePoptTable[]

struct poptOption rpmSignPoptTable[]

struct poptOption rpmVerifyPoptTable[]