rpmcli.h
Go to the documentation of this file.
#ifndef H_RPMCLI
#define H_RPMCLI
#include <popt.h>
#include <rpm/rpmlib.h>
#include <rpm/rpmurl.h>
#include <rpm/rpmmacro.h>
#include <rpm/rpmcallback.h>
#include <rpm/rpmts.h>
#include <rpm/rpmfi.h>
#include <rpm/rpmvf.h>
#include <rpm/argv.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct poptOption rpmcliAllPoptTable[];
extern const char * rpmcliPipeOutput;
extern const char * rpmcliRcfile;
extern const char * rpmcliRootDir;
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
void rpmcliConfigured(void);
poptContext
rpmcliFini(poptContext optCon);
#define RPMCLI_POPT_NODEPS -1025
#define RPMCLI_POPT_FORCE -1026
#define RPMCLI_POPT_NOMD5 -1027
#define RPMCLI_POPT_NOFILEDIGEST -1027 /* same as obsolete RPMCLI_POPT_NOMD5 */
#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
/* ==================================================================== */
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,
};
typedef rpmFlags rpmQVSources;
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),
/* bits 8-14 unused, reserved for rpmVerifyAttrs */
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)
};
typedef rpmFlags rpmQueryFlags;
#define _QUERY_FOR_BITS \
(QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
QUERY_FOR_LICENSE|QUERY_FOR_DUMPFILES)
extern rpmQueryFlags rpmcliQueryFlags;
typedef struct rpmQVKArguments_s * QVA_t;
typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
struct rpmQVKArguments_s {
rpmQVSources qva_source;
int qva_sourceCount;
rpmQueryFlags qva_flags;
rpmfileAttrs qva_fflags;
QVF_t qva_showPackage;
QSpecF_t qva_specQuery;
char * qva_queryFormat;
char qva_mode;
};
extern struct rpmQVKArguments_s rpmQVKArgs;
extern struct poptOption rpmQVSourcePoptTable[];
extern struct poptOption rpmQueryPoptTable[];
extern struct poptOption rpmVerifyPoptTable[];
void rpmDisplayQueryTags(FILE * fp);
int showQueryPackage(QVA_t qva, rpmts ts, Header h);
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
/* ==================================================================== */
/* --- install/upgrade/erase modes */
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),
};
typedef rpmFlags rpmInstallFlags;
#define UNINSTALL_NONE INSTALL_NONE
#define UNINSTALL_NODEPS INSTALL_NODEPS
#define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const rpm_loff_t amount,
const rpm_loff_t total,
fnpyKey key,
void * data);
int rpmInstallSource(rpmts ts, const char * arg,
char ** specFilePtr,
char ** cookie);
struct rpmInstallArguments_s {
rpmtransFlags transFlags;
rpmprobFilterFlags probFilter;
rpmInstallFlags installInterfaceFlags;
int numRelocations;
int noDeps;
int incldocs;
rpmRelocation * relocations;
char * prefix;
};
int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
extern struct rpmInstallArguments_s rpmIArgs;
extern struct poptOption rpmInstallPoptTable[];
/* ==================================================================== */
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv);
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv);
#ifdef __cplusplus
}
#endif
#endif /* H_RPMCLI */
rpmQVSources_e
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:78
RPMQV_GROUP
Definition: rpmcli.h:83
QUERY_MD5
Definition: rpmcli.h:108
rpmcliRcfile
const char * rpmcliRcfile
rpmCallbackType
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
RPMQV_DBOFFSET
Definition: rpmcli.h:87
RPMQV_WHATSUGGESTS
Definition: rpmcli.h:95
rpmInstall
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
rpmcliQueryFlags
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
RPMQV_SPECRPMS
Definition: rpmcli.h:88
QUERY_FILEDIGEST
Definition: rpmcli.h:109
rpmQVKArguments_s::qva_sourceCount
int qva_sourceCount
Definition: rpmcli.h:174
rpmInstallArguments_s::numRelocations
int numRelocations
Definition: rpmcli.h:343
rpmcliArgIter
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
ARGV_t
char ** ARGV_t
Definition: argv.h:15
rpmInstallArguments_s::incldocs
int incldocs
Definition: rpmcli.h:345
INSTALL_NOORDER
Definition: rpmcli.h:283
FD_t
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:98
QUERY_FOR_DUMPFILES
Definition: rpmcli.h:130
rpmInstallArguments_s::probFilter
rpmprobFilterFlags probFilter
Definition: rpmcli.h:341
QUERY_FILES
Definition: rpmcli.h:119
QUERY_MODE
Definition: rpmcli.h:115
INSTALL_UPGRADE
Definition: rpmcli.h:285
rpmcliQuery
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
rpmQVSources
rpmFlags rpmQVSources
Definition: rpmcli.h:100
rpmQVKArguments_s::qva_flags
rpmQueryFlags qva_flags
Definition: rpmcli.h:175
INSTALL_ALLMATCHES
Definition: rpmcli.h:289
rpmInstallFlags_e
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:278
rpmInstallPoptTable
struct poptOption rpmInstallPoptTable[]
rpmcliInit
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
rpmcliFini
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
RPMQV_SPECFILE
Definition: rpmcli.h:89
rpmInstallArguments_s::relocations
rpmRelocation * relocations
Definition: rpmcli.h:346
rpmQVKArgs
struct rpmQVKArguments_s rpmQVKArgs
showQueryPackage
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
Display results of package query.
rpmVerifyPoptTable
struct poptOption rpmVerifyPoptTable[]
rpmcliVerify
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
rpmInstallFlags
rpmFlags rpmInstallFlags
Definition: rpmcli.h:293
INSTALL_REINSTALL
Definition: rpmcli.h:290
QUERY_HDRCHK
Definition: rpmcli.h:125
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.
rpmprobFilterFlags
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:34
rpmQVKArguments_s
Describe query/verify/signature command line operation.
Definition: rpmcli.h:172
rpmQVKArguments_s::qva_specQuery
QSpecF_t qva_specQuery
Definition: rpmcli.h:179
rpmRelocation_s
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:94
rpmQueryPoptTable
struct poptOption rpmQueryPoptTable[]
INSTALL_HASH
Definition: rpmcli.h:281
rpmErase
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
rpmQVKArguments_s::qva_showPackage
QVF_t qva_showPackage
Definition: rpmcli.h:178
RPMQV_WHATRECOMMENDS
Definition: rpmcli.h:94
RPMQV_RPM
Definition: rpmcli.h:82
rpmcliConfigured
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
QVF_t
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
Definition: rpmcli.h:157
rpmcliPipeOutput
const char * rpmcliPipeOutput
rpmQVKArguments_s::qva_mode
char qva_mode
Definition: rpmcli.h:181
QUERY_SIGNATURE
Definition: rpmcli.h:123
INSTALL_FRESHEN
Definition: rpmcli.h:286
rpmQueryFlags
rpmFlags rpmQueryFlags
Definition: rpmcli.h:134
QUERY_FOR_DEFAULT
Definition: rpmcli.h:107
QUERY_CONTEXTS
Definition: rpmcli.h:118
QUERY_FOR_DOCS
Definition: rpmcli.h:128
rpmInstallArguments_s::transFlags
rpmtransFlags transFlags
Definition: rpmcli.h:340
INSTALL_NONE
Definition: rpmcli.h:279
RPMQV_PKGID
Definition: rpmcli.h:90
RPMQV_PATH
Definition: rpmcli.h:80
rpm_loff_t
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
RPMQV_HDRID
Definition: rpmcli.h:91
QSpecF_t
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:167
QUERY_FOR_LICENSE
Definition: rpmcli.h:131
QUERY_LINKTO
Definition: rpmcli.h:111
rpmQVKArguments_s::qva_source
rpmQVSources qva_source
Definition: rpmcli.h:173
rpmInstallSource
int rpmInstallSource(rpmts ts, const char *arg, char **specFilePtr, char **cookie)
Install source rpm package.
INSTALL_PERCENT
Definition: rpmcli.h:280
RPMQV_WHATSUPPLEMENTS
Definition: rpmcli.h:96
rpmQVKArguments_s::qva_fflags
rpmfileAttrs qva_fflags
Definition: rpmcli.h:176
INSTALL_LABEL
Definition: rpmcli.h:284
optionsTable
static struct poptOption optionsTable[]
Definition: rpmbuild.c:260
QUERY_USER
Definition: rpmcli.h:112
RPMQV_WHATREQUIRES
Definition: rpmcli.h:85
rpmInstallArguments_s::installInterfaceFlags
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:342
QUERY_PATCHES
Definition: rpmcli.h:124
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
QUERY_DEPS
Definition: rpmcli.h:120
QUERY_SCRIPT
Definition: rpmcli.h:121
RPMQV_TRIGGEREDBY
Definition: rpmcli.h:86
rpmInstallArguments_s::noDeps
int noDeps
Definition: rpmcli.h:344
rpmcliRootDir
const char * rpmcliRootDir
showVerifyPackage
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
QUERY_MTIME
Definition: rpmcli.h:114
rpmDisplayQueryTags
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
RPMQV_PACKAGE
Definition: rpmcli.h:79
rpmQVKArguments_s::qva_queryFormat
char * qva_queryFormat
Definition: rpmcli.h:180
QUERY_SIZE
Definition: rpmcli.h:110
INSTALL_ERASE
Definition: rpmcli.h:288
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:16
QUERY_FOR_LIST
Definition: rpmcli.h:126
INSTALL_NODEPS
Definition: rpmcli.h:282
rpmts
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
QVA_t
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:147
RPMQV_TID
Definition: rpmcli.h:92
rpmInstallArguments_s
Describe database command line requests.
Definition: rpmcli.h:339
RPMQV_WHATPROVIDES
Definition: rpmcli.h:84
QUERY_DIGEST
Definition: rpmcli.h:122
QUERY_GROUP
Definition: rpmcli.h:113
rpmInstallArguments_s::prefix
char * prefix
Definition: rpmcli.h:347
rpmfileAttrs
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
rpmIArgs
struct rpmInstallArguments_s rpmIArgs
rpmcliVerifySignatures
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
Verify package signatures.
rpmQVSourcePoptTable
struct poptOption rpmQVSourcePoptTable[]
QUERY_FOR_STATE
Definition: rpmcli.h:127
fnpyKey
const void * fnpyKey
Definition: rpmtypes.h:75
QUERY_FOR_CONFIG
Definition: rpmcli.h:129
rpmtransFlags
rpmFlags rpmtransFlags
Definition: rpmts.h:58
rpmcliImportPubkeys
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv)
Import public key(s) to rpm keyring.
INSTALL_INSTALL
Definition: rpmcli.h:287
RPMQV_ALL
Definition: rpmcli.h:81
rpmcliAllPoptTable
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
RPMQV_SPECSRPM
Definition: rpmcli.h:93
RPMQV_WHATENHANCES
Definition: rpmcli.h:97
rpmQueryFlags_e
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:106
QUERY_RDEV
Definition: rpmcli.h:116
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmVerifySignatures
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.