rpm 5.2.1

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

- File List
- Globals

rpmte.h
Go to the documentation of this file.
1 #ifndef H_RPMTE
2 #define H_RPMTE
3
8 #include <rpmfi.h>
9
12 /*@-exportlocal@*/
13 /*@unchecked@*/
14 extern int _rpmte_debug;
15 /*@=exportlocal@*/
16
20 typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
21
25 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmtsi_s *rpmtsi;
26
30 typedef enum rpmElementType_e {
31 TR_ADDED = (1 << 0),
32 TR_REMOVED = (1 << 1)
33 } rpmElementType;
34
35 #if defined(_RPMTE_INTERNAL)
36 #include <argv.h>
37 #include <rpmal.h>
38
42 /*@-fielduse@*/ /* LCL: confused by union? */
43 struct tsortInfo_s {
44 union {
45 int count;
46 /*@exposed@*/ /*@dependent@*/ /*@null@*/
47 rpmte suc;
48 } tsi_u;
49 #define tsi_count tsi_u.count
50 #define tsi_suc tsi_u.suc
51 /*@owned@*/ /*@null@*/
52 tsortInfo tsi_next;
53 /*@exposed@*/ /*@dependent@*/ /*@null@*/
54 rpmte tsi_chain;
55 int tsi_tagn;
56 int tsi_reqx;
57 int tsi_queued;
58 int tsi_qcnt;
59 };
60 /*@=fielduse@*/
61
65 struct rpmChainLink_s {
66 /*@only@*/ /*@null@*/
67 ARGV_t Pkgid;
68 /*@only@*/ /*@null@*/
69 ARGV_t Hdrid;
70 /*@only@*/ /*@null@*/
71 ARGV_t NEVRA;
72 };
73
76 typedef struct sharedFileInfo_s * sharedFileInfo;
77
81 struct sharedFileInfo_s {
82 rpmuint32_t pkgFileNum;
83 rpmuint32_t otherFileNum;
84 rpmuint32_t otherPkg;
85 rpmuint32_t isRemoved;
86 };
87
91 struct rpmte_s {
92 struct rpmioItem_s _item;
93 rpmElementType type;
95 /*@refcounted@*/ /*@relnull@*/
96 Header h;
97 /*@only@*/
98 const char * NEVR;
99 /*@only@*/
100 const char * NEVRA;
101 /*@only@*/ /*@relnull@*/
102 const char * pkgid;
103 /*@only@*/ /*@relnull@*/
104 const char * hdrid;
105 /*@only@*/ /*@null@*/
106 const char * sourcerpm;
107 /*@only@*/
108 const char * name;
109 /*@only@*/ /*@null@*/
110 char * epoch;
111 /*@only@*/ /*@null@*/
112 char * version;
113 /*@only@*/ /*@null@*/
114 char * release;
115 #ifdef RPM_VENDOR_MANDRIVA
116 /*@only@*/ /*@null@*/
117 char * distepoch;
118 #endif
119 /*@only@*/ /*@null@*/
120 const char * arch;
121 /*@only@*/ /*@null@*/
122 const char * os;
123 int isSource;
125 rpmte parent;
126 int degree;
127 int npreds;
128 int tree;
129 int depth;
130 int breadth;
131 unsigned int db_instance;
132 /*@owned@*/
133 tsortInfo tsi;
135 /*@null@*/
136 rpmPRCO PRCO;
138 /*@refcounted@*/ /*@null@*/
139 rpmfi fi;
141 rpmuint32_t depFlags;
142 rpmuint32_t transFlags;
143 rpmuint32_t color;
144 rpmuint32_t pkgFileSize;
146 /*@exposed@*/ /*@dependent@*/ /*@null@*/
147 fnpyKey key;
148 /*@owned@*/ /*@null@*/
149 rpmRelocation relocs;
150 int nrelocs;
151 int autorelocatex;
152 /*@refcounted@*/ /*@null@*/
153 FD_t fd;
155 /*@owned@*/ /*@null@*/
156 sharedFileInfo replaced;
157 int nreplaced;
159 struct rpmChainLink_s blink;
160 struct rpmChainLink_s flink;
161 int linkFailed;
162 int done;
163 rpmuint32_t originTid[2];
164 rpmuint32_t originTime[2];
166 int installed;
167 int downgrade;
169 struct {
170 /*@exposed@*/ /*@dependent@*/ /*@null@*/
171 alKey addedKey;
172 struct {
173 /*@exposed@*/ /*@dependent@*/ /*@null@*/
174 alKey dependsOnKey;
175 int dboffset;
176 } removed;
177 } u;
178 #if defined(__LCLINT__)
179 /*@refs@*/
180 int nrefs;
181 #endif
182 };
183
187 struct rpmtsi_s {
188 struct rpmioItem_s _item;
189 /*@refcounted@*/
190 rpmts ts;
191 int reverse;
192 int ocsave;
193 int oc;
194 #if defined(__LCLINT__)
195 /*@refs@*/
196 int nrefs;
197 #endif
198 };
199
200 #endif /* _RPMTE_INTERNAL */
201
202 #ifdef __cplusplus
203 extern "C" {
204 #endif
205
206 #if defined(_RPMTE_INTERNAL)
207
212 /*@unused@*/ /*@null@*/
213 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
214 /*@globals fileSystem @*/
215 /*@modifies te, fileSystem @*/;
216 #define rpmteFree(_te) \
217 ((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__))
218
230 /*@only@*/ /*@null@*/
231 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
232 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
233 /*@null@*/ rpmRelocation relocs,
234 int dboffset,
235 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
236 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
237 /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
238 #endif /* _RPMTE_INTERNAL */
239
245 extern Header rpmteHeader(rpmte te)
246 /*@modifies te @*/;
247
254 extern Header rpmteSetHeader(rpmte te, Header h)
255 /*@modifies te, h @*/;
256
262 rpmElementType rpmteType(rpmte te)
263 /*@*/;
264
270 /*@observer@*/
271 extern const char * rpmteN(rpmte te)
272 /*@*/;
273
279 /*@observer@*/ /*@null@*/
280 extern const char * rpmteE(rpmte te)
281 /*@*/;
282
288 /*@observer@*/ /*@null@*/
289 extern const char * rpmteV(rpmte te)
290 /*@*/;
291
297 /*@observer@*/ /*@null@*/
298 extern const char * rpmteR(rpmte te)
299 /*@*/;
300
301 #ifdef RPM_VENDOR_MANDRIVA
302
307 /*@observer@*/ /*@null@*/
308 extern const char * rpmteD(rpmte te)
309 /*@*/;
310 #endif
311
317 /*@observer@*/ /*@null@*/
318 extern const char * rpmteA(rpmte te)
319 /*@*/;
320
326 /*@observer@*/ /*@null@*/
327 extern const char * rpmteO(rpmte te)
328 /*@*/;
329
335 extern int rpmteIsSource(rpmte te)
336 /*@*/;
337
343 rpmuint32_t rpmteColor(rpmte te)
344 /*@*/;
345
352 rpmuint32_t rpmteSetColor(rpmte te, rpmuint32_t color)
353 /*@modifies te @*/;
354
360 unsigned int rpmteDBInstance(rpmte te)
361 /*@*/;
362
369 void rpmteSetDBInstance(rpmte te, unsigned int instance)
370 /*@modifies te @*/;
371
378 rpmuint32_t rpmtePkgFileSize(rpmte te)
379 /*@*/;
380
386 /*@observer@*/
387 rpmuint32_t * rpmteOriginTid(rpmte te)
388 /*@*/;
389
395 /*@observer@*/
396 rpmuint32_t * rpmteOriginTime(rpmte te)
397 /*@*/;
398
404 int rpmteDepth(rpmte te)
405 /*@*/;
406
413 int rpmteSetDepth(rpmte te, int ndepth)
414 /*@modifies te @*/;
415
421 int rpmteBreadth(rpmte te)
422 /*@*/;
423
430 int rpmteSetBreadth(rpmte te, int nbreadth)
431 /*@modifies te @*/;
432
438 int rpmteNpreds(rpmte te)
439 /*@*/;
440
447 int rpmteSetNpreds(rpmte te, int npreds)
448 /*@modifies te @*/;
449
455 int rpmteTree(rpmte te)
456 /*@*/;
457
464 int rpmteSetTree(rpmte te, int ntree)
465 /*@modifies te @*/;
466
472 /*@observer@*/ /*@unused@*/
473 rpmte rpmteParent(rpmte te)
474 /*@*/;
475
482 /*@null@*/
483 rpmte rpmteSetParent(rpmte te, rpmte pte)
484 /*@modifies te @*/;
485
491 int rpmteDegree(rpmte te)
492 /*@*/;
493
500 int rpmteSetDegree(rpmte te, int ndegree)
501 /*@modifies te @*/;
502
508 tsortInfo rpmteTSI(rpmte te)
509 /*@*/;
510
515 void rpmteFreeTSI(rpmte te)
516 /*@modifies te @*/;
517
522 void rpmteNewTSI(rpmte te)
523 /*@modifies te @*/;
524
529 /*@unused@*/
530 void rpmteCleanDS(rpmte te)
531 /*@modifies te @*/;
532
533 #if defined(_RPMTE_INTERNAL)
534
539 /*@exposed@*/ /*@dependent@*/ /*@null@*/
540 alKey rpmteAddedKey(rpmte te)
541 /*@*/;
542
549 /*@exposed@*/ /*@dependent@*/ /*@null@*/
550 alKey rpmteSetAddedKey(rpmte te,
551 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
552 /*@modifies te @*/;
553 #endif /* _RPMTE_INTERNAL */
554
560 int rpmteDBOffset(rpmte te)
561 /*@*/;
562
568 /*@observer@*/
569 extern const char * rpmteNEVR(rpmte te)
570 /*@*/;
571
577 /*@-exportlocal@*/
578 /*@observer@*/
579 extern const char * rpmteNEVRA(rpmte te)
580 /*@*/;
581 /*@=exportlocal@*/
582
588 /*@-exportlocal@*/
589 /*@observer@*/ /*@null@*/
590 extern const char * rpmtePkgid(rpmte te)
591 /*@*/;
592 /*@=exportlocal@*/
593
599 /*@-exportlocal@*/
600 /*@observer@*/ /*@null@*/
601 extern const char * rpmteHdrid(rpmte te)
602 /*@*/;
603 /*@=exportlocal@*/
604
610 /*@-exportlocal@*/
611 /*@observer@*/ /*@null@*/
612 extern const char * rpmteSourcerpm(rpmte te)
613 /*@*/;
614 /*@=exportlocal@*/
615
621 FD_t rpmteFd(rpmte te)
622 /*@*/;
623
629 /*@exposed@*/
630 fnpyKey rpmteKey(rpmte te)
631 /*@*/;
632
639 rpmds rpmteDS(rpmte te, rpmTag tag)
640 /*@*/;
641
648 rpmfi rpmteFI(rpmte te, rpmTag tag)
649 /*@*/;
650
656 /*@-exportlocal@*/
657 void rpmteColorDS(rpmte te, rpmTag tag)
658 /*@modifies te @*/;
659 /*@=exportlocal@*/
660
669 int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg)
670 /*@globals internalState @*/
671 /*@modifies p, q, oh, internalState @*/;
672
673 #define RPMTE_CHAIN_END "CHAIN END"
680 int rpmtsiOc(rpmtsi tsi)
681 /*@*/;
682
688 /*@unused@*/ /*@null@*/
689 rpmtsi rpmtsiFree(/*@killref@*//*@null@*/ rpmtsi tsi)
690 /*@globals fileSystem @*/
691 /*@modifies fileSystem @*/;
692 #define rpmtsiFree(_tsi) \
693 ((rpmtsi)rpmioFreePoolItem((rpmioItem)(_tsi), __FUNCTION__, __FILE__, __LINE__))
694
700 /*@unused@*/ /*@only@*/
701 rpmtsi rpmtsiInit(rpmts ts)
702 /*@modifies ts @*/;
703
711 /*@unused@*/ /*@only@*/
712 rpmtsi XrpmtsiInit(rpmts ts,
713 const char * fn, unsigned int ln)
714 /*@modifies ts @*/;
715 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
716
723 /*@dependent@*/ /*@null@*/
724 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
725 /*@modifies tsi @*/;
726
727 #if defined(DYING)
728 #if !defined(SWIG)
729
731 static inline void rpmtePrintID(rpmte p)
732 /*@globals fileSystem @*/
733 /*@modifies fileSystem @*/
734 {
735 if (p != NULL) {
736 if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL);
737 if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL);
738 if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL);
739 if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL);
740 if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL);
741 if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL);
742 }
743 };
744
747 static inline void hdrPrintInstalled(Header h)
748 /*@globals fileSystem @*/
749 /*@modifies h, fileSystem @*/
750 {
751 const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]";
752 const char * errstr = "(unknown error)";
753 /*@-modobserver@*/
754 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
755 /*@=modobserver@*/
756
757 if (str == NULL)
758 fprintf(stderr, "error: %s\n", errstr);
759 else {
760 fprintf(stderr, "%s", str);
761 str = _free(str);
762 }
763 }
764
767 static inline void hdrPrintErased(Header h)
768 /*@globals fileSystem @*/
769 /*@modifies h, fileSystem @*/
770 {
771 const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]";
772 const char * errstr = "(unknown error)";
773 /*@-modobserver@*/
774 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
775 /*@=modobserver@*/
776 if (str == NULL)
777 fprintf(stderr, "error: %s\n", errstr);
778 else {
779 fprintf(stderr, "%s", str);
780 str = _free(str);
781 }
782 }
783 #endif
784 #endif
785
786 #ifdef __cplusplus
787 }
788 #endif
789
790 #endif /* H_RPMTE */