rpm 4.15.1

rpmcli.h
Go to the documentation of this file.
1 #ifndef H_RPMCLI
2 #define H_RPMCLI
3
10 #include <popt.h>
11
12 #include <rpm/rpmlib.h>
13 #include <rpm/rpmurl.h>
14 #include <rpm/rpmmacro.h>
15 #include <rpm/rpmcallback.h>
16 #include <rpm/rpmts.h>
17 #include <rpm/rpmfi.h>
18 #include <rpm/argv.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
27 extern struct poptOption rpmcliAllPoptTable[];
28
29 extern const char * rpmcliPipeOutput;
30
31 extern const char * rpmcliRcfile;
32
33 extern const char * rpmcliRootDir;
34
42 poptContext
43 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
44
49 void rpmcliConfigured(void);
50
56 poptContext
57 rpmcliFini(poptContext optCon);
58
62 #define RPMCLI_POPT_NODEPS -1025
63 #define RPMCLI_POPT_FORCE -1026
64 #define RPMCLI_POPT_NOMD5 -1027
65 #define RPMCLI_POPT_NOFILEDIGEST -1027 /* same as obsolete RPMCLI_POPT_NOMD5 */
66 #define RPMCLI_POPT_NOSCRIPTS -1028
67 #define RPMCLI_POPT_NOSIGNATURE -1029
68 #define RPMCLI_POPT_NODIGEST -1030
69 #define RPMCLI_POPT_NOHDRCHK -1031
70 #define RPMCLI_POPT_NOCONTEXTS -1032
71 #define RPMCLI_POPT_NOCAPS -1033
72 #define RPMCLI_POPT_TARGETPLATFORM -1034
73
74 /* ==================================================================== */
81 enum rpmQVSources_e {
82 RPMQV_PACKAGE = 0,
83 RPMQV_PATH,
84 RPMQV_ALL,
85 RPMQV_RPM,
86 RPMQV_GROUP,
87 RPMQV_WHATPROVIDES,
88 RPMQV_WHATREQUIRES,
89 RPMQV_TRIGGEREDBY,
90 RPMQV_DBOFFSET,
91 RPMQV_SPECRPMS,
92 RPMQV_SPECFILE = RPMQV_SPECRPMS,
93 RPMQV_PKGID,
94 RPMQV_HDRID,
95 RPMQV_TID,
96 RPMQV_SPECSRPM,
97 RPMQV_WHATRECOMMENDS,
98 RPMQV_WHATSUGGESTS,
99 RPMQV_WHATSUPPLEMENTS,
100 RPMQV_WHATENHANCES,
101 RPMQV_SPECBUILTRPMS,
102 RPMQV_WHATOBSOLETES,
103 RPMQV_WHATCONFLICTS,
104 };
105
106 typedef rpmFlags rpmQVSources;
107
112 enum rpmQueryFlags_e {
113 QUERY_FOR_DEFAULT = 0,
114 /* bits 0-14 unused */
115 /* bits 15-18 reserved for rpmVerifyFlags */
116 /* bits 19-21 unused */
117 QUERY_FOR_LIST = (1 << 23),
118 QUERY_FOR_STATE = (1 << 24),
119 /* bits 25-26 unused */
120 QUERY_FOR_DUMPFILES = (1 << 27),
121 };
122
123 typedef rpmFlags rpmQueryFlags;
124
125 #define _QUERY_FOR_BITS \
126 (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DUMPFILES)
127
131 extern rpmQueryFlags rpmcliQueryFlags;
132
133 extern rpmVSFlags rpmcliVSFlags;
134
135 extern int rpmcliVfyLevelMask;
136
139 typedef struct rpmQVKArguments_s * QVA_t;
140
149 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
150
159 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
160
164 struct rpmQVKArguments_s {
165 rpmQVSources qva_source;
166 int qva_sourceCount;
167 rpmQueryFlags qva_flags;
168 rpmfileAttrs qva_incattr;
169 rpmfileAttrs qva_excattr;
171 rpmVerifyAttrs qva_ofvattr;
173 QVF_t qva_showPackage;
174 QSpecF_t qva_specQuery;
175 char * qva_queryFormat;
176 char qva_mode;
184 };
185
188 extern struct rpmQVKArguments_s rpmQVKArgs;
189
192 extern struct poptOption rpmQVSourcePoptTable[];
193
196 extern struct poptOption rpmQVFilePoptTable[];
197
200 extern struct poptOption rpmQueryPoptTable[];
201
204 extern struct poptOption rpmVerifyPoptTable[];
205
210 void rpmDisplayQueryTags(FILE * fp);
211
220 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
221
229 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
230
239 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
240
248 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
249
258 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
259
263 enum rpmVerifyFlags_e {
264 VERIFY_DEFAULT = 0,
265 /* bits 1-14 unused */
266 VERIFY_CONTEXTS = (1 << 15),
267 VERIFY_FILES = (1 << 16),
268 VERIFY_DEPS = (1 << 17),
269 VERIFY_SCRIPT = (1 << 18),
270 };
271
272 typedef rpmFlags rpmVerifyFlags;
273
274 #define VERIFY_ALL \
275 ( VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT )
276
285 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
286
287 /* ==================================================================== */
289 /* --- install/upgrade/erase modes */
290
294 enum rpmInstallFlags_e {
295 INSTALL_NONE = 0,
296 INSTALL_PERCENT = (1 << 0),
297 INSTALL_HASH = (1 << 1),
298 INSTALL_NODEPS = (1 << 2),
299 INSTALL_NOORDER = (1 << 3),
300 INSTALL_LABEL = (1 << 4),
301 INSTALL_UPGRADE = (1 << 5),
302 INSTALL_FRESHEN = (1 << 6),
303 INSTALL_INSTALL = (1 << 7),
304 INSTALL_ERASE = (1 << 8),
305 INSTALL_ALLMATCHES = (1 << 9),
306 INSTALL_REINSTALL = (1 << 10),
307 };
308
309 typedef rpmFlags rpmInstallFlags;
310
314 #define UNINSTALL_NONE INSTALL_NONE
315 #define UNINSTALL_NODEPS INSTALL_NODEPS
316 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
317
332 void * rpmShowProgress(const void * arg,
333 const rpmCallbackType what,
334 const rpm_loff_t amount,
335 const rpm_loff_t total,
336 fnpyKey key,
337 void * data);
338
347 int rpmInstallSource(rpmts ts, const char * arg,
348 char ** specFilePtr,
349 char ** cookie);
350
351
355 struct rpmInstallArguments_s {
356 rpmtransFlags transFlags;
357 rpmprobFilterFlags probFilter;
358 rpmInstallFlags installInterfaceFlags;
359 int numRelocations;
360 int noDeps;
361 int incldocs;
362 rpmRelocation * relocations;
363 char * prefix;
364 };
365
375 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
376
385 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
386
389 extern struct rpmInstallArguments_s rpmIArgs;
390
393 extern struct poptOption rpmInstallPoptTable[];
394
395 /* ==================================================================== */
403 int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv);
404
411 int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv);
412
413 #ifdef __cplusplus
414 }
415 #endif
416
417 #endif /* H_RPMCLI */
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpmVerifyPoptTable
struct poptOption rpmVerifyPoptTable[]
rpmts
struct rpmts_s * rpmts
Definition: rpmtypes.h:63
RPMQV_RPM
@ RPMQV_RPM
Definition: rpmcli.h:85
rpmcliQuery
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
rpmQVSources
rpmFlags rpmQVSources
Definition: rpmcli.h:106
rpmQVSources_e
rpmQVSources_e
Definition: rpmcli.h:81
QSpecF_t
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Definition: rpmcli.h:159
rpmInstallFlags_e
rpmInstallFlags_e
Definition: rpmcli.h:294
RPMQV_WHATCONFLICTS
@ RPMQV_WHATCONFLICTS
Definition: rpmcli.h:103
rpmInstallArguments_s::probFilter
rpmprobFilterFlags probFilter
Definition: rpmcli.h:357
RPMQV_PATH
@ RPMQV_PATH
Definition: rpmcli.h:83
rpmInstallArguments_s::numRelocations
int numRelocations
Definition: rpmcli.h:359
rpmInstallPoptTable
struct poptOption rpmInstallPoptTable[]
RPMQV_SPECSRPM
@ RPMQV_SPECSRPM
Definition: rpmcli.h:96
rpmcliArgIter
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
RPMQV_ALL
@ RPMQV_ALL
Definition: rpmcli.h:84
rpmcliVSFlags
rpmVSFlags rpmcliVSFlags
RPMQV_GROUP
@ RPMQV_GROUP
Definition: rpmcli.h:86
rpmQVKArguments_s::qva_queryFormat
char * qva_queryFormat
Definition: rpmcli.h:175
QUERY_FOR_DEFAULT
@ QUERY_FOR_DEFAULT
Definition: rpmcli.h:113
rpmcliImportPubkeys
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv)
Import public key(s) to rpm keyring.
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:18
VERIFY_FILES
@ VERIFY_FILES
Definition: rpmcli.h:267
RPMQV_SPECFILE
@ RPMQV_SPECFILE
Definition: rpmcli.h:92
INSTALL_PERCENT
@ INSTALL_PERCENT
Definition: rpmcli.h:296
rpmVerifyFlags_e
rpmVerifyFlags_e
Definition: rpmcli.h:263
RPMQV_SPECRPMS
@ RPMQV_SPECRPMS
Definition: rpmcli.h:91
rpmErase
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
QUERY_FOR_STATE
@ QUERY_FOR_STATE
Definition: rpmcli.h:118
QUERY_FOR_DUMPFILES
@ QUERY_FOR_DUMPFILES
Definition: rpmcli.h:120
rpmInstallArguments_s::relocations
rpmRelocation * relocations
Definition: rpmcli.h:362
rpmcliQueryFlags
rpmQueryFlags rpmcliQueryFlags
rpmQVKArguments_s::qva_ofvattr
rpmVerifyAttrs qva_ofvattr
Definition: rpmcli.h:171
rpmcliPipeOutput
const char * rpmcliPipeOutput
INSTALL_HASH
@ INSTALL_HASH
Definition: rpmcli.h:297
rpmInstallSource
int rpmInstallSource(rpmts ts, const char *arg, char **specFilePtr, char **cookie)
RPMQV_TID
@ RPMQV_TID
Definition: rpmcli.h:95
rpmprobFilterFlags
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
rpmQVKArguments_s::qva_sourceCount
int qva_sourceCount
Definition: rpmcli.h:166
RPMQV_WHATOBSOLETES
@ RPMQV_WHATOBSOLETES
Definition: rpmcli.h:102
VERIFY_DEPS
@ VERIFY_DEPS
Definition: rpmcli.h:268
rpmtransFlags
rpmFlags rpmtransFlags
Definition: rpmts.h:59
rpmVerifyAttrs
rpmFlags rpmVerifyAttrs
Definition: rpmfiles.h:95
rpmcliInit
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
showVerifyPackage
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
rpmcliConfigured
void rpmcliConfigured(void)
RPMQV_WHATREQUIRES
@ RPMQV_WHATREQUIRES
Definition: rpmcli.h:88
rpmInstallArguments_s
Definition: rpmcli.h:355
rpmQVKArguments_s
Definition: rpmcli.h:164
INSTALL_REINSTALL
@ INSTALL_REINSTALL
Definition: rpmcli.h:306
ARGV_t
char ** ARGV_t
Definition: argv.h:17
rpmInstallArguments_s::transFlags
rpmtransFlags transFlags
Definition: rpmcli.h:356
INSTALL_ALLMATCHES
@ INSTALL_ALLMATCHES
Definition: rpmcli.h:305
rpmQVKArguments_s::qva_source
rpmQVSources qva_source
Definition: rpmcli.h:165
rpmDisplayQueryTags
void rpmDisplayQueryTags(FILE *fp)
rpmcliRootDir
const char * rpmcliRootDir
rpmQueryFlags_e
rpmQueryFlags_e
Definition: rpmcli.h:112
rpmIArgs
struct rpmInstallArguments_s rpmIArgs
RPMQV_WHATSUGGESTS
@ RPMQV_WHATSUGGESTS
Definition: rpmcli.h:98
showQueryPackage
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
rpmQVKArguments_s::qva_showPackage
QVF_t qva_showPackage
Definition: rpmcli.h:173
INSTALL_NOORDER
@ INSTALL_NOORDER
Definition: rpmcli.h:299
rpmInstallArguments_s::installInterfaceFlags
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:358
VERIFY_SCRIPT
@ VERIFY_SCRIPT
Definition: rpmcli.h:269
rpmCallbackType
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmQueryPoptTable
struct poptOption rpmQueryPoptTable[]
rpmInstallFlags
rpmFlags rpmInstallFlags
Definition: rpmcli.h:309
rpmQVSourcePoptTable
struct poptOption rpmQVSourcePoptTable[]
QVA_t
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:139
RPMQV_WHATRECOMMENDS
@ RPMQV_WHATRECOMMENDS
Definition: rpmcli.h:97
RPMQV_WHATPROVIDES
@ RPMQV_WHATPROVIDES
Definition: rpmcli.h:87
rpmcliAllPoptTable
struct poptOption rpmcliAllPoptTable[]
rpmInstallArguments_s::noDeps
int noDeps
Definition: rpmcli.h:360
RPMQV_TRIGGEREDBY
@ RPMQV_TRIGGEREDBY
Definition: rpmcli.h:89
RPMQV_HDRID
@ RPMQV_HDRID
Definition: rpmcli.h:94
rpmInstall
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
QVF_t
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Definition: rpmcli.h:149
QUERY_FOR_LIST
@ QUERY_FOR_LIST
Definition: rpmcli.h:117
rpm_loff_t
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
VERIFY_DEFAULT
@ VERIFY_DEFAULT
Definition: rpmcli.h:264
RPMQV_WHATSUPPLEMENTS
@ RPMQV_WHATSUPPLEMENTS
Definition: rpmcli.h:99
INSTALL_NODEPS
@ INSTALL_NODEPS
Definition: rpmcli.h:298
rpmRelocation_s
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:127
INSTALL_INSTALL
@ INSTALL_INSTALL
Definition: rpmcli.h:303
rpmcliVfyLevelMask
int rpmcliVfyLevelMask
rpmQVKArguments_s::qva_flags
rpmQueryFlags qva_flags
Definition: rpmcli.h:167
RPMQV_PKGID
@ RPMQV_PKGID
Definition: rpmcli.h:93
FD_t
struct _FD_s * FD_t
Definition: rpmtypes.h:98
rpmQVKArgs
struct rpmQVKArguments_s rpmQVKArgs
rpmQVKArguments_s::qva_incattr
rpmfileAttrs qva_incattr
Definition: rpmcli.h:168
INSTALL_FRESHEN
@ INSTALL_FRESHEN
Definition: rpmcli.h:302
rpmVerifyFlags
rpmFlags rpmVerifyFlags
Definition: rpmcli.h:272
rpmQVKArguments_s::qva_mode
char qva_mode
Definition: rpmcli.h:176
rpmQVKArguments_s::qva_excattr
rpmfileAttrs qva_excattr
Definition: rpmcli.h:169
rpmInstallArguments_s::prefix
char * prefix
Definition: rpmcli.h:363
rpmShowProgress
void * rpmShowProgress(const void *arg, const rpmCallbackType what, const rpm_loff_t amount, const rpm_loff_t total, fnpyKey key, void *data)
RPMQV_SPECBUILTRPMS
@ RPMQV_SPECBUILTRPMS
Definition: rpmcli.h:101
INSTALL_UPGRADE
@ INSTALL_UPGRADE
Definition: rpmcli.h:301
rpmcliVerify
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
RPMQV_DBOFFSET
@ RPMQV_DBOFFSET
Definition: rpmcli.h:90
INSTALL_LABEL
@ INSTALL_LABEL
Definition: rpmcli.h:300
INSTALL_ERASE
@ INSTALL_ERASE
Definition: rpmcli.h:304
RPMQV_WHATENHANCES
@ RPMQV_WHATENHANCES
Definition: rpmcli.h:100
RPMQV_PACKAGE
@ RPMQV_PACKAGE
Definition: rpmcli.h:82
rpmVSFlags
rpmFlags rpmVSFlags
Definition: rpmts.h:111
Header
struct headerToken_s * Header
Definition: rpmtypes.h:24
VERIFY_CONTEXTS
@ VERIFY_CONTEXTS
Definition: rpmcli.h:266
rpmfileAttrs
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
rpmVerifySignatures
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.
fnpyKey
const typedef void * fnpyKey
Definition: rpmtypes.h:75
rpmInstallArguments_s::incldocs
int incldocs
Definition: rpmcli.h:361
INSTALL_NONE
@ INSTALL_NONE
Definition: rpmcli.h:295
rpmQVFilePoptTable
struct poptOption rpmQVFilePoptTable[]
rpmcliFini
poptContext rpmcliFini(poptContext optCon)
rpmQueryFlags
rpmFlags rpmQueryFlags
Definition: rpmcli.h:123
rpmcliRcfile
const char * rpmcliRcfile
rpmcliVerifySignatures
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
rpmQVKArguments_s::qva_specQuery
QSpecF_t qva_specQuery
Definition: rpmcli.h:174