rpmcli.h File Reference
RPMCLI. | RPMBUILD.
`#include <popt.h>`
`#include <rpmmacro.h>`
`#include <rpmtypes.h>`
`#include <rpmtag.h>`
`#include <rpmps.h>`
`#include <rpmrc.h>`
`#include <rpmfi.h>`
`#include <rpmts.h>`
Include dependency graph for rpmcli.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | rpmQVKArguments_s
| Command line option information. More...
struct | rpmBuildArguments_s
| Describe build command line request. More...

## Macros

#define | RPMCLI_POPT_NODEPS -1026
| Common/global popt tokens used for command line option tables. More...
#define | RPMCLI_POPT_NOFDIGESTS -1027
#define | RPMCLI_POPT_NOSCRIPTS -1028
#define | RPMCLI_POPT_NOSIGNATURE -1029
#define | RPMCLI_POPT_NODIGEST -1030
#define | RPMCLI_POPT_NOHDRCHK -1031
#define | RPMCLI_POPT_NOCONTEXTS -1032
#define | RPMCLI_POPT_TARGETPLATFORM -1033

## Functions

poptContext | rpmcliInit (int argc, char *const argv[], struct poptOption *optionsTable)
| Initialize most everything needed by an rpm CLI executable context. More...
void | rpmcliConfigured (void)
| Make sure that rpm configuration has been read. More...
poptContext | rpmcliFini (poptContext optCon)
| Destroy most everything needed by an rpm CLI executable context. More...

## Variables

headerSprintfExtension | rpmHeaderFormats
| Table of query format extensions. More...
int | _noDirTokens
| Should version 3 packages be produced? More...
struct poptOption | rpmcliAllPoptTable []
| Popt option table for options shared by all modes and executables. More...
int | global_depFlags
struct poptOption | rpmcliDepFlagsPoptTable []
const char * | rpmcliTargets
struct rpmQVKArguments_s | rpmQVKArgs
struct rpmQVKArguments_s | rpmIArgs
struct rpmQVKArguments_s | rpmDBArgs
RPMDB
struct poptOption | rpmDatabasePoptTable []

## RPMQV

#define | RPMVERIFY_MD5 RPMVERIFY_FDIGEST
#define | RPMVERIFY_ALL ~(RPMVERIFY_NONE)
#define | RPMVERIFY_FAILURES (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
#define | _QUERY_FOR_BITS
#define | VERIFY_ATTRS
#define | VERIFY_ALL

enum

rpmQVSources_e {
RPMQV_PACKAGE = 0, RPMQV_PATH, RPMQV_ALL, RPMQV_RPM,
RPMQV_GROUP = RPMTAG_GROUP, RPMQV_WHATPROVIDES, RPMQV_WHATREQUIRES, RPMQV_TRIGGEREDBY = RPMTAG_TRIGGERNAME,
RPMQV_DBOFFSET, RPMQV_SPECFILE, RPMQV_PKGID, RPMQV_HDRID,
RPMQV_FILEID, RPMQV_TID, RPMQV_HDLIST, RPMQV_FTSWALK,
RPMQV_WHATNEEDS, RPMQV_SPECSRPM, RPMQV_SOURCEPKGID, RPMQV_WHATCONFLICTS = RPMTAG_CONFLICTNAME,
RPMQV_WHATOBSOLETES = RPMTAG_OBSOLETENAME
}

| Query/Verify argument qualifiers. More...

enum

rpmVerifyAttrs_e {
RPMVERIFY_NONE = 0, RPMVERIFY_FDIGEST = (1 << 0), RPMVERIFY_FILESIZE = (1 << 1), RPMVERIFY_LINKTO = (1 << 2),
RPMVERIFY_USER = (1 << 3), RPMVERIFY_GROUP = (1 << 4), RPMVERIFY_MTIME = (1 << 5), RPMVERIFY_MODE = (1 << 6),
RPMVERIFY_RDEV = (1 << 7), RPMVERIFY_CONTEXTS = (1 << 15), RPMVERIFY_READLINKFAIL = (1 << 28), RPMVERIFY_READFAIL = (1 << 29),
RPMVERIFY_LSTATFAIL = (1 << 30), RPMVERIFY_LGETFILECONFAIL = (1 << 31)
}

| Bit(s) for rpmVerifyFile() attributes and result. More...

enum

rpmQueryFlags_e {
QUERY_FOR_DEFAULT = 0, QUERY_FDIGEST = (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_CONTEXTS = (1 << 15), QUERY_FILES = (1 << 16), QUERY_DEPS = (1 << 17),
QUERY_SCRIPT = (1 << 18), QUERY_DIGEST = (1 << 19), QUERY_SIGNATURE = (1 << 20), QUERY_PATCHES = (1 << 21),
QUERY_HDRCHK = (1 << 22), 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_FDIGEST = (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_CONTEXTS = (1 << 15), VERIFY_FILES = (1 << 16), VERIFY_DEPS = (1 << 17),
VERIFY_SCRIPT = (1 << 18), VERIFY_DIGEST = (1 << 19), VERIFY_SIGNATURE = (1 << 20), VERIFY_PATCHES = (1 << 21),
VERIFY_HDRCHK = (1 << 22), 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...
typedef enum rpmQVSources_e | rpmQVSources
| Query/Verify argument qualifiers. More...
typedef enum rpmVerifyAttrs_e | rpmVerifyAttrs
| Bit(s) for rpmVerifyFile() attributes and result. More...
typedef enum rpmQueryFlags_e | rpmQueryFlags
| Bit(s) to control rpmQuery() operation, stored in qva_flags. More...
typedef enum rpmVerifyFlags_e | rpmVerifyFlags
| Bit(s) to control rpmVerify() operation, stored in qva_flags. More...
typedef struct rpmQVKArguments_s * | QVA_t
typedef int(* | QVF_t )(QVA_t qva, rpmts ts, Header h)
| Function to display iterator matches. More...
typedef int(* | QSpecF_t )(rpmts ts, QVA_t qva, const char *arg)
| Function to query spec file. More...
rpmQueryFlags | rpmcliQueryFlags
| Bit(s) from common command line options. More...
struct poptOption | rpmQVSourcePoptTable []
| Common query/verify mode options. More...
int | specedit
struct poptOption | rpmQueryPoptTable []
| Query mode options. More...
struct poptOption | rpmVerifyPoptTable []
| Verify mode options. More...
int | rpmcliShowMatches (QVA_t qva, rpmts ts)
| Display query/verify information for each header in iterator. More...
int | rpmQueryVerify (QVA_t qva, rpmts ts, const char *arg)
| Common query/verify source interface, called once for each CLI arg. More...
int | showQueryPackage (QVA_t qva, rpmts ts, Header h)
| Display results of package query. More...
int | rpmcliArgIter (rpmts ts, QVA_t qva, const char **argv)
| Iterate over query/verify arg list. More...
int | rpmcliQuery (rpmts ts, QVA_t qva, const char **argv)
| Display package information. More...
int | showVerifyPackage (QVA_t qva, rpmts ts, Header h)
| Display results of package verify. More...
int | rpmVerifySignatures (QVA_t qva, rpmts ts, void *_fd, const char *fn)
| Check package and header signatures. More...
int | rpmcliVerify (rpmts ts, QVA_t qva, const char **argv)
| Verify package install. More...

## RPMEIU

enum | rpmInstallInterfaceFlags_e { INSTALL_NONE = 0, INSTALL_PERCENT = (1 << 0), INSTALL_HASH = (1 << 1), INSTALL_NODEPS = (1 << 2), INSTALL_NOORDER = (1 << 3), INSTALL_LABEL = (1 << 4), INSTALL_UPGRADE = (1 << 5), INSTALL_FRESHEN = (1 << 6), INSTALL_INSTALL = (1 << 7), INSTALL_ERASE = (1 << 8), INSTALL_ALLMATCHES = (1 << 9) }
| Bit(s) to control rpmcliInstall() and rpmErase() operation. More...
typedef enum rpmInstallInterfaceFlags_e | rpmInstallInterfaceFlags
| Bit(s) to control rpmcliInstall() and rpmErase() operation. More...
int | rpmcliPackagesTotal
int | rpmcliHashesCurrent
int | rpmcliHashesTotal
rpmuint64_t | rpmcliProgressCurrent
rpmuint64_t | rpmcliProgressTotal
struct poptOption | rpmInstallPoptTable []
void * | rpmShowProgress (const void *arg, const rpmCallbackType what, const rpmuint64_t amount, const rpmuint64_t total, fnpyKey key, void *data)
| The rpm CLI generic transaction callback handler. More...
int | rpmInstallSource (rpmts ts, const char *arg, const char **specFilePtr, const char **cookie)
| Install source rpm package. More...
int | rpmcliInstallProblems (rpmts ts, const char *msg, int rc)
| Report package problems (if any). More...
int | rpmcliInstallSuggests (rpmts ts)
| Report packages(if any) that satisfy unresolved dependencies. More...
int | rpmcliInstallCheck (rpmts ts)
| Check package element dependencies in a transaction set, reporting problems. More...
int | rpmcliInstallOrder (rpmts ts)
| Order package elements in a transaction set, reporting problems. More...
int | rpmcliInstallRun (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
| Install/erase package elements in a transaction set, reporting problems. More...
int | rpmcliInstall (rpmts ts, QVA_t ia, const char **argv)
| Install/upgrade/freshen binary rpm package. More...
int | rpmErase (rpmts ts, QVA_t ia, const char **argv)
| Erase binary rpm package. More...

## RPMK

enum | rpmSignFlags_e { RPMSIGN_NONE = 0, RPMSIGN_CHK_SIGNATURE = 'K', RPMSIGN_NEW_SIGNATURE = 'R', RPMSIGN_ADD_SIGNATURE = 'A', RPMSIGN_DEL_SIGNATURE = 'D', RPMSIGN_IMPORT_PUBKEY = 'I' }
| Bit(s) to control rpmReSign() operation. More...
typedef enum rpmSignFlags_e | rpmSignFlags
| Bit(s) to control rpmReSign() operation. More...
struct poptOption | rpmSignPoptTable []
| Signature mode options. More...
rpmRC | rpmcliImportPubkey (const rpmts ts, const unsigned char *pkt, ssize_t pktlen)
| Import public key packet(s). More...
int | rpmcliSign (rpmts ts, QVA_t qva, const char **argv)
| Create/Modify/Check elements from signature header. More...

## RPMBT

typedef struct rpmBuildArguments_s * | BTA_t
struct rpmBuildArguments_s | rpmBTArgs
struct poptOption | rpmBuildPoptTable []

## Macro Definition Documentation

#define _QUERY_FOR_BITS

Value:
(QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
QUERY_FOR_DUMPFILES)

Definition at line 195 of file rpmcli.h.

Referenced by rpmcliQuery().

#define RPMCLI_POPT_NOCONTEXTS -1032

Definition at line 101 of file rpmcli.h.

Referenced by installArgCallback(), and queryArgCallback().

#define RPMCLI_POPT_NODEPS -1026

Common/global popt tokens used for command line option tables.

Definition at line 95 of file rpmcli.h.

Referenced by buildArgCallback(), installArgCallback(), and queryArgCallback().

#define RPMCLI_POPT_NODIGEST -1030

Definition at line 99 of file rpmcli.h.

Referenced by buildArgCallback(), installArgCallback(), queryArgCallback(), and rpmcliAllArgCallback().

#define RPMCLI_POPT_NOFDIGESTS -1027

Definition at line 96 of file rpmcli.h.

Referenced by installArgCallback(), and queryArgCallback().

#define RPMCLI_POPT_NOHDRCHK -1031

Definition at line 100 of file rpmcli.h.

Referenced by buildArgCallback(), installArgCallback(), queryArgCallback(), and rpmcliAllArgCallback().

#define RPMCLI_POPT_NOSCRIPTS -1028

Definition at line 97 of file rpmcli.h.

Referenced by installArgCallback(), and queryArgCallback().

#define RPMCLI_POPT_NOSIGNATURE -1029

Definition at line 98 of file rpmcli.h.

Referenced by buildArgCallback(), installArgCallback(), queryArgCallback(), and rpmcliAllArgCallback().

#define RPMCLI_POPT_TARGETPLATFORM -1033

Definition at line 102 of file rpmcli.h.

Referenced by rpmcliAllArgCallback().

#define RPMVERIFY_ALL ~(RPMVERIFY_NONE)

Definition at line 159 of file rpmcli.h.

Referenced by processPackageFiles(), and processSourceFiles().

#define RPMVERIFY_FAILURES (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)

Definition at line 160 of file rpmcli.h.

Referenced by rpmVerifyFile().

#define RPMVERIFY_MD5 RPMVERIFY_FDIGEST

Definition at line 158 of file rpmcli.h.

Referenced by genCpioListAndHeader().

#define VERIFY_ALL

Value:
( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
VERIFY_SIGNATURE | VERIFY_HDRCHK )

Definition at line 243 of file rpmcli.h.

Referenced by main(), and unsatisfiedDepend().

#define VERIFY_ATTRS

Value:
( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )

Definition at line 240 of file rpmcli.h.

Referenced by verifyHeader().

## Function Documentation

void rpmcliConfigured | ( | void |  | ) |

Make sure that rpm configuration has been read.

Warning
  Options like –rcfile and –verbose must precede callers option.

Definition at line 184 of file poptALL.c.

References _free(), EXIT_FAILURE, rpmcliInitialized, rpmcliTargets, rpmReadConfigFiles(), and xstrdup().

Referenced by main(), rpmcliAllArgCallback(), and rpmcliInit().

poptContext rpmcliFini | ( | poptContext | optCon | ) |

Destroy most everything needed by an rpm CLI executable context.

Parameters

  optCon | popt context

Returns
  NULL always

Definition at line 491 of file poptALL.c.

References _free(), _headerPool, _rpmdbPool, _rpmmiPool, evr_tuple_match, evr_tuple_mire, evr_tuple_order, keyids, mireFree(), rpmCLIMacroContext, rpmcliTargets, rpmFreeFilesystems(), rpmFreeMacros(), rpmFreeRpmrc(), rpmioClean(), rpmioFreePool(), rpmnsClean(), and tagClean().

Referenced by main(), and rpmcliAllArgCallback().

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)

Definition at line 620 of file poptALL.c.

References _, __progname, _debug, _free(), _hdr_stats, _rpmts_stats, bindtextdomain, checkfd(), EXIT_FAILURE, PACKAGE, rpmcliConfigured(), rpmGetPath(), rpmGlob(), rpmIncreaseVerbosity, rpmlog(), RPMLOG_NOTICE, RPMLOG_WARNING, rpmpoptfiles, rpmSecuritySaneFile(), rpmSetVerbosity, setlocale, setprogname, textdomain, USRLIBRPM, and xstrdup().

Referenced by main().

int rpmVerifySignatures | ( | QVA_t | qva,
|  | rpmts | ts,
|  | void * | _fd,
|  | const char * | fn
| ) |  |

Check package and header signatures.

Parameters

  qva | parsed query/verify options
  ts | transaction set
  _fd | package file handle
  fn | package file name

Returns
  0 on success, 1 on failure

Definition at line 883 of file rpmchecksig.c.

References _, _free(), _print_pkts, alloca(), _HE_s::c, fdInitDigest(), fdSetDig(), headerFini(), headerFree(), headerGet(), headerInit(), headerIsEntry(), headerNext(), _HE_s::p, pgpDigClean(), pgpGetSignature(), PGPHASHALGO_MD5, pgpPrtPkts(), pgpSetSig(), rpmDataType_u::ptr, rpmQVKArguments_s::qva_flags, readFile(), rpmIsDebug, rpmIsVerbose, rpmlog(), RPMLOG_ERR, RPMLOG_NOTICE, rpmpkgRead(), RPMRC_OK, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, rpmtsCleanDig(), rpmtsDig(), rpmVerifySignature(), stpcpy(), _HE_s::t, _HE_s::tag, VERIFY_DIGEST, and VERIFY_SIGNATURE.

Referenced by rpmcliSign().

## Variable Documentation

int global_depFlags

Definition at line 344 of file poptALL.c.

Referenced by main().

struct poptOption rpmcliDepFlagsPoptTable[]

Definition at line 347 of file poptALL.c.

const char* rpmcliTargets

Definition at line 156 of file poptALL.c.

Referenced by rpmcliAllArgCallback(), rpmcliConfigured(), rpmcliFini(), and rpmspecQuery().

headerSprintfExtension rpmHeaderFormats

Table of query format extensions.

Note
  Chains *headerCompoundFormats -> *headerDefaultFormats.

Definition at line 293 of file formats.c.

Referenced by addRpmTags(), hdr_subscript(), hdrSprintf(), packageBinaries(), parseForSimple(), printNewSpecfile(), queryHeader(), rpmcliImportPubkey(), rpmfiNew(), rpmpsmStage(), rpmShowProgress(), and rpmtsSolve().