rpm: rpmcli.h Source File

rpm 4.13.0

rpmcli.h
Go to the documentation of this file.
1 #ifndef H_RPMCLI
2 #define H_RPMCLI
3
8 #include <popt.h>
9
10 #include <rpm/rpmlib.h>
11 #include <rpm/rpmurl.h>
12 #include <rpm/rpmmacro.h>
13 #include <rpm/rpmcallback.h>
14 #include <rpm/rpmts.h>
15 #include <rpm/rpmfi.h>
16 #include <rpm/rpmvf.h>
17 #include <rpm/argv.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
26 extern struct poptOption rpmcliAllPoptTable[];
27
28 extern const char * rpmcliPipeOutput;
29
30 extern const char * rpmcliRcfile;
31
32 extern const char * rpmcliRootDir;
33
41 poptContext
42 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
43
48 void rpmcliConfigured(void);
49
55 poptContext
56 rpmcliFini(poptContext optCon);
57
61 #define RPMCLI_POPT_NODEPS -1025
62 #define RPMCLI_POPT_FORCE -1026
63 #define RPMCLI_POPT_NOMD5 -1027
64 #define RPMCLI_POPT_NOFILEDIGEST -1027 /* same as obsolete RPMCLI_POPT_NOMD5 */
65 #define RPMCLI_POPT_NOSCRIPTS -1028
66 #define RPMCLI_POPT_NOSIGNATURE -1029
67 #define RPMCLI_POPT_NODIGEST -1030
68 #define RPMCLI_POPT_NOHDRCHK -1031
69 #define RPMCLI_POPT_NOCONTEXTS -1032
70
71 /* ==================================================================== */
78 enum rpmQVSources_e {
79 RPMQV_PACKAGE = 0,
80 RPMQV_PATH,
81 RPMQV_ALL,
82 RPMQV_RPM,
83 RPMQV_GROUP,
84 RPMQV_WHATPROVIDES,
85 RPMQV_WHATREQUIRES,
86 RPMQV_TRIGGEREDBY,
87 RPMQV_DBOFFSET,
88 RPMQV_SPECRPMS,
89 RPMQV_SPECFILE = RPMQV_SPECRPMS,
90 RPMQV_PKGID,
91 RPMQV_HDRID,
92 RPMQV_TID,
93 RPMQV_SPECSRPM,
94 RPMQV_WHATRECOMMENDS,
95 RPMQV_WHATSUGGESTS,
96 RPMQV_WHATSUPPLEMENTS,
97 RPMQV_WHATENHANCES,
98 };
99
100 typedef rpmFlags rpmQVSources;
101
106 enum rpmQueryFlags_e {
107 QUERY_FOR_DEFAULT = 0,
108 QUERY_MD5 = (1 << 0),
109 QUERY_FILEDIGEST = (1 << 0),
110 QUERY_SIZE = (1 << 1),
111 QUERY_LINKTO = (1 << 2),
112 QUERY_USER = (1 << 3),
113 QUERY_GROUP = (1 << 4),
114 QUERY_MTIME = (1 << 5),
115 QUERY_MODE = (1 << 6),
116 QUERY_RDEV = (1 << 7),
117 /* bits 8-14 unused, reserved for rpmVerifyAttrs */
118 QUERY_CONTEXTS = (1 << 15),
119 QUERY_FILES = (1 << 16),
120 QUERY_DEPS = (1 << 17),
121 QUERY_SCRIPT = (1 << 18),
122 QUERY_DIGEST = (1 << 19),
123 QUERY_SIGNATURE = (1 << 20),
124 QUERY_PATCHES = (1 << 21),
125 QUERY_HDRCHK = (1 << 22),
126 QUERY_FOR_LIST = (1 << 23),
127 QUERY_FOR_STATE = (1 << 24),
128 QUERY_FOR_DOCS = (1 << 25),
129 QUERY_FOR_CONFIG = (1 << 26),
130 QUERY_FOR_DUMPFILES = (1 << 27),
131 QUERY_FOR_LICENSE = (1 << 28)
132 };
133
134 typedef rpmFlags rpmQueryFlags;
135
136 #define _QUERY_FOR_BITS \
137 (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
138 QUERY_FOR_LICENSE|QUERY_FOR_DUMPFILES)
139
143 extern rpmQueryFlags rpmcliQueryFlags;
144
147 typedef struct rpmQVKArguments_s * QVA_t;
148
157 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
158
167 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
168
172 struct rpmQVKArguments_s {
173 rpmQVSources qva_source;
174 int qva_sourceCount;
175 rpmQueryFlags qva_flags;
176 rpmfileAttrs qva_fflags;
178 QVF_t qva_showPackage;
179 QSpecF_t qva_specQuery;
180 char * qva_queryFormat;
181 char qva_mode;
189 };
190
193 extern struct rpmQVKArguments_s rpmQVKArgs;
194
197 extern struct poptOption rpmQVSourcePoptTable[];
198
201 extern struct poptOption rpmQueryPoptTable[];
202
205 extern struct poptOption rpmVerifyPoptTable[];
206
211 void rpmDisplayQueryTags(FILE * fp);
212
221 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
222
230 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
231
240 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
241
249 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
250
259 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
260
269 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
270
271 /* ==================================================================== */
273 /* --- install/upgrade/erase modes */
274
278 enum rpmInstallFlags_e {
279 INSTALL_NONE = 0,
280 INSTALL_PERCENT = (1 << 0),
281 INSTALL_HASH = (1 << 1),
282 INSTALL_NODEPS = (1 << 2),
283 INSTALL_NOORDER = (1 << 3),
284 INSTALL_LABEL = (1 << 4),
285 INSTALL_UPGRADE = (1 << 5),
286 INSTALL_FRESHEN = (1 << 6),
287 INSTALL_INSTALL = (1 << 7),
288 INSTALL_ERASE = (1 << 8),
289 INSTALL_ALLMATCHES = (1 << 9),
290 INSTALL_REINSTALL = (1 << 10),
291 };
292
293 typedef rpmFlags rpmInstallFlags;
294
298 #define UNINSTALL_NONE INSTALL_NONE
299 #define UNINSTALL_NODEPS INSTALL_NODEPS
300 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
301
316 void * rpmShowProgress(const void * arg,
317 const rpmCallbackType what,
318 const rpm_loff_t amount,
319 const rpm_loff_t total,
320 fnpyKey key,
321 void * data);
322
331 int rpmInstallSource(rpmts ts, const char * arg,
332 char ** specFilePtr,
333 char ** cookie);
334
335
339 struct rpmInstallArguments_s {
340 rpmtransFlags transFlags;
341 rpmprobFilterFlags probFilter;
342 rpmInstallFlags installInterfaceFlags;
343 int numRelocations;
344 int noDeps;
345 int incldocs;
346 rpmRelocation * relocations;
347 char * prefix;
348 };
349
359 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
360
369 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
370
373 extern struct rpmInstallArguments_s rpmIArgs;
374
377 extern struct poptOption rpmInstallPoptTable[];
378
379 /* ==================================================================== */
387 int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv);
388
395 int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv);
396
397 #ifdef __cplusplus
398 }
399 #endif
400
401 #endif /* H_RPMCLI */
rpmcliRcfile
const char * rpmcliRcfile
rpmCallbackType
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
INSTALL_ALLMATCHES
Definition: rpmcli.h:289
RPMQV_WHATENHANCES
Definition: rpmcli.h:97
QUERY_FOR_CONFIG
Definition: rpmcli.h:129
INSTALL_HASH
Definition: rpmcli.h:281
QVA_t
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:147
rpmQVKArguments_s::qva_sourceCount
int qva_sourceCount
Definition: rpmcli.h:174
rpmInstallArguments_s::numRelocations
int numRelocations
Definition: rpmcli.h:343
ARGV_t
char ** ARGV_t
Definition: argv.h:15
rpmInstallArguments_s::incldocs
int incldocs
Definition: rpmcli.h:345
QUERY_FOR_DUMPFILES
Definition: rpmcli.h:130
QUERY_MD5
Definition: rpmcli.h:108
INSTALL_REINSTALL
Definition: rpmcli.h:290
rpmInstallArguments_s::probFilter
rpmprobFilterFlags probFilter
Definition: rpmcli.h:341
QUERY_MODE
Definition: rpmcli.h:115
RPMQV_SPECFILE
Definition: rpmcli.h:89
INSTALL_PERCENT
Definition: rpmcli.h:280
RPMQV_RPM
Definition: rpmcli.h:82
rpmDisplayQueryTags
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
rpmQVSources
rpmFlags rpmQVSources
Definition: rpmcli.h:100
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:175
QUERY_CONTEXTS
Definition: rpmcli.h:118
rpmQVSources_e
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:78
QUERY_SIGNATURE
Definition: rpmcli.h:123
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:120
INSTALL_NOORDER
Definition: rpmcli.h:283
rpmcliQuery
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
rpmInstallArguments_s::relocations
rpmRelocation * relocations
Definition: rpmcli.h:346
RPMQV_TRIGGEREDBY
Definition: rpmcli.h:86
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:92
INSTALL_INSTALL
Definition: rpmcli.h:287
INSTALL_LABEL
Definition: rpmcli.h:284
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
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:96
rpmQVKArguments_s::qva_showPackage
QVF_t qva_showPackage
Definition: rpmcli.h:178
QUERY_FILEDIGEST
Definition: rpmcli.h:109
rpmcliQueryFlags
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
RPMQV_HDRID
Definition: rpmcli.h:91
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:110
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:181
showQueryPackage
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
Display results of package query.
rpmQueryPoptTable
struct poptOption rpmQueryPoptTable[]
INSTALL_NONE
Definition: rpmcli.h:279
rpmQueryFlags
rpmFlags rpmQueryFlags
Definition: rpmcli.h:134
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:157
rpmInstallArguments_s::transFlags
rpmtransFlags transFlags
Definition: rpmcli.h:340
QUERY_HDRCHK
Definition: rpmcli.h:125
INSTALL_NODEPS
Definition: rpmcli.h:282
RPMQV_WHATSUGGESTS
Definition: rpmcli.h:95
QUERY_DIGEST
Definition: rpmcli.h:122
rpmQVSourcePoptTable
struct poptOption rpmQVSourcePoptTable[]
rpmQVKArguments_s::qva_source
rpmQVSources qva_source
Definition: rpmcli.h:173
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
QUERY_FOR_LICENSE
Definition: rpmcli.h:131
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:83
QUERY_SCRIPT
Definition: rpmcli.h:121
QUERY_FOR_DOCS
Definition: rpmcli.h:128
INSTALL_ERASE
Definition: rpmcli.h:288
rpmQVKArguments_s::qva_fflags
rpmfileAttrs qva_fflags
Definition: rpmcli.h:176
rpmInstallArguments_s::installInterfaceFlags
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:342
QUERY_FOR_DEFAULT
Definition: rpmcli.h:107
QUERY_MTIME
Definition: rpmcli.h:114
QUERY_PATCHES
Definition: rpmcli.h:124
rpmIArgs
struct rpmInstallArguments_s rpmIArgs
rpmInstallArguments_s::noDeps
int noDeps
Definition: rpmcli.h:344
rpmcliRootDir
const char * rpmcliRootDir
QUERY_RDEV
Definition: rpmcli.h:116
QUERY_GROUP
Definition: rpmcli.h:113
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:180
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:16
rpmInstallFlags_e
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:278
rpmQueryFlags_e
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:106
RPMQV_PACKAGE
Definition: rpmcli.h:79
rpmInstallArguments_s
Describe database command line requests.
Definition: rpmcli.h:339
rpmcliConfigured
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
rpmVerifyPoptTable
struct poptOption rpmVerifyPoptTable[]
RPMQV_PATH
Definition: rpmcli.h:80
rpmInstallFlags
rpmFlags rpmInstallFlags
Definition: rpmcli.h:293
rpmInstallArguments_s::prefix
char * prefix
Definition: rpmcli.h:347
QSpecF_t
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:167
RPMQV_SPECRPMS
Definition: rpmcli.h:88
RPMQV_WHATRECOMMENDS
Definition: rpmcli.h:94
RPMQV_PKGID
Definition: rpmcli.h:90
QUERY_FOR_STATE
Definition: rpmcli.h:127
RPMQV_SPECSRPM
Definition: rpmcli.h:93
rpmfileAttrs
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
RPMQV_WHATREQUIRES
Definition: rpmcli.h:85
rpmInstall
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
QUERY_LINKTO
Definition: rpmcli.h:111
RPMQV_WHATPROVIDES
Definition: rpmcli.h:84
INSTALL_UPGRADE
Definition: rpmcli.h:285
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:119
INSTALL_FRESHEN
Definition: rpmcli.h:286
RPMQV_ALL
Definition: rpmcli.h:81
rpmcliArgIter
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
rpmtransFlags
rpmFlags rpmtransFlags
Definition: rpmts.h:58
QUERY_FOR_LIST
Definition: rpmcli.h:126
QUERY_USER
Definition: rpmcli.h:112
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:87
rpmVerifySignatures
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.