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 multiLib; /*!< (TR_ADDED) MULTILIB */
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)
150 * Create a transaction element.
151 * @param ts transaction set
153 * @param type TR_ADDED/TR_REMOVED
154 * @param key (TR_ADDED) package retrieval key (e.g. file name)
155 * @param relocs (TR_ADDED) package file relocations
156 * @param dboffset (TR_REMOVED) rpmdb instance
157 * @param pkgKey associated added package (if any)
158 * @return new transaction element
160 /*@only@*/ /*@null@*/
161 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
162 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
163 /*@null@*/ rpmRelocation * relocs,
165 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
166 /*@modifies ts, h @*/;
169 * Retrieve type of transaction element.
170 * @param te transaction element
173 rpmElementType rpmteType(rpmte te)
177 * Retrieve name string of transaction element.
178 * @param te transaction element
179 * @return name string
182 const char * rpmteN(rpmte te)
186 * Retrieve epoch string of transaction element.
187 * @param te transaction element
188 * @return epoch string
190 /*@observer@*/ /*@null@*/
191 const char * rpmteE(rpmte te)
195 * Retrieve version string of transaction element.
196 * @param te transaction element
197 * @return version string
199 /*@observer@*/ /*@null@*/
200 const char * rpmteV(rpmte te)
204 * Retrieve release string of transaction element.
205 * @param te transaction element
206 * @return release string
208 /*@observer@*/ /*@null@*/
209 const char * rpmteR(rpmte te)
213 * Retrieve arch string of transaction element.
214 * @param te transaction element
215 * @return arch string
217 /*@observer@*/ /*@null@*/
218 const char * rpmteA(rpmte te)
222 * Retrieve os string of transaction element.
223 * @param te transaction element
226 /*@observer@*/ /*@null@*/
227 const char * rpmteO(rpmte te)
231 * Retrieve multlib flags of transaction element.
232 * @param te transaction element
233 * @return multilib flags
235 int rpmteMultiLib(rpmte te)
239 * Set multlib flags of transaction element.
240 * @param te transaction element
241 * @param nmultiLib new multilib flags
242 * @return previous multilib flags
244 int rpmteSetMultiLib(rpmte te, int nmultiLib)
248 * Retrieve tsort tree depth of transaction element.
249 * @param te transaction element
252 int rpmteDepth(rpmte te)
256 * Set tsort tree depth of transaction element.
257 * @param te transaction element
258 * @param ndepth new depth
259 * @return previous depth
261 int rpmteSetDepth(rpmte te, int ndepth)
265 * Retrieve tsort no. of predecessors of transaction element.
266 * @param te transaction element
267 * @return no. of predecessors
269 int rpmteNpreds(rpmte te)
273 * Set tsort no. of predecessors of transaction element.
274 * @param te transaction element
275 * @param npreds new no. of predecessors
276 * @return previous no. of predecessors
278 int rpmteSetNpreds(rpmte te, int npreds)
282 * Retrieve tree index of transaction element.
283 * @param te transaction element
286 int rpmteTree(rpmte te)
290 * Set tree index of transaction element.
291 * @param te transaction element
292 * @param ntree new tree index
293 * @return previous tree index
295 int rpmteSetTree(rpmte te, int ntree)
299 * Retrieve parent transaction element.
300 * @param te transaction element
301 * @return parent transaction element
303 /*@observer@*/ /*@unused@*/
304 rpmte rpmteParent(rpmte te)
308 * Set parent transaction element.
309 * @param te transaction element
310 * @param pte new parent transaction element
311 * @return previous parent transaction element
313 rpmte rpmteSetParent(rpmte te, rpmte pte)
317 * Retrieve number of children of transaction element.
318 * @param te transaction element
321 int rpmteDegree(rpmte te)
325 * Set number of children of transaction element.
326 * @param te transaction element
327 * @param ndegree new number of children
328 * @return previous number of children
330 int rpmteSetDegree(rpmte te, int ndegree)
334 * Retrieve tsort info for transaction element.
335 * @param te transaction element
338 tsortInfo rpmteTSI(rpmte te)
342 * Destroy tsort info of transaction element.
343 * @param te transaction element
345 void rpmteFreeTSI(rpmte te)
349 * Initialize tsort info of transaction element.
350 * @param te transaction element
352 void rpmteNewTSI(rpmte te)
356 * Destroy dependency set info of transaction element.
357 * @param te transaction element
360 void rpmteCleanDS(rpmte te)
364 * Retrieve pkgKey of TR_ADDED transaction element.
365 * @param te transaction element
368 /*@exposed@*/ /*@dependent@*/ /*@null@*/
369 alKey rpmteAddedKey(rpmte te)
373 * Set pkgKey of TR_ADDED transaction element.
374 * @param te transaction element
375 * @param npkgKey new pkgKey
376 * @return previous pkgKey
378 /*@exposed@*/ /*@dependent@*/ /*@null@*/
379 alKey rpmteSetAddedKey(rpmte te,
380 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
384 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
385 * @param te transaction element
386 * @return dependent pkgKey
388 /*@exposed@*/ /*@dependent@*/ /*@null@*/
389 alKey rpmteDependsOnKey(rpmte te)
393 * Retrieve rpmdb instance of TR_REMOVED transaction element.
394 * @param te transaction element
395 * @return rpmdb instance
397 int rpmteDBOffset(rpmte te)
401 * Retrieve name-version-release string from transaction element.
402 * @param te transaction element
403 * @return name-version-release string
406 const char * rpmteNEVR(rpmte te)
410 * Retrieve file handle from transaction element.
411 * @param te transaction element
412 * @return file handle
414 FD_t rpmteFd(rpmte te)
418 * Retrieve key from transaction element.
419 * @param te transaction element
423 fnpyKey rpmteKey(rpmte te)
427 * Retrieve dependency tag set from transaction element.
428 * @param te transaction element
429 * @param tag dependency tag
430 * @return dependency tag set
432 rpmds rpmteDS(rpmte te, rpmTag tag)
436 * Retrieve file info tag set from transaction element.
437 * @param te transaction element
438 * @param tag file info tag
439 * @return file info tag set
441 rpmfi rpmteFI(rpmte te, rpmTag tag)
445 * Return transaction element index.
446 * @param tsi transaction element iterator
447 * @return transaction element index
449 int rpmtsiOc(rpmtsi tsi)
453 * Destroy transaction element iterator.
454 * @param tsi transaction element iterator
455 * @return NULL always
457 /*@unused@*/ /*@null@*/
458 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
462 * Destroy transaction element iterator.
463 * @param tsi transaction element iterator
466 * @return NULL always
469 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
470 const char * fn, unsigned int ln)
472 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
475 * Create transaction element iterator.
476 * @param ts transaction set
477 * @return transaction element iterator
479 /*@unused@*/ /*@only@*/
480 rpmtsi rpmtsiInit(rpmts ts)
484 * Create transaction element iterator.
485 * @param ts transaction set
488 * @return transaction element iterator
490 /*@unused@*/ /*@only@*/
491 rpmtsi XrpmtsiInit(rpmts ts,
492 const char * fn, unsigned int ln)
494 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
497 * Return next transaction element of type.
498 * @param tsi transaction element iterator
499 * @param type transaction element type selector (0 for any)
500 * @return next transaction element of type, NULL on termination
502 /*@dependent@*/ /*@null@*/
503 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)