rpm  4.11.3
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 /* ==================================================================== */
94 };
95 
97 
104  QUERY_MD5 = (1 << 0),
105  QUERY_FILEDIGEST = (1 << 0),
106  QUERY_SIZE = (1 << 1),
107  QUERY_LINKTO = (1 << 2),
108  QUERY_USER = (1 << 3),
109  QUERY_GROUP = (1 << 4),
110  QUERY_MTIME = (1 << 5),
111  QUERY_MODE = (1 << 6),
112  QUERY_RDEV = (1 << 7),
113  /* bits 8-14 unused, reserved for rpmVerifyAttrs */
114  QUERY_CONTEXTS = (1 << 15),
115  QUERY_FILES = (1 << 16),
116  QUERY_DEPS = (1 << 17),
117  QUERY_SCRIPT = (1 << 18),
118  QUERY_DIGEST = (1 << 19),
119  QUERY_SIGNATURE = (1 << 20),
120  QUERY_PATCHES = (1 << 21),
121  QUERY_HDRCHK = (1 << 22),
122  QUERY_FOR_LIST = (1 << 23),
123  QUERY_FOR_STATE = (1 << 24),
124  QUERY_FOR_DOCS = (1 << 25),
125  QUERY_FOR_CONFIG = (1 << 26),
126  QUERY_FOR_DUMPFILES = (1 << 27),
127  QUERY_FOR_LICENSE = (1 << 28)
128 };
129 
131 
132 #define _QUERY_FOR_BITS \
133  (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
134  QUERY_FOR_LICENSE|QUERY_FOR_DUMPFILES)
135 
139 extern rpmQueryFlags rpmcliQueryFlags;
140 
143 typedef struct rpmQVKArguments_s * QVA_t;
144 
153 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
154 
163 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
164 
169  rpmQVSources qva_source;
171  rpmQueryFlags qva_flags;
177  char qva_mode;
185 };
186 
189 extern struct rpmQVKArguments_s rpmQVKArgs;
190 
193 extern struct poptOption rpmQVSourcePoptTable[];
194 
197 extern struct poptOption rpmQueryPoptTable[];
198 
201 extern struct poptOption rpmVerifyPoptTable[];
202 
207 void rpmDisplayQueryTags(FILE * fp);
208 
217 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
218 
226 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
227 
236 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
237 
245 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
246 
255 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
256 
265 int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd,
266  const char *fn);
267 
276 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
277 
278 /* ==================================================================== */
280 /* --- install/upgrade/erase modes */
281 
287  INSTALL_PERCENT = (1 << 0),
288  INSTALL_HASH = (1 << 1),
289  INSTALL_NODEPS = (1 << 2),
290  INSTALL_NOORDER = (1 << 3),
291  INSTALL_LABEL = (1 << 4),
292  INSTALL_UPGRADE = (1 << 5),
293  INSTALL_FRESHEN = (1 << 6),
294  INSTALL_INSTALL = (1 << 7),
295  INSTALL_ERASE = (1 << 8),
296  INSTALL_ALLMATCHES = (1 << 9),
297  INSTALL_REINSTALL = (1 << 10),
298 };
299 
301 
305 #define UNINSTALL_NONE INSTALL_NONE
306 #define UNINSTALL_NODEPS INSTALL_NODEPS
307 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
308 
323 void * rpmShowProgress(const void * arg,
324  const rpmCallbackType what,
325  const rpm_loff_t amount,
326  const rpm_loff_t total,
327  fnpyKey key,
328  void * data);
329 
338 int rpmInstallSource(rpmts ts, const char * arg,
339  char ** specFilePtr,
340  char ** cookie);
341 
342 
349  rpmInstallFlags installInterfaceFlags;
351  int noDeps;
352  int incldocs;
354  char * prefix;
355 };
356 
366 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
367 
376 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
377 
380 extern struct rpmInstallArguments_s rpmIArgs;
381 
384 extern struct poptOption rpmInstallPoptTable[];
385 
386 /* ==================================================================== */
395 
403 
404 #ifdef __cplusplus
405 }
406 #endif
407 
408 #endif /* H_RPMCLI */
const char * rpmcliRcfile
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:143
int qva_sourceCount
Definition: rpmcli.h:170
char ** ARGV_t
Definition: argv.h:15
rpmprobFilterFlags probFilter
Definition: rpmcli.h:348
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
rpmFlags rpmQVSources
Definition: rpmcli.h:96
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
rpmQueryFlags qva_flags
Definition: rpmcli.h:171
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:78
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.
rpmRelocation * relocations
Definition: rpmcli.h:353
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:34
Describe query/verify/signature command line operation.
Definition: rpmcli.h:168
QSpecF_t qva_specQuery
Definition: rpmcli.h:175
We pass these around as an array with a sentinel.
Definition: rpmfi.h:94
struct rpmQVKArguments_s rpmQVKArgs
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
struct rpmKeyring_s * rpmKeyring
Definition: rpmtypes.h:78
QVF_t qva_showPackage
Definition: rpmcli.h:174
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:163
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:130
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:95
rpmtransFlags transFlags
Definition: rpmcli.h:347
struct poptOption rpmQVSourcePoptTable[]
rpmQVSources qva_source
Definition: rpmcli.h:169
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
const void * fnpyKey
Definition: rpmtypes.h:73
rpmfileAttrs qva_fflags
Definition: rpmcli.h:172
static struct poptOption optionsTable[]
Definition: rpmbuild.c:215
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:349
int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd, const char *fn)
Check package and header signatures.
struct rpmInstallArguments_s rpmIArgs
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
Definition: rpmcli.h:153
const char * rpmcliRootDir
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
char * qva_queryFormat
Definition: rpmcli.h:176
char *const * ARGV_const_t
Definition: argv.h:16
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:285
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:102
Describe database command line requests.
Definition: rpmcli.h:346
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
struct poptOption rpmVerifyPoptTable[]
rpmFlags rpmInstallFlags
Definition: rpmcli.h:300
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.
rpmFlags rpmfileAttrs
Definition: rpmfi.h:66
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
rpmFlags rpmtransFlags
Definition: rpmts.h:57
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.