rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmcli.h
Go to the documentation of this file.
1 #ifndef H_RPMCLI
2 #define H_RPMCLI
3
8 #include <popt.h>
9 #include <rpmmacro.h>
10 #include <rpmtypes.h>
11 #include <rpmtag.h>
12 #include <rpmps.h>
13 #include <rpmrc.h>
14 #include <rpmfi.h> /* XXX rpmfileAttrs */
15 #include <rpmts.h> /* XXX rpmdepFlags */
16
21 /*@-redecl@*/
22 /*@unchecked@*/
23 extern headerSprintfExtension rpmHeaderFormats;
24 /*@=redecl@*/
25
29 /*@-redecl@*/
30 /*@unchecked@*/
31 extern int _noDirTokens;
32 /*@=redecl@*/
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
41 /*@unchecked@*/
42 extern struct poptOption rpmcliAllPoptTable[];
43
44 /*@unchecked@*/
45 extern int global_depFlags;
46
47 /*@unchecked@*/
48 extern struct poptOption rpmcliDepFlagsPoptTable[];
49
50 /*@unchecked@*/ /*@observer@*/ /*@null@*/
51 extern const char * rpmcliTargets;
52 /*@=redecl@*/
53
61 /*@null@*/
62 poptContext
63 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
64 /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno, stderr,
65 fileSystem, internalState @*/
66 /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
67 fileSystem, internalState @*/;
68
73 /*@mayexit@*/
74 void rpmcliConfigured(void)
75 /*@globals rpmCLIMacroContext,
76 rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
77 /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
78 fileSystem, internalState @*/;
79
85 poptContext
86 rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
87 /*@globals rpmTags, rpmGlobalMacroContext,
88 fileSystem, internalState @*/
89 /*@modifies optCon, rpmTags, rpmGlobalMacroContext,
90 fileSystem, internalState @*/;
91
95 #define RPMCLI_POPT_NODEPS -1026
96 #define RPMCLI_POPT_NOFDIGESTS -1027
97 #define RPMCLI_POPT_NOSCRIPTS -1028
98 #define RPMCLI_POPT_NOSIGNATURE -1029
99 #define RPMCLI_POPT_NODIGEST -1030
100 #define RPMCLI_POPT_NOHDRCHK -1031
101 #define RPMCLI_POPT_NOCONTEXTS -1032
102 #define RPMCLI_POPT_TARGETPLATFORM -1033
103
104 /* ==================================================================== */
107
112 typedef enum rpmQVSources_e {
113 RPMQV_PACKAGE = 0,
114 RPMQV_PATH,
115 RPMQV_ALL,
116 RPMQV_RPM,
117 RPMQV_GROUP = RPMTAG_GROUP,
118 RPMQV_WHATPROVIDES,
119 RPMQV_WHATREQUIRES,
120 RPMQV_TRIGGEREDBY = RPMTAG_TRIGGERNAME,
121 RPMQV_DBOFFSET,
122 RPMQV_SPECFILE,
123 RPMQV_PKGID,
124 RPMQV_HDRID,
125 RPMQV_FILEID,
126 RPMQV_TID,
127 RPMQV_HDLIST,
128 RPMQV_FTSWALK,
129 RPMQV_WHATNEEDS,
130 RPMQV_SPECSRPM,
131 RPMQV_SOURCEPKGID,
132 RPMQV_WHATCONFLICTS = RPMTAG_CONFLICTNAME,
133 RPMQV_WHATOBSOLETES = RPMTAG_OBSOLETENAME
134 } rpmQVSources;
135
139 typedef enum rpmVerifyAttrs_e {
140 RPMVERIFY_NONE = 0,
141 RPMVERIFY_FDIGEST = (1 << 0),
142 RPMVERIFY_FILESIZE = (1 << 1),
143 RPMVERIFY_LINKTO = (1 << 2),
144 RPMVERIFY_USER = (1 << 3),
145 RPMVERIFY_GROUP = (1 << 4),
146 RPMVERIFY_MTIME = (1 << 5),
147 RPMVERIFY_MODE = (1 << 6),
148 RPMVERIFY_RDEV = (1 << 7),
149 /* bits 8-14 unused, reserved for rpmVerifyAttrs */
150 RPMVERIFY_CONTEXTS = (1 << 15),
151 /* bits 16-22 used in rpmVerifyFlags */
152 /* bits 23-27 used in rpmQueryFlags */
153 RPMVERIFY_READLINKFAIL= (1 << 28),
154 RPMVERIFY_READFAIL = (1 << 29),
155 RPMVERIFY_LSTATFAIL = (1 << 30),
156 RPMVERIFY_LGETFILECONFAIL = (1 << 31)
157 } rpmVerifyAttrs;
158 #define RPMVERIFY_MD5 RPMVERIFY_FDIGEST
159 #define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
160 #define RPMVERIFY_FAILURES \
161 (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
162
167 typedef enum rpmQueryFlags_e {
168 /*@-enummemuse@*/
169 QUERY_FOR_DEFAULT = 0,
170 QUERY_FDIGEST = (1 << 0),
171 QUERY_SIZE = (1 << 1),
172 QUERY_LINKTO = (1 << 2),
173 QUERY_USER = (1 << 3),
174 QUERY_GROUP = (1 << 4),
175 QUERY_MTIME = (1 << 5),
176 QUERY_MODE = (1 << 6),
177 QUERY_RDEV = (1 << 7),
178 /* bits 8-14 unused, reserved for rpmVerifyAttrs */
179 QUERY_CONTEXTS = (1 << 15),
180 QUERY_FILES = (1 << 16),
181 QUERY_DEPS = (1 << 17),
182 QUERY_SCRIPT = (1 << 18),
183 QUERY_DIGEST = (1 << 19),
184 QUERY_SIGNATURE = (1 << 20),
185 QUERY_PATCHES = (1 << 21),
186 QUERY_HDRCHK = (1 << 22),
187 /*@=enummemuse@*/
188 QUERY_FOR_LIST = (1 << 23),
189 QUERY_FOR_STATE = (1 << 24),
190 QUERY_FOR_DOCS = (1 << 25),
191 QUERY_FOR_CONFIG = (1 << 26),
192 QUERY_FOR_DUMPFILES = (1 << 27)
193 } rpmQueryFlags;
194
195 #define _QUERY_FOR_BITS \
196 (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
197 QUERY_FOR_DUMPFILES)
198
202 /*@unchecked@*/
203 extern rpmQueryFlags rpmcliQueryFlags;
204
209 typedef enum rpmVerifyFlags_e {
210 /*@-enummemuse@*/
211 VERIFY_DEFAULT = 0,
212 /*@=enummemuse@*/
213 VERIFY_FDIGEST = (1 << 0),
214 VERIFY_SIZE = (1 << 1),
215 VERIFY_LINKTO = (1 << 2),
216 VERIFY_USER = (1 << 3),
217 VERIFY_GROUP = (1 << 4),
218 VERIFY_MTIME = (1 << 5),
219 VERIFY_MODE = (1 << 6),
220 VERIFY_RDEV = (1 << 7),
221 /* bits 8-14 unused, reserved for rpmVerifyAttrs */
222 VERIFY_CONTEXTS = (1 << 15),
223 VERIFY_FILES = (1 << 16),
224 VERIFY_DEPS = (1 << 17),
225 VERIFY_SCRIPT = (1 << 18),
226 VERIFY_DIGEST = (1 << 19),
227 VERIFY_SIGNATURE = (1 << 20),
228 VERIFY_PATCHES = (1 << 21),
229 VERIFY_HDRCHK = (1 << 22),
230 /*@-enummemuse@*/
231 VERIFY_FOR_LIST = (1 << 23),
232 VERIFY_FOR_STATE = (1 << 24),
233 VERIFY_FOR_DOCS = (1 << 25),
234 VERIFY_FOR_CONFIG = (1 << 26),
235 VERIFY_FOR_DUMPFILES= (1 << 27)
236 /*@=enummemuse@*/
237 /* bits 28-31 used in rpmVerifyAttrs */
238 } rpmVerifyFlags;
239
240 #define VERIFY_ATTRS \
241 ( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
242 VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )
243 #define VERIFY_ALL \
244 ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
245 VERIFY_SIGNATURE | VERIFY_HDRCHK )
246
249 typedef struct rpmQVKArguments_s * QVA_t;
250
259 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
260 /*@globals fileSystem @*/
261 /*@modifies qva, ts, fileSystem @*/;
262
271 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg)
272 /*@globals rpmGlobalMacroContext, h_errno,
273 fileSystem, internalState @*/
274 /*@modifies ts, qva, rpmGlobalMacroContext,
275 fileSystem, internalState @*/;
276
279 /*@unchecked@*/
280 extern struct poptOption rpmQVSourcePoptTable[];
281
284 /*@unchecked@*/
285 extern int specedit;
286
289 /*@unchecked@*/
290 extern struct poptOption rpmQueryPoptTable[];
291
294 /*@unchecked@*/
295 extern struct poptOption rpmVerifyPoptTable[];
296
308 int rpmcliShowMatches(QVA_t qva, rpmts ts)
309 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
310 /*@modifies qva, rpmGlobalMacroContext, fileSystem, internalState @*/;
311
324 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
325 /*@globals rpmGlobalMacroContext, h_errno,
326 fileSystem, internalState @*/
327 /*@modifies qva, ts, rpmGlobalMacroContext,
328 fileSystem, internalState @*/;
329
338 int showQueryPackage(QVA_t qva, rpmts ts, Header h)
339 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
340 /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
341
349 int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
350 /*@globals rpmGlobalMacroContext, h_errno,
351 fileSystem, internalState @*/
352 /*@modifies ts, qva, rpmGlobalMacroContext,
353 fileSystem, internalState @*/;
354
363 int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
364 /*@globals rpmGlobalMacroContext, h_errno,
365 fileSystem, internalState @*/
366 /*@modifies ts, qva, rpmGlobalMacroContext,
367 fileSystem, internalState @*/;
368
376 int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
377 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
378 /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
379
388 int rpmVerifySignatures(QVA_t qva, rpmts ts, void * _fd, const char * fn)
389 /*@globals fileSystem, internalState @*/
390 /*@modifies qva, ts, fileSystem, internalState @*/;
391
400 int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
401 /*@globals rpmGlobalMacroContext, h_errno,
402 fileSystem, internalState @*/
403 /*@modifies ts, qva, rpmGlobalMacroContext,
404 fileSystem, internalState @*/;
405
407 /* ==================================================================== */
410 /* --- install/upgrade/erase modes */
411
415 typedef enum rpmInstallInterfaceFlags_e {
416 INSTALL_NONE = 0,
417 INSTALL_PERCENT = (1 << 0),
418 INSTALL_HASH = (1 << 1),
419 INSTALL_NODEPS = (1 << 2),
420 INSTALL_NOORDER = (1 << 3),
421 INSTALL_LABEL = (1 << 4),
422 INSTALL_UPGRADE = (1 << 5),
423 INSTALL_FRESHEN = (1 << 6),
424 INSTALL_INSTALL = (1 << 7),
425 INSTALL_ERASE = (1 << 8),
426 INSTALL_ALLMATCHES = (1 << 9)
427 } rpmInstallInterfaceFlags;
428
429 /*@-redecl@*/
430 /*@unchecked@*/
431 extern int rpmcliPackagesTotal;
432 /*@=redecl@*/
433 /*@unchecked@*/
434 extern int rpmcliHashesCurrent;
435 /*@unchecked@*/
436 extern int rpmcliHashesTotal;
437 /*@unchecked@*/
438 extern rpmuint64_t rpmcliProgressCurrent;
439 /*@unchecked@*/
440 extern rpmuint64_t rpmcliProgressTotal;
441
458 /*@null@*/
459 void * rpmShowProgress(/*@null@*/ const void * arg,
460 const rpmCallbackType what,
461 const rpmuint64_t amount,
462 const rpmuint64_t total,
463 /*@null@*/ fnpyKey key,
464 /*@null@*/ void * data)
465 /*@globals rpmcliHashesCurrent,
466 rpmcliProgressCurrent, rpmcliProgressTotal,
467 h_errno, rpmGlobalMacroContext, fileSystem, internalState @*/
468 /*@modifies arg, rpmcliHashesCurrent,
469 rpmcliProgressCurrent, rpmcliProgressTotal,
470 rpmGlobalMacroContext, fileSystem, internalState @*/;
471
480 int rpmInstallSource(rpmts ts, const char * arg,
481 /*@null@*/ /*@out@*/ const char ** specFilePtr,
482 /*@null@*/ /*@out@*/ const char ** cookie)
483 /*@globals rpmGlobalMacroContext, h_errno,
484 fileSystem, internalState@*/
485 /*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext,
486 fileSystem, internalState @*/;
487
495 int rpmcliInstallProblems(rpmts ts, /*@null@*/ const char * msg, int rc)
496 /*@globals fileSystem, internalState @*/
497 /*@modifies ts, fileSystem, internalState @*/;
498
504 int rpmcliInstallSuggests(rpmts ts)
505 /*@globals internalState @*/
506 /*@modifies ts, internalState @*/;
507
513 int rpmcliInstallCheck(rpmts ts)
514 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
515 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
516
522 int rpmcliInstallOrder(rpmts ts)
523 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
524 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
525
533 int rpmcliInstallRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
534 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
535 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
536
545 int rpmcliInstall(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
546 /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
547 fileSystem, internalState@*/
548 /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
549 fileSystem, internalState @*/;
550
558 int rpmErase(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
559 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
560 /*@modifies ts, ia, rpmGlobalMacroContext,
561 fileSystem, internalState @*/;
562
565 /*@unchecked@*/
566 extern struct poptOption rpmInstallPoptTable[];
567
569 /* ==================================================================== */
572
575 /*@unchecked@*/
576 extern struct poptOption rpmDatabasePoptTable[];
577
579 /* ==================================================================== */
582
591 rpmRC rpmcliImportPubkey(const rpmts ts,
592 const unsigned char * pkt, ssize_t pktlen)
593 /*@globals rpmGlobalMacroContext, h_errno,
594 fileSystem, internalState @*/
595 /*@modifies ts, rpmGlobalMacroContext,
596 fileSystem, internalState @*/;
597
601 /*@-typeuse@*/
602 #if !defined(SWIG)
603 typedef enum rpmSignFlags_e {
604 RPMSIGN_NONE = 0,
605 RPMSIGN_CHK_SIGNATURE = 'K',
606 RPMSIGN_NEW_SIGNATURE = 'R',
607 RPMSIGN_ADD_SIGNATURE = 'A',
608 RPMSIGN_DEL_SIGNATURE = 'D',
609 RPMSIGN_IMPORT_PUBKEY = 'I',
610 } rpmSignFlags;
611 #endif
612 /*@=typeuse@*/
613
616 /*@unchecked@*/
617 extern struct poptOption rpmSignPoptTable[];
618
626 int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
627 /*@globals rpmGlobalMacroContext, h_errno,
628 fileSystem, internalState @*/
629 /*@modifies ts, qva, rpmGlobalMacroContext,
630 fileSystem, internalState @*/;
631
637 #if !defined(SWIG)
638 struct rpmQVKArguments_s {
639 rpmQVSources qva_source;
640 int qva_sourceCount;
641 rpmQueryFlags qva_flags;
642 rpmfileAttrs qva_fflags;
643 /*@only@*/ /*@null@*/
644 rpmmi qva_mi;
645 /*@refccounted@*/ /*@relnull@*/
646 rpmgi qva_gi;
647 rpmRC qva_rc;
649 /*@null@*/
650 QVF_t qva_showPackage;
651 int qva_showOK;
652 int qva_showFAIL;
653 /*@null@*/
654 QSpecF_t qva_specQuery;
655 /*@unused@*/
656 int qva_verbose;
657 /*@only@*/ /*@null@*/
658 const char * qva_queryFormat;
659 int sign;
660 int nopassword;
661 int trust;
662 /*@observer@*/
663 const char * passPhrase;
664 /*@owned@*/ /*@null@*/
665 const char * qva_prefix;
666 char qva_mode;
676 char qva_char;
678 /* install/erase mode arguments */
679 rpmdepFlags depFlags;
680 rpmtransFlags transFlags;
681 rpmprobFilterFlags probFilter;
682 rpmInstallInterfaceFlags installInterfaceFlags;
683 rpmuint32_t arbtid;
684 rpmuint32_t rbtid;
685 rpmuint32_t *rbtidExcludes;
686 int numrbtidExcludes;
687 int noDeps;
688 int incldocs;
689 int no_rollback_links;
690 /*@owned@*/ /*@relnull@*/
691 rpmRelocation relocations;
692 int nrelocations;
693
694 /* database mode arguments */
695 int init;
696 int rebuild;
697 int verify;
699 /* rollback vectors */
700 int (*rbCheck) (rpmts ts);
701 int (*rbOrder) (rpmts ts);
702 int (*rbRun) (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
703 };
704 #endif
705
708 /*@unchecked@*/
709 extern struct rpmQVKArguments_s rpmQVKArgs;
710
713 /*@unchecked@*/
714 extern struct rpmQVKArguments_s rpmIArgs;
715
718 /*@unchecked@*/
719 extern struct rpmQVKArguments_s rpmDBArgs;
720
721 /* ==================================================================== */
724
728 struct rpmBuildArguments_s {
729 rpmQueryFlags qva_flags;
730 int buildAmount;
731 /*@observer@*/
732 const char * passPhrase;
733 /*@only@*/ /*@null@*/
734 const char * cookie;
735 int noBuild;
736 int noDeps;
737 int noLang;
738 int shortCircuit;
739 int sign;
740 int nopassword;
741 int useCatalog;
742 char buildMode;
743 char buildChar;
744 /*@observer@*/ /*@null@*/
745 const char * rootdir;
746 };
747
750 typedef struct rpmBuildArguments_s * BTA_t;
751
754 /*@unchecked@*/
755 extern struct rpmBuildArguments_s rpmBTArgs;
756
759 /*@unchecked@*/
760 extern struct poptOption rpmBuildPoptTable[];
761
764 #ifdef __cplusplus
765 }
766 #endif
767
768 #endif /* H_RPMCLI */