rpm  4.14.0
Files | Data Structures | Functions | Variables
Command Line API.

Parsing RPM command line arguments. More...

Collaboration diagram for Command Line API.:

Files

file  rpmcli.h
 Parsing RPM command line arguments.
 
file  rpmlib.h
 In Memoriam: Steve Taylor stayl.nosp@m.or@r.nosp@m.edhat.nosp@m..com was here, now he's not.
 

Data Structures

struct  rpmQVKArguments_s
 Describe query/verify/signature command line operation. More...
 
struct  rpmInstallArguments_s
 Describe database command line requests. More...
 

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

struct poptOption rpmcliAllPoptTable []
 Popt option table for options shared by all modes and executables. More...
 

RPMQV

enum  rpmQVSources_e {
  RPMQV_PACKAGE = 0, RPMQV_PATH, RPMQV_ALL, RPMQV_RPM,
  RPMQV_GROUP, RPMQV_WHATPROVIDES, RPMQV_WHATREQUIRES, RPMQV_TRIGGEREDBY,
  RPMQV_DBOFFSET, RPMQV_SPECRPMS, RPMQV_SPECFILE = RPMQV_SPECRPMS, RPMQV_PKGID,
  RPMQV_HDRID, RPMQV_TID, RPMQV_SPECSRPM, RPMQV_WHATRECOMMENDS,
  RPMQV_WHATSUGGESTS, RPMQV_WHATSUPPLEMENTS, RPMQV_WHATENHANCES, RPMQV_SPECBUILTRPMS
}
 Query/Verify argument qualifiers. More...
 
enum  rpmQueryFlags_e {
  QUERY_FOR_DEFAULT = 0, QUERY_MD5 = (1 << 0), QUERY_FILEDIGEST = (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), QUERY_FOR_LICENSE = (1 << 28)
}
 Bit(s) to control rpmQuery() operation, stored in qva_flags. More...
 
typedef struct rpmQVKArguments_sQVA_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 rpmQVKArguments_s rpmQVKArgs
 
struct poptOption rpmQVSourcePoptTable []
 
struct poptOption rpmQueryPoptTable []
 
struct poptOption rpmVerifyPoptTable []
 
void rpmDisplayQueryTags (FILE *fp)
 Display list of tags that can be used in –queryformat. More...
 
int showQueryPackage (QVA_t qva, rpmts ts, Header h)
 Display results of package query. More...
 
int rpmcliArgIter (rpmts ts, QVA_t qva, ARGV_const_t argv)
 Iterate over query/verify arg list. More...
 
int rpmcliQuery (rpmts ts, QVA_t qva, ARGV_const_t argv)
 Display package information. More...
 
int showVerifyPackage (QVA_t qva, rpmts ts, Header h)
 Display results of package verify. More...
 
int rpmcliVerify (rpmts ts, QVA_t qva, ARGV_const_t argv)
 Verify package install. More...
 

RPMEIU

enum  rpmInstallFlags_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), INSTALL_REINSTALL = (1 << 10)
}
 Bit(s) to control rpmInstall() operation. More...
 
typedef rpmFlags rpmInstallFlags
 
struct rpmInstallArguments_s rpmIArgs
 
struct poptOption rpmInstallPoptTable []
 
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. More...
 
int rpmInstallSource (rpmts ts, const char *arg, char **specFilePtr, char **cookie)
 Install source rpm package. More...
 
int rpmInstall (rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
 Install/upgrade/freshen/reinstall binary rpm package. More...
 
int rpmErase (rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
 Erase binary rpm package. More...
 
#define UNINSTALL_NONE   INSTALL_NONE
 Bit(s) to control rpmErase() operation. More...
 
#define UNINSTALL_NODEPS   INSTALL_NODEPS
 
#define UNINSTALL_ALLMATCHES   INSTALL_ALLMATCHES
 

RPMK

int rpmcliVerifySignatures (rpmts ts, ARGV_const_t argv)
 Verify package signatures. More...
 

Detailed Description

Parsing RPM command line arguments.

Macro Definition Documentation

◆ UNINSTALL_ALLMATCHES

#define UNINSTALL_ALLMATCHES   INSTALL_ALLMATCHES

Definition at line 305 of file rpmcli.h.

◆ UNINSTALL_NODEPS

#define UNINSTALL_NODEPS   INSTALL_NODEPS

Definition at line 304 of file rpmcli.h.

◆ UNINSTALL_NONE

#define UNINSTALL_NONE   INSTALL_NONE

Bit(s) to control rpmErase() operation.

Definition at line 303 of file rpmcli.h.

Typedef Documentation

◆ QSpecF_t

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

Function to query spec file.

Parameters
tstransaction set
qvaparsed query/verify options
argquery argument
Returns
0 on success

Definition at line 172 of file rpmcli.h.

◆ QVA_t

typedef struct rpmQVKArguments_s* QVA_t

Definition at line 152 of file rpmcli.h.

◆ QVF_t

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

Function to display iterator matches.

Parameters
qvaparsed query/verify options
tstransaction set
hheader to use for query/verify
Returns
0 on success

Definition at line 162 of file rpmcli.h.

◆ rpmInstallFlags

Definition at line 298 of file rpmcli.h.

Enumeration Type Documentation

◆ 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

INSTALL_REINSTALL 

from –reinstall

Definition at line 283 of file rpmcli.h.

◆ 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

QUERY_FOR_LICENSE 

query: from –licensefiles

Definition at line 111 of file rpmcli.h.

◆ 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_SPECRPMS 

... from spec file binaries (query only).

RPMQV_SPECFILE 

... backwards compatibility

RPMQV_PKGID 

... from package id (header+payload MD5).

RPMQV_HDRID 

... from header id (immutable header SHA1).

RPMQV_TID 

... from install transaction id (time stamp).

RPMQV_SPECSRPM 

... from spec file source (query only).

RPMQV_WHATRECOMMENDS 

... from recommends db search.

RPMQV_WHATSUGGESTS 

... from suggests db search.

RPMQV_WHATSUPPLEMENTS 

... from supplements db search.

RPMQV_WHATENHANCES 

... from enhances db search.

RPMQV_SPECBUILTRPMS 

... from pkgs which would be built from spec

Definition at line 82 of file rpmcli.h.

Function Documentation

◆ rpmcliArgIter()

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

Iterate over query/verify arg list.

Parameters
tstransaction set
qvaparsed query/verify options
argvquery argument(s) (or NULL)
Returns
0 on success, else no. of failures

◆ rpmcliConfigured()

void rpmcliConfigured ( void  )

Make sure that rpm configuration has been read.

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

◆ rpmcliFini()

poptContext rpmcliFini ( poptContext  optCon)

Destroy most everything needed by an rpm CLI executable context.

Parameters
optConpopt context
Returns
NULL always

◆ rpmcliInit()

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

Initialize most everything needed by an rpm CLI executable context.

Parameters
argcno. of args
argvarg array
optionsTablepopt option table
Returns
popt context (or NULL)

◆ rpmcliQuery()

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
tstransaction set
qvaparsed query/verify options
argvquery argument(s) (or NULL)
Returns
0 on success, else no. of failures

◆ rpmcliVerify()

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
tstransaction set
qvaparsed query/verify options
argvverify argument(s) (or NULL)
Returns
0 on success, else no. of failures

◆ rpmcliVerifySignatures()

int rpmcliVerifySignatures ( rpmts  ts,
ARGV_const_t  argv 
)

Verify package signatures.

Parameters
tstransaction set
argvarray of package path arguments (NULL terminated)
Returns
0 on success

◆ rpmDisplayQueryTags()

void rpmDisplayQueryTags ( FILE *  fp)

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

Parameters
fpfile handle to use for display

◆ rpmErase()

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

Erase binary rpm package.

Parameters
tstransaction set
iacontrol args/bits
argvarray of package file names (NULL terminated)
Returns
0 on success

◆ rpmInstall()

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

Install/upgrade/freshen/reinstall binary rpm package.

Parameters
tstransaction set
iamode flags and parameters
fileArgvarray of package file names (NULL terminated)
Returns
0 on success
Todo:
fileArgv is modified on errors, should be ARGV_const_t

◆ rpmInstallSource()

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

Install source rpm package.

Parameters
tstransaction set
argsource rpm file name
Return values
*specFilePtr(installed) spec file name
*cookie
Returns
0 on success

◆ rpmShowProgress()

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
argper-callback private data (e.g. an rpm header)
whatcallback identifier
amountper-callback progress info
totalper-callback progress info
keyopaque header key (e.g. file name or PyObject)
dataprivate data (e.g. rpmInstallInterfaceFlags)
Returns
per-callback data (e.g. an opened FD_t)

◆ showQueryPackage()

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

Display results of package query.

Todo:
Devise a meaningful return code.
Parameters
qvaparsed query/verify options
tstransaction set
hheader to use for query
Returns
0 always

◆ showVerifyPackage()

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

Display results of package verify.

Parameters
qvaparsed query/verify options
tstransaction set
hheader to use for verify
Returns
result of last non-zero verify return

Variable Documentation

◆ rpmcliAllPoptTable

struct poptOption rpmcliAllPoptTable[]

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

◆ rpmcliQueryFlags

rpmQueryFlags rpmcliQueryFlags

Bit(s) from common command line options.

◆ rpmIArgs

struct rpmInstallArguments_s rpmIArgs

◆ rpmInstallPoptTable

struct poptOption rpmInstallPoptTable[]

◆ rpmQueryPoptTable

struct poptOption rpmQueryPoptTable[]

◆ rpmQVKArgs

struct rpmQVKArguments_s rpmQVKArgs

◆ rpmQVSourcePoptTable

struct poptOption rpmQVSourcePoptTable[]

◆ rpmVerifyPoptTable

struct poptOption rpmVerifyPoptTable[]