4 /** \ingroup rpmts rpmte
6 * Structures used for an "rpmte" transaction element.
13 extern int _rpmte_debug;
17 * Transaction element ordering chain linkage.
19 typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
22 * Transaction element iterator.
24 typedef /*@abstract@*/ struct rpmtsi_s * rpmtsi;
27 * Transaction element type.
29 typedef enum rpmElementType_e {
30 TR_ADDED = (1 << 0), /*!< Package will be installed. */
31 TR_REMOVED = (1 << 1) /*!< Package will be removed. */
34 #if defined(_RPMTE_INTERNAL)
36 * Dependncy ordering information.
38 /*@-fielduse@*/ /* LCL: confused by union? */
42 /*@exposed@*/ /*@dependent@*/ /*@null@*/
45 #define tsi_count tsi_u.count
46 #define tsi_suc tsi_u.suc
47 /*@owned@*/ /*@null@*/
48 struct tsortInfo_s * tsi_next;
49 /*@exposed@*/ /*@dependent@*/ /*@null@*/
57 * A single package instance to be installed/removed atomically.
60 rpmElementType type; /*!< Package disposition (installed/removed). */
62 /*@refcounted@*/ /*@null@*/
63 Header h; /*!< Package header. */
65 const char * NEVR; /*!< Package name-version-release. */
67 const char * NEVRA; /*!< Package name-version-release.arch. */
69 const char * name; /*!< Name: */
72 /*@dependent@*/ /*@null@*/
73 char * version; /*!< Version: */
74 /*@dependent@*/ /*@null@*/
75 char * release; /*!< Release: */
77 const char * arch; /*!< Architecture hint. */
79 const char * os; /*!< Operating system hint. */
81 rpmte parent; /*!< Parent transaction element. */
82 int degree; /*!< No. of immediate children. */
83 int depth; /*!< Max. depth in dependency tree. */
84 int npreds; /*!< No. of predecessors. */
85 int tree; /*!< Tree index. */
87 tsortInfo tsi; /*!< Dependency ordering chains. */
89 /*@refcounted@*/ /*@null@*/
90 rpmds this; /*!< This package's provided NEVR. */
91 /*@refcounted@*/ /*@null@*/
92 rpmds provides; /*!< Provides: dependencies. */
93 /*@refcounted@*/ /*@null@*/
94 rpmds requires; /*!< Requires: dependencies. */
95 /*@refcounted@*/ /*@null@*/
96 rpmds conflicts; /*!< Conflicts: dependencies. */
97 /*@refcounted@*/ /*@null@*/
98 rpmds obsoletes; /*!< Obsoletes: dependencies. */
99 /*@refcounted@*/ /*@null@*/
100 rpmfi fi; /*!< File information. */
102 uint_32 color; /*!< Color bit(s) from package dependencies */
104 /*@exposed@*/ /*@dependent@*/ /*@null@*/
105 fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
106 /*@owned@*/ /*@null@*/
107 rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
108 /*@refcounted@*/ /*@null@*/
109 FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
111 /*@-fielduse@*/ /* LCL: confused by union? */
113 /*@exposed@*/ /*@dependent@*/ /*@null@*/
116 /*@exposed@*/ /*@dependent@*/ /*@null@*/
126 * Iterator across transaction elements, forward on install, backward on erase.
130 rpmts ts; /*!< transaction set. */
131 int reverse; /*!< reversed traversal? */
132 int ocsave; /*!< last returned iterator index. */
133 int oc; /*!< iterator index. */
136 #endif /* _RPMTE_INTERNAL */
143 * Destroy a transaction element.
144 * @param te transaction element
145 * @return NULL always
148 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
149 /*@globals fileSystem @*/
150 /*@modifies te, fileSystem @*/;
153 * Create a transaction element.
154 * @param ts transaction set
156 * @param type TR_ADDED/TR_REMOVED
157 * @param key (TR_ADDED) package retrieval key (e.g. file name)
158 * @param relocs (TR_ADDED) package file relocations
159 * @param dboffset (TR_REMOVED) rpmdb instance
160 * @param pkgKey associated added package (if any)
161 * @return new transaction element
163 /*@only@*/ /*@null@*/
164 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
165 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
166 /*@null@*/ rpmRelocation * relocs,
168 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
169 /*@globals fileSystem @*/
170 /*@modifies ts, h, fileSystem @*/;
173 * Retrieve type of transaction element.
174 * @param te transaction element
177 rpmElementType rpmteType(rpmte te)
181 * Retrieve name string of transaction element.
182 * @param te transaction element
183 * @return name string
186 extern const char * rpmteN(rpmte te)
190 * Retrieve epoch string of transaction element.
191 * @param te transaction element
192 * @return epoch string
194 /*@observer@*/ /*@null@*/
195 extern const char * rpmteE(rpmte te)
199 * Retrieve version string of transaction element.
200 * @param te transaction element
201 * @return version string
203 /*@observer@*/ /*@null@*/
204 extern const char * rpmteV(rpmte te)
208 * Retrieve release string of transaction element.
209 * @param te transaction element
210 * @return release string
212 /*@observer@*/ /*@null@*/
213 extern const char * rpmteR(rpmte te)
217 * Retrieve arch string of transaction element.
218 * @param te transaction element
219 * @return arch string
221 /*@observer@*/ /*@null@*/
222 extern const char * rpmteA(rpmte te)
226 * Retrieve os string of transaction element.
227 * @param te transaction element
230 /*@observer@*/ /*@null@*/
231 extern const char * rpmteO(rpmte te)
235 * Retrieve color bits of transaction element.
236 * @param te transaction element
239 uint_32 rpmteColor(rpmte te)
243 * Set color bits of transaction element.
244 * @param te transaction element
245 * @param color new color bits
246 * @return previous color bits
248 uint_32 rpmteSetColor(rpmte te, uint_32 color)
252 * Retrieve tsort tree depth of transaction element.
253 * @param te transaction element
256 int rpmteDepth(rpmte te)
260 * Set tsort tree depth of transaction element.
261 * @param te transaction element
262 * @param ndepth new depth
263 * @return previous depth
265 int rpmteSetDepth(rpmte te, int ndepth)
269 * Retrieve tsort no. of predecessors of transaction element.
270 * @param te transaction element
271 * @return no. of predecessors
273 int rpmteNpreds(rpmte te)
277 * Set tsort no. of predecessors of transaction element.
278 * @param te transaction element
279 * @param npreds new no. of predecessors
280 * @return previous no. of predecessors
282 int rpmteSetNpreds(rpmte te, int npreds)
286 * Retrieve tree index of transaction element.
287 * @param te transaction element
290 int rpmteTree(rpmte te)
294 * Set tree index of transaction element.
295 * @param te transaction element
296 * @param ntree new tree index
297 * @return previous tree index
299 int rpmteSetTree(rpmte te, int ntree)
303 * Retrieve parent transaction element.
304 * @param te transaction element
305 * @return parent transaction element
307 /*@observer@*/ /*@unused@*/
308 rpmte rpmteParent(rpmte te)
312 * Set parent transaction element.
313 * @param te transaction element
314 * @param pte new parent transaction element
315 * @return previous parent transaction element
317 rpmte rpmteSetParent(rpmte te, rpmte pte)
321 * Retrieve number of children of transaction element.
322 * @param te transaction element
325 int rpmteDegree(rpmte te)
329 * Set number of children of transaction element.
330 * @param te transaction element
331 * @param ndegree new number of children
332 * @return previous number of children
334 int rpmteSetDegree(rpmte te, int ndegree)
338 * Retrieve tsort info for transaction element.
339 * @param te transaction element
342 tsortInfo rpmteTSI(rpmte te)
346 * Destroy tsort info of transaction element.
347 * @param te transaction element
349 void rpmteFreeTSI(rpmte te)
353 * Initialize tsort info of transaction element.
354 * @param te transaction element
356 void rpmteNewTSI(rpmte te)
360 * Destroy dependency set info of transaction element.
361 * @param te transaction element
364 void rpmteCleanDS(rpmte te)
368 * Retrieve pkgKey of TR_ADDED transaction element.
369 * @param te transaction element
372 /*@exposed@*/ /*@dependent@*/ /*@null@*/
373 alKey rpmteAddedKey(rpmte te)
377 * Set pkgKey of TR_ADDED transaction element.
378 * @param te transaction element
379 * @param npkgKey new pkgKey
380 * @return previous pkgKey
382 /*@exposed@*/ /*@dependent@*/ /*@null@*/
383 alKey rpmteSetAddedKey(rpmte te,
384 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
388 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
389 * @param te transaction element
390 * @return dependent pkgKey
392 /*@exposed@*/ /*@dependent@*/ /*@null@*/
393 alKey rpmteDependsOnKey(rpmte te)
397 * Retrieve rpmdb instance of TR_REMOVED transaction element.
398 * @param te transaction element
399 * @return rpmdb instance
401 int rpmteDBOffset(rpmte te)
405 * Retrieve name-version-release string from transaction element.
406 * @param te transaction element
407 * @return name-version-release string
410 extern const char * rpmteNEVR(rpmte te)
414 * Retrieve name-version-release.arch string from transaction element.
415 * @param te transaction element
416 * @return name-version-release.arch string
419 extern const char * rpmteNEVRA(rpmte te)
423 * Retrieve file handle from transaction element.
424 * @param te transaction element
425 * @return file handle
427 FD_t rpmteFd(rpmte te)
431 * Retrieve key from transaction element.
432 * @param te transaction element
436 fnpyKey rpmteKey(rpmte te)
440 * Retrieve dependency tag set from transaction element.
441 * @param te transaction element
442 * @param tag dependency tag
443 * @return dependency tag set
445 rpmds rpmteDS(rpmte te, rpmTag tag)
449 * Retrieve file info tag set from transaction element.
450 * @param te transaction element
451 * @param tag file info tag (RPMTAG_BASENAMES)
452 * @return file info tag set
454 rpmfi rpmteFI(rpmte te, rpmTag tag)
458 * Calculate transaction element dependency colors/refs from file info.
459 * @param te transaction element
460 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
463 void rpmteColorDS(rpmte te, rpmTag tag)
468 * Return transaction element index.
469 * @param tsi transaction element iterator
470 * @return transaction element index
472 int rpmtsiOc(rpmtsi tsi)
476 * Destroy transaction element iterator.
477 * @param tsi transaction element iterator
478 * @return NULL always
480 /*@unused@*/ /*@null@*/
481 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
482 /*@globals fileSystem @*/
483 /*@modifies fileSystem @*/;
486 * Destroy transaction element iterator.
487 * @param tsi transaction element iterator
490 * @return NULL always
493 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
494 const char * fn, unsigned int ln)
495 /*@globals fileSystem @*/
496 /*@modifies fileSystem @*/;
497 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
500 * Create transaction element iterator.
501 * @param ts transaction set
502 * @return transaction element iterator
504 /*@unused@*/ /*@only@*/
505 rpmtsi rpmtsiInit(rpmts ts)
509 * Create transaction element iterator.
510 * @param ts transaction set
513 * @return transaction element iterator
515 /*@unused@*/ /*@only@*/
516 rpmtsi XrpmtsiInit(rpmts ts,
517 const char * fn, unsigned int ln)
519 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
522 * Return next transaction element of type.
523 * @param tsi transaction element iterator
524 * @param type transaction element type selector (0 for any)
525 * @return next transaction element of type, NULL on termination
527 /*@dependent@*/ /*@null@*/
528 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)