rpm  4.16.1.2
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 
221 
230 
239 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
240 
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 
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 
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 */
rpmVerifyPoptTable
struct poptOption rpmVerifyPoptTable[]
rpmts
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
RPMQV_RPM
@ RPMQV_RPM
Definition: rpmcli.h:85
rpmcliQuery
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpmQVSources
rpmFlags rpmQVSources
Definition: rpmcli.h:106
rpmQVSources_e
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:81
QSpecF_t
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:159
rpmInstallFlags_e
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
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)
Iterate over query/verify arg list.
RPMQV_ALL
@ RPMQV_ALL
Definition: rpmcli.h:84
rpmcliVSFlags
rpmVSFlags rpmcliVSFlags
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:18
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.
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
Bit(s) to control rpmcliVerify() operation.
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)
Erase binary rpm package.
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
Bit(s) from common command line options.
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)
Install source rpm package.
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:60
rpmVerifyAttrs
rpmFlags rpmVerifyAttrs
Definition: rpmfiles.h:95
rpmcliInit
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
showVerifyPackage
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
rpmcliConfigured
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
RPMQV_WHATREQUIRES
@ RPMQV_WHATREQUIRES
Definition: rpmcli.h:88
rpmInstallArguments_s
Describe database command line requests.
Definition: rpmcli.h:355
rpmQVKArguments_s
Describe query/verify/signature command line operation.
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)
Display list of tags that can be used in –queryformat.
rpmcliRootDir
const char * rpmcliRootDir
rpmQueryFlags_e
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
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)
Display results of package query.
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[]
Popt option table for options shared by all modes and executables.
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)
Install/upgrade/freshen/reinstall binary rpm package.
QVF_t
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
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
fnpyKey
const void * fnpyKey
Definition: rpmtypes.h:76
RPMQV_PKGID
@ RPMQV_PKGID
Definition: rpmcli.h:93
FD_t
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:99
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)
The rpm CLI generic transaction callback handler.
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)
Verify package install.
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:112
Header
struct headerToken_s * Header
RPM header and data retrieval types.
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.
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)
Destroy most everything needed by an rpm CLI executable context.
rpmQueryFlags
rpmFlags rpmQueryFlags
Definition: rpmcli.h:123
rpmcliRcfile
const char * rpmcliRcfile
rpmcliVerifySignatures
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
Verify package signatures.
rpmQVKArguments_s::qva_specQuery
QSpecF_t qva_specQuery
Definition: rpmcli.h:174