rpm  4.18.0
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 /* ==================================================================== */
105 };
106 
108 
115  /* bits 0-14 unused */
116  /* bits 15-18 reserved for rpmVerifyFlags */
117  /* bits 19-21 unused */
118  QUERY_FOR_LIST = (1 << 23),
119  QUERY_FOR_STATE = (1 << 24),
120  /* bits 25-26 unused */
121  QUERY_FOR_DUMPFILES = (1 << 27),
122 };
123 
125 
126 #define _QUERY_FOR_BITS \
127  (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DUMPFILES)
128 
133 
135 
136 extern int rpmcliVfyLevelMask;
137 
140 typedef struct rpmQVKArguments_s * QVA_t;
141 
150 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
151 
160 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
161 
177  char qva_mode;
185 };
186 
189 extern struct rpmQVKArguments_s rpmQVKArgs;
190 
193 extern struct poptOption rpmQVSourcePoptTable[];
194 
197 extern struct poptOption rpmQVFilePoptTable[];
198 
201 extern struct poptOption rpmQueryPoptTable[];
202 
205 extern struct poptOption rpmVerifyPoptTable[];
206 
211 void rpmDisplayQueryTags(FILE * fp);
212 
222 
231 
240 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
241 
250 
259 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
260 
266  /* bits 1-14 unused */
267  VERIFY_CONTEXTS = (1 << 15),
268  VERIFY_FILES = (1 << 16),
269  VERIFY_DEPS = (1 << 17),
270  VERIFY_SCRIPT = (1 << 18),
271 };
272 
274 
275 #define VERIFY_ALL \
276  ( VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT )
277 
287 
288 /* ==================================================================== */
290 /* --- install/upgrade/erase modes */
291 
297  INSTALL_PERCENT = (1 << 0),
298  INSTALL_HASH = (1 << 1),
299  INSTALL_NODEPS = (1 << 2),
300  INSTALL_NOORDER = (1 << 3),
301  INSTALL_LABEL = (1 << 4),
302  INSTALL_UPGRADE = (1 << 5),
303  INSTALL_FRESHEN = (1 << 6),
304  INSTALL_INSTALL = (1 << 7),
305  INSTALL_ERASE = (1 << 8),
306  INSTALL_ALLMATCHES = (1 << 9),
307  INSTALL_REINSTALL = (1 << 10),
308  INSTALL_RESTORE = (1 << 11),
309 };
310 
312 
316 #define UNINSTALL_NONE INSTALL_NONE
317 #define UNINSTALL_NODEPS INSTALL_NODEPS
318 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
319 
334 void * rpmShowProgress(const void * arg,
335  const rpmCallbackType what,
336  const rpm_loff_t amount,
337  const rpm_loff_t total,
338  fnpyKey key,
339  void * data);
340 
349 int rpmInstallSource(rpmts ts, const char * arg,
350  char ** specFilePtr,
351  char ** cookie);
352 
353 
362  int noDeps;
363  int incldocs;
365  char * prefix;
366 };
367 
377 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
378 
388 
397 
400 extern struct rpmInstallArguments_s rpmIArgs;
401 
404 extern struct poptOption rpmInstallPoptTable[];
405 
406 /* ==================================================================== */
415 
423 
424 #ifdef __cplusplus
425 }
426 #endif
427 
428 #endif /* H_RPMCLI */
Argument Manipulation API.
char ** ARGV_t
Definition: argv.h:17
char *const * ARGV_const_t
Definition: argv.h:18
struct rpmInstallArguments_s rpmIArgs
int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv)
Verify package signatures.
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.
struct rpmQVKArguments_s * QVA_t
Definition: rpmcli.h:140
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
int(* QVF_t)(QVA_t qva, rpmts ts, Header h)
Function to display iterator matches.
Definition: rpmcli.h:150
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
struct rpmQVKArguments_s rpmQVKArgs
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
Iterate over query/verify arg list.
rpmInstallFlags_e
Bit(s) to control rpmInstall() operation.
Definition: rpmcli.h:295
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
int rpmInstallSource(rpmts ts, const char *arg, char **specFilePtr, char **cookie)
Install source rpm package.
struct poptOption rpmQVFilePoptTable[]
struct poptOption rpmQVSourcePoptTable[]
void rpmDisplayQueryTags(FILE *fp)
Display list of tags that can be used in –queryformat.
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
Display results of package query.
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
struct poptOption rpmInstallPoptTable[]
rpmQueryFlags_e
Bit(s) to control rpmQuery() operation, stored in qva_flags.
Definition: rpmcli.h:113
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
rpmFlags rpmInstallFlags
Definition: rpmcli.h:311
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
struct poptOption rpmVerifyPoptTable[]
rpmQVSources_e
Query/Verify argument qualifiers.
Definition: rpmcli.h:81
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
int rpmRestore(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Restore file metadata (perms etc) of installed package(s).
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
struct poptOption rpmQueryPoptTable[]
int(* QSpecF_t)(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file.
Definition: rpmcli.h:160
@ INSTALL_FRESHEN
Definition: rpmcli.h:303
@ INSTALL_NOORDER
Definition: rpmcli.h:300
@ INSTALL_NODEPS
Definition: rpmcli.h:299
@ INSTALL_UPGRADE
Definition: rpmcli.h:302
@ INSTALL_INSTALL
Definition: rpmcli.h:304
@ INSTALL_LABEL
Definition: rpmcli.h:301
@ INSTALL_HASH
Definition: rpmcli.h:298
@ INSTALL_PERCENT
Definition: rpmcli.h:297
@ INSTALL_ERASE
Definition: rpmcli.h:305
@ INSTALL_REINSTALL
Definition: rpmcli.h:307
@ INSTALL_ALLMATCHES
Definition: rpmcli.h:306
@ INSTALL_RESTORE
Definition: rpmcli.h:308
@ INSTALL_NONE
Definition: rpmcli.h:296
@ QUERY_FOR_DUMPFILES
Definition: rpmcli.h:121
@ QUERY_FOR_STATE
Definition: rpmcli.h:119
@ QUERY_FOR_LIST
Definition: rpmcli.h:118
@ QUERY_FOR_DEFAULT
Definition: rpmcli.h:114
@ RPMQV_WHATCONFLICTS
Definition: rpmcli.h:103
@ RPMQV_WHATRECOMMENDS
Definition: rpmcli.h:97
@ RPMQV_WHATPROVIDES
Definition: rpmcli.h:87
@ RPMQV_PKGID
Definition: rpmcli.h:93
@ RPMQV_ALL
Definition: rpmcli.h:84
@ RPMQV_HDRID
Definition: rpmcli.h:94
@ RPMQV_TRIGGEREDBY
Definition: rpmcli.h:89
@ RPMQV_PATH
Definition: rpmcli.h:83
@ RPMQV_WHATSUGGESTS
Definition: rpmcli.h:98
@ RPMQV_PACKAGE
Definition: rpmcli.h:82
@ RPMQV_TID
Definition: rpmcli.h:95
@ RPMQV_SPECFILE
Definition: rpmcli.h:92
@ RPMQV_SPECBUILTRPMS
Definition: rpmcli.h:101
@ RPMQV_DBOFFSET
Definition: rpmcli.h:90
@ RPMQV_PATH_ALL
Definition: rpmcli.h:104
@ RPMQV_WHATSUPPLEMENTS
Definition: rpmcli.h:99
@ RPMQV_SPECSRPM
Definition: rpmcli.h:96
@ RPMQV_WHATENHANCES
Definition: rpmcli.h:100
@ RPMQV_RPM
Definition: rpmcli.h:85
@ RPMQV_SPECRPMS
Definition: rpmcli.h:91
@ RPMQV_WHATOBSOLETES
Definition: rpmcli.h:102
@ RPMQV_GROUP
Definition: rpmcli.h:86
@ RPMQV_WHATREQUIRES
Definition: rpmcli.h:88
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:99
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
uint32_t rpmFlags
Definition: rpmtypes.h:42
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
const void * fnpyKey
Definition: rpmtypes.h:76
rpmVerifyFlags_e
Bit(s) to control rpmcliVerify() operation.
Definition: rpmcli.h:264
@ VERIFY_CONTEXTS
Definition: rpmcli.h:267
@ VERIFY_DEPS
Definition: rpmcli.h:269
@ VERIFY_SCRIPT
Definition: rpmcli.h:270
@ VERIFY_DEFAULT
Definition: rpmcli.h:265
@ VERIFY_FILES
Definition: rpmcli.h:268
(un)install callbacks
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmFlags rpmQueryFlags
Definition: rpmcli.h:124
int rpmcliVfyLevelMask
const char * rpmcliPipeOutput
const char * rpmcliRcfile
const char * rpmcliRootDir
int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv)
Import public key(s) to rpm keyring.
rpmVSFlags rpmcliVSFlags
rpmFlags rpmQVSources
Definition: rpmcli.h:107
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char *fn)
Check package and header signatures.
rpmFlags rpmVerifyFlags
Definition: rpmcli.h:273
File info set iterator API.
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:64
rpmFlags rpmVerifyAttrs
Definition: rpmfiles.h:94
In Memoriam: Steve Taylor staylor@redhat.com was here, now he's not.
Macro API.
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
Structures and prototypes used for an "rpmts" transaction set.
rpmFlags rpmtransFlags
Definition: rpmts.h:60
rpmFlags rpmVSFlags
Definition: rpmts.h:112
A couple utils for URL Manipulation.
Describe database command line requests.
Definition: rpmcli.h:357
rpmRelocation * relocations
Definition: rpmcli.h:364
rpmInstallFlags installInterfaceFlags
Definition: rpmcli.h:360
rpmprobFilterFlags probFilter
Definition: rpmcli.h:359
rpmtransFlags transFlags
Definition: rpmcli.h:358
Describe query/verify/signature command line operation.
Definition: rpmcli.h:165
rpmfileAttrs qva_incattr
Definition: rpmcli.h:169
QVF_t qva_showPackage
Definition: rpmcli.h:174
rpmfileAttrs qva_excattr
Definition: rpmcli.h:170
char * qva_queryFormat
Definition: rpmcli.h:176
int qva_sourceCount
Definition: rpmcli.h:167
rpmQueryFlags qva_flags
Definition: rpmcli.h:168
QSpecF_t qva_specQuery
Definition: rpmcli.h:175
rpmQVSources qva_source
Definition: rpmcli.h:166
rpmVerifyAttrs qva_ofvattr
Definition: rpmcli.h:172
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:129