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 * name; /*!< Name: */
70 /*@dependent@*/ /*@null@*/
71 char * version; /*!< Version: */
72 /*@dependent@*/ /*@null@*/
73 char * release; /*!< Release: */
75 const char * arch; /*!< Architecture hint. */
77 const char * os; /*!< Operating system hint. */
79 rpmte parent; /*!< Parent transaction element. */
80 int degree; /*!< No. of immediate children. */
81 int depth; /*!< Max. depth in dependency tree. */
82 int npreds; /*!< No. of predecessors. */
83 int tree; /*!< Tree index. */
85 tsortInfo tsi; /*!< Dependency ordering chains. */
87 /*@refcounted@*/ /*@null@*/
88 rpmds this; /*!< This package's provided NEVR. */
89 /*@refcounted@*/ /*@null@*/
90 rpmds provides; /*!< Provides: dependencies. */
91 /*@refcounted@*/ /*@null@*/
92 rpmds requires; /*!< Requires: dependencies. */
93 /*@refcounted@*/ /*@null@*/
94 rpmds conflicts; /*!< Conflicts: dependencies. */
95 /*@refcounted@*/ /*@null@*/
96 rpmds obsoletes; /*!< Obsoletes: dependencies. */
97 /*@refcounted@*/ /*@null@*/
98 rpmfi fi; /*!< File information. */
100 uint_32 color; /*!< Color bit(s) from package dependencies */
102 /*@exposed@*/ /*@dependent@*/ /*@null@*/
103 fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
104 /*@owned@*/ /*@null@*/
105 rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
106 /*@refcounted@*/ /*@null@*/
107 FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
109 /*@-fielduse@*/ /* LCL: confused by union? */
111 /*@exposed@*/ /*@dependent@*/ /*@null@*/
114 /*@exposed@*/ /*@dependent@*/ /*@null@*/
124 * Iterator across transaction elements, forward on install, backward on erase.
128 rpmts ts; /*!< transaction set. */
129 int reverse; /*!< reversed traversal? */
130 int ocsave; /*!< last returned iterator index. */
131 int oc; /*!< iterator index. */
134 #endif /* _RPMTE_INTERNAL */
141 * Destroy a transaction element.
142 * @param te transaction element
143 * @return NULL always
146 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
147 /*@globals fileSystem @*/
148 /*@modifies te, fileSystem @*/;
151 * Create a transaction element.
152 * @param ts transaction set
154 * @param type TR_ADDED/TR_REMOVED
155 * @param key (TR_ADDED) package retrieval key (e.g. file name)
156 * @param relocs (TR_ADDED) package file relocations
157 * @param dboffset (TR_REMOVED) rpmdb instance
158 * @param pkgKey associated added package (if any)
159 * @return new transaction element
161 /*@only@*/ /*@null@*/
162 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
163 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
164 /*@null@*/ rpmRelocation * relocs,
166 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
167 /*@globals fileSystem @*/
168 /*@modifies ts, h, fileSystem @*/;
171 * Retrieve type of transaction element.
172 * @param te transaction element
175 rpmElementType rpmteType(rpmte te)
179 * Retrieve name string of transaction element.
180 * @param te transaction element
181 * @return name string
184 extern const char * rpmteN(rpmte te)
188 * Retrieve epoch string of transaction element.
189 * @param te transaction element
190 * @return epoch string
192 /*@observer@*/ /*@null@*/
193 extern const char * rpmteE(rpmte te)
197 * Retrieve version string of transaction element.
198 * @param te transaction element
199 * @return version string
201 /*@observer@*/ /*@null@*/
202 extern const char * rpmteV(rpmte te)
206 * Retrieve release string of transaction element.
207 * @param te transaction element
208 * @return release string
210 /*@observer@*/ /*@null@*/
211 extern const char * rpmteR(rpmte te)
215 * Retrieve arch string of transaction element.
216 * @param te transaction element
217 * @return arch string
219 /*@observer@*/ /*@null@*/
220 extern const char * rpmteA(rpmte te)
224 * Retrieve os string of transaction element.
225 * @param te transaction element
228 /*@observer@*/ /*@null@*/
229 extern const char * rpmteO(rpmte te)
233 * Retrieve color bits of transaction element.
234 * @param te transaction element
237 uint_32 rpmteColor(rpmte te)
241 * Set color bits of transaction element.
242 * @param te transaction element
243 * @param color new color bits
244 * @return previous color bits
246 uint_32 rpmteSetColor(rpmte te, uint_32 color)
250 * Retrieve tsort tree depth of transaction element.
251 * @param te transaction element
254 int rpmteDepth(rpmte te)
258 * Set tsort tree depth of transaction element.
259 * @param te transaction element
260 * @param ndepth new depth
261 * @return previous depth
263 int rpmteSetDepth(rpmte te, int ndepth)
267 * Retrieve tsort no. of predecessors of transaction element.
268 * @param te transaction element
269 * @return no. of predecessors
271 int rpmteNpreds(rpmte te)
275 * Set tsort no. of predecessors of transaction element.
276 * @param te transaction element
277 * @param npreds new no. of predecessors
278 * @return previous no. of predecessors
280 int rpmteSetNpreds(rpmte te, int npreds)
284 * Retrieve tree index of transaction element.
285 * @param te transaction element
288 int rpmteTree(rpmte te)
292 * Set tree index of transaction element.
293 * @param te transaction element
294 * @param ntree new tree index
295 * @return previous tree index
297 int rpmteSetTree(rpmte te, int ntree)
301 * Retrieve parent transaction element.
302 * @param te transaction element
303 * @return parent transaction element
305 /*@observer@*/ /*@unused@*/
306 rpmte rpmteParent(rpmte te)
310 * Set parent transaction element.
311 * @param te transaction element
312 * @param pte new parent transaction element
313 * @return previous parent transaction element
315 rpmte rpmteSetParent(rpmte te, rpmte pte)
319 * Retrieve number of children of transaction element.
320 * @param te transaction element
323 int rpmteDegree(rpmte te)
327 * Set number of children of transaction element.
328 * @param te transaction element
329 * @param ndegree new number of children
330 * @return previous number of children
332 int rpmteSetDegree(rpmte te, int ndegree)
336 * Retrieve tsort info for transaction element.
337 * @param te transaction element
340 tsortInfo rpmteTSI(rpmte te)
344 * Destroy tsort info of transaction element.
345 * @param te transaction element
347 void rpmteFreeTSI(rpmte te)
351 * Initialize tsort info of transaction element.
352 * @param te transaction element
354 void rpmteNewTSI(rpmte te)
358 * Destroy dependency set info of transaction element.
359 * @param te transaction element
362 void rpmteCleanDS(rpmte te)
366 * Retrieve pkgKey of TR_ADDED transaction element.
367 * @param te transaction element
370 /*@exposed@*/ /*@dependent@*/ /*@null@*/
371 alKey rpmteAddedKey(rpmte te)
375 * Set pkgKey of TR_ADDED transaction element.
376 * @param te transaction element
377 * @param npkgKey new pkgKey
378 * @return previous pkgKey
380 /*@exposed@*/ /*@dependent@*/ /*@null@*/
381 alKey rpmteSetAddedKey(rpmte te,
382 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
386 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
387 * @param te transaction element
388 * @return dependent pkgKey
390 /*@exposed@*/ /*@dependent@*/ /*@null@*/
391 alKey rpmteDependsOnKey(rpmte te)
395 * Retrieve rpmdb instance of TR_REMOVED transaction element.
396 * @param te transaction element
397 * @return rpmdb instance
399 int rpmteDBOffset(rpmte te)
403 * Retrieve name-version-release string from transaction element.
404 * @param te transaction element
405 * @return name-version-release string
408 extern const char * rpmteNEVR(rpmte te)
412 * Retrieve file handle from transaction element.
413 * @param te transaction element
414 * @return file handle
416 FD_t rpmteFd(rpmte te)
420 * Retrieve key from transaction element.
421 * @param te transaction element
425 fnpyKey rpmteKey(rpmte te)
429 * Retrieve dependency tag set from transaction element.
430 * @param te transaction element
431 * @param tag dependency tag
432 * @return dependency tag set
434 rpmds rpmteDS(rpmte te, rpmTag tag)
438 * Retrieve file info tag set from transaction element.
439 * @param te transaction element
440 * @param tag file info tag (RPMTAG_BASENAMES)
441 * @return file info tag set
443 rpmfi rpmteFI(rpmte te, rpmTag tag)
447 * Calculate transaction element dependency colors/refs from file info.
448 * @param te transaction element
449 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
452 void rpmteColorDS(rpmte te, rpmTag tag)
457 * Return transaction element index.
458 * @param tsi transaction element iterator
459 * @return transaction element index
461 int rpmtsiOc(rpmtsi tsi)
465 * Destroy transaction element iterator.
466 * @param tsi transaction element iterator
467 * @return NULL always
469 /*@unused@*/ /*@null@*/
470 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
471 /*@globals fileSystem @*/
472 /*@modifies fileSystem @*/;
475 * Destroy transaction element iterator.
476 * @param tsi transaction element iterator
479 * @return NULL always
482 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
483 const char * fn, unsigned int ln)
484 /*@globals fileSystem @*/
485 /*@modifies fileSystem @*/;
486 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
489 * Create transaction element iterator.
490 * @param ts transaction set
491 * @return transaction element iterator
493 /*@unused@*/ /*@only@*/
494 rpmtsi rpmtsiInit(rpmts ts)
498 * Create transaction element iterator.
499 * @param ts transaction set
502 * @return transaction element iterator
504 /*@unused@*/ /*@only@*/
505 rpmtsi XrpmtsiInit(rpmts ts,
506 const char * fn, unsigned int ln)
508 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
511 * Return next transaction element of type.
512 * @param tsi transaction element iterator
513 * @param type transaction element type selector (0 for any)
514 * @return next transaction element of type, NULL on termination
516 /*@dependent@*/ /*@null@*/
517 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)