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
#define RPMCLI_POPT_NOCAPS -1033
#define RPMCLI_POPT_TARGETPLATFORM -1034
/* ==================================================================== */
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,
RPMQV_WHATOBSOLETES,
RPMQV_WHATCONFLICTS,
};
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),
QUERY_FOR_ARTIFACT = (1 << 29),
};
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;
extern rpmVSFlags rpmcliVSFlags;
extern int rpmcliVfyLevelMask;
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 */
rpmcliRcfile
const char * rpmcliRcfile
rpmCallbackType
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
INSTALL_ALLMATCHES
Definition: rpmcli.h:301
RPMQV_WHATENHANCES
Definition: rpmcli.h:101
QUERY_FOR_CONFIG
Definition: rpmcli.h:136
INSTALL_HASH
Definition: rpmcli.h:293
QVA_t
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:159
rpmQVKArguments_s::qva_sourceCount
int qva_sourceCount
Definition: rpmcli.h:186
rpmInstallArguments_s::numRelocations
int numRelocations
Definition: rpmcli.h:355
ARGV_t
char ** ARGV_t
Definition: argv.h:17
rpmInstallArguments_s::incldocs
int incldocs
Definition: rpmcli.h:357
QUERY_FOR_DUMPFILES
Definition: rpmcli.h:137
QUERY_MD5
Definition: rpmcli.h:115
INSTALL_REINSTALL
Definition: rpmcli.h:302
rpmInstallArguments_s::probFilter
rpmprobFilterFlags probFilter
Definition: rpmcli.h:353
QUERY_MODE
Definition: rpmcli.h:122
RPMQV_SPECFILE
Definition: rpmcli.h:93
INSTALL_PERCENT
Definition: rpmcli.h:292
QUERY_FOR_ARTIFACT
Definition: rpmcli.h:139
RPMQV_RPM
Definition: rpmcli.h:86
rpmDisplayQueryTags
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
rpmQVSources
rpmFlags rpmQVSources
Definition: rpmcli.h:107
rpmErase
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
rpmQVKArguments_s::qva_flags
rpmQueryFlags qva_flags
Definition: rpmcli.h:187
QUERY_CONTEXTS
Definition: rpmcli.h:125
rpmQVSources_e
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:82
QUERY_SIGNATURE
Definition: rpmcli.h:130
rpmcliInit
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
QUERY_DEPS
Definition: rpmcli.h:127
INSTALL_NOORDER
Definition: rpmcli.h:295
rpmcliQuery
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
rpmcliVfyLevelMask
int rpmcliVfyLevelMask
rpmInstallArguments_s::relocations
rpmRelocation * relocations
Definition: rpmcli.h:358
RPMQV_TRIGGEREDBY
Definition: rpmcli.h:90
rpmcliVerifySignatures
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
Verify package signatures.
rpmts
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
RPMQV_TID
Definition: rpmcli.h:96
INSTALL_INSTALL
Definition: rpmcli.h:299
INSTALL_LABEL
Definition: rpmcli.h:296
rpmprobFilterFlags
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
rpmQVKArguments_s
Describe query/verify/signature command line operation.
Definition: rpmcli.h:184
rpmQVKArguments_s::qva_specQuery
QSpecF_t qva_specQuery
Definition: rpmcli.h:191
rpmRelocation_s
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:96
rpmQVKArgs
struct rpmQVKArguments_s rpmQVKArgs
showVerifyPackage
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
RPMQV_WHATSUPPLEMENTS
Definition: rpmcli.h:100
rpmQVKArguments_s::qva_showPackage
QVF_t qva_showPackage
Definition: rpmcli.h:190
QUERY_FILEDIGEST
Definition: rpmcli.h:116
rpmcliQueryFlags
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
RPMQV_HDRID
Definition: rpmcli.h:95
rpmInstallPoptTable
struct poptOption rpmInstallPoptTable[]
rpmInstallSource
int rpmInstallSource(rpmts ts, const char *arg, char **specFilePtr, char **cookie)
Install source rpm package.
QUERY_SIZE
Definition: rpmcli.h:117
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpmcliFini
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
rpmcliPipeOutput
const char * rpmcliPipeOutput
rpmQVKArguments_s::qva_mode
char qva_mode
Definition: rpmcli.h:193
showQueryPackage
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
Display results of package query.
rpmQueryPoptTable
struct poptOption rpmQueryPoptTable[]
INSTALL_NONE
Definition: rpmcli.h:291
rpmQueryFlags
rpmFlags rpmQueryFlags
Definition: rpmcli.h:142
FD_t
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:98
QVF_t
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
Definition: rpmcli.h:169
rpmInstallArguments_s::transFlags
rpmtransFlags transFlags
Definition: rpmcli.h:352
QUERY_HDRCHK
Definition: rpmcli.h:132
INSTALL_NODEPS
Definition: rpmcli.h:294
RPMQV_WHATSUGGESTS
Definition: rpmcli.h:99
QUERY_DIGEST
Definition: rpmcli.h:129
rpmQVSourcePoptTable
struct poptOption rpmQVSourcePoptTable[]
rpmQVKArguments_s::qva_source
rpmQVSources qva_source
Definition: rpmcli.h:185
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
QUERY_FOR_LICENSE
Definition: rpmcli.h:138
rpmcliVerify
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
fnpyKey
const void * fnpyKey
Definition: rpmtypes.h:75
RPMQV_GROUP
Definition: rpmcli.h:87
QUERY_SCRIPT
Definition: rpmcli.h:128
QUERY_FOR_DOCS
Definition: rpmcli.h:135
RPMQV_WHATOBSOLETES
Definition: rpmcli.h:103
INSTALL_ERASE
Definition: rpmcli.h:300
rpmQVKArguments_s::qva_fflags
rpmfileAttrs qva_fflags
Definition: rpmcli.h:188
rpmInstallArguments_s::installInterfaceFlags
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:354
QUERY_FOR_DEFAULT
Definition: rpmcli.h:114
QUERY_MTIME
Definition: rpmcli.h:121
rpmVSFlags
rpmFlags rpmVSFlags
Definition: rpmts.h:111
QUERY_PATCHES
Definition: rpmcli.h:131
RPMQV_SPECBUILTRPMS
Definition: rpmcli.h:102
rpmIArgs
struct rpmInstallArguments_s rpmIArgs
rpmInstallArguments_s::noDeps
int noDeps
Definition: rpmcli.h:356
rpmcliVSFlags
rpmVSFlags rpmcliVSFlags
rpmcliRootDir
const char * rpmcliRootDir
QUERY_RDEV
Definition: rpmcli.h:123
QUERY_GROUP
Definition: rpmcli.h:120
rpmcliAllPoptTable
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
rpmQVKArguments_s::qva_queryFormat
char * qva_queryFormat
Definition: rpmcli.h:192
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:18
rpmInstallFlags_e
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:290
rpmQueryFlags_e
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:113
RPMQV_PACKAGE
Definition: rpmcli.h:83
rpmInstallArguments_s
Describe database command line requests.
Definition: rpmcli.h:351
rpmcliConfigured
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
rpmVerifyPoptTable
struct poptOption rpmVerifyPoptTable[]
RPMQV_PATH
Definition: rpmcli.h:84
rpmInstallFlags
rpmFlags rpmInstallFlags
Definition: rpmcli.h:305
rpmInstallArguments_s::prefix
char * prefix
Definition: rpmcli.h:359
QSpecF_t
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:179
RPMQV_SPECRPMS
Definition: rpmcli.h:92
RPMQV_WHATRECOMMENDS
Definition: rpmcli.h:98
RPMQV_PKGID
Definition: rpmcli.h:94
QUERY_FOR_STATE
Definition: rpmcli.h:134
RPMQV_WHATCONFLICTS
Definition: rpmcli.h:104
RPMQV_SPECSRPM
Definition: rpmcli.h:97
rpmfileAttrs
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:66
RPMQV_WHATREQUIRES
Definition: rpmcli.h:89
rpmInstall
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
QUERY_LINKTO
Definition: rpmcli.h:118
RPMQV_WHATPROVIDES
Definition: rpmcli.h:88
INSTALL_UPGRADE
Definition: rpmcli.h:297
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.
QUERY_FILES
Definition: rpmcli.h:126
INSTALL_FRESHEN
Definition: rpmcli.h:298
RPMQV_ALL
Definition: rpmcli.h:85
rpmcliArgIter
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
rpmtransFlags
rpmFlags rpmtransFlags
Definition: rpmts.h:59
QUERY_FOR_LIST
Definition: rpmcli.h:133
QUERY_USER
Definition: rpmcli.h:119
rpmcliImportPubkeys
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv)
Import public key(s) to rpm keyring.
rpm_loff_t
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
RPMQV_DBOFFSET
Definition: rpmcli.h:91
rpmVerifySignatures
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.