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 /* ==================================================================== */
104 };
105 
107 
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 
124 
125 #define _QUERY_FOR_BITS \
126  (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DUMPFILES)
127 
132 
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 
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 
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 
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 
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 
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 
360  int noDeps;
361  int incldocs;
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 /* ==================================================================== */
404 
412 
413 #ifdef __cplusplus
414 }
415 #endif
416 
417 #endif /* H_RPMCLI */
rpmfileAttrs qva_incattr
Definition: rpmcli.h:168
const char * rpmcliRcfile
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:139
int qva_sourceCount
Definition: rpmcli.h:166
char ** ARGV_t
Definition: argv.h:17
rpmFlags rpmVerifyFlags
Definition: rpmcli.h:272
rpmprobFilterFlags probFilter
Definition: rpmcli.h:357
struct poptOption rpmQVFilePoptTable[]
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
rpmFlags rpmQVSources
Definition: rpmcli.h:106
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
rpmQueryFlags qva_flags
Definition: rpmcli.h:167
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:81
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
int rpmcliVfyLevelMask
rpmRelocation * relocations
Definition: rpmcli.h:362
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
Verify package signatures.
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
Describe query/verify/signature command line operation.
Definition: rpmcli.h:164
QSpecF_t qva_specQuery
Definition: rpmcli.h:174
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:127
struct rpmQVKArguments_s rpmQVKArgs
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
QVF_t qva_showPackage
Definition: rpmcli.h:173
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
struct poptOption rpmInstallPoptTable[]
int rpmInstallSource(rpmts ts, const char *arg, char **specFilePtr, char **cookie)
Install source rpm package.
uint32_t rpmFlags
Definition: rpmtypes.h:42
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
const char * rpmcliPipeOutput
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
Display results of package query.
struct poptOption rpmQueryPoptTable[]
rpmFlags rpmQueryFlags
Definition: rpmcli.h:123
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:98
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
Definition: rpmcli.h:149
rpmtransFlags transFlags
Definition: rpmcli.h:356
struct poptOption rpmQVSourcePoptTable[]
rpmQVSources qva_source
Definition: rpmcli.h:165
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmVerifyFlags_e
Bit(s) to control rpmcliVerify() operation.
Definition: rpmcli.h:263
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
const void * fnpyKey
Definition: rpmtypes.h:75
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:358
rpmFlags rpmVSFlags
Definition: rpmts.h:111
rpmVerifyAttrs qva_ofvattr
Definition: rpmcli.h:171
struct rpmInstallArguments_s rpmIArgs
rpmVSFlags rpmcliVSFlags
const char * rpmcliRootDir
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
rpmfileAttrs qva_excattr
Definition: rpmcli.h:169
char * qva_queryFormat
Definition: rpmcli.h:175
char *const * ARGV_const_t
Definition: argv.h:18
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:294
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:112
Describe database command line requests.
Definition: rpmcli.h:355
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
struct poptOption rpmVerifyPoptTable[]
rpmFlags rpmInstallFlags
Definition: rpmcli.h:309
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:159
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
rpmFlags rpmVerifyAttrs
Definition: rpmfiles.h:95
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
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.
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
rpmFlags rpmtransFlags
Definition: rpmts.h:59
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv)
Import public key(s) to rpm keyring.
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.