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@*/ /*@relnull@*/
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. */
103 uint_32 pkgFileSize; /*!< No. of bytes in package file (approx). */
105 /*@exposed@*/ /*@dependent@*/ /*@null@*/
106 fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
107 /*@owned@*/ /*@null@*/
108 rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
109 int nrelocs; /*!< (TR_ADDED) No. of relocations. */
110 /*@refcounted@*/ /*@null@*/
111 FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
113 /*@-fielduse@*/ /* LCL: confused by union? */
115 /*@exposed@*/ /*@dependent@*/ /*@null@*/
118 /*@exposed@*/ /*@dependent@*/ /*@null@*/
128 * Iterator across transaction elements, forward on install, backward on erase.
132 rpmts ts; /*!< transaction set. */
133 int reverse; /*!< reversed traversal? */
134 int ocsave; /*!< last returned iterator index. */
135 int oc; /*!< iterator index. */
138 #endif /* _RPMTE_INTERNAL */
145 * Destroy a transaction element.
146 * @param te transaction element
147 * @return NULL always
150 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
151 /*@globals fileSystem @*/
152 /*@modifies te, fileSystem @*/;
155 * Create a transaction element.
156 * @param ts transaction set
158 * @param type TR_ADDED/TR_REMOVED
159 * @param key (TR_ADDED) package retrieval key (e.g. file name)
160 * @param relocs (TR_ADDED) package file relocations
161 * @param dboffset (TR_REMOVED) rpmdb instance
162 * @param pkgKey associated added package (if any)
163 * @return new transaction element
165 /*@only@*/ /*@null@*/
166 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
167 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
168 /*@null@*/ rpmRelocation * relocs,
170 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
171 /*@globals fileSystem @*/
172 /*@modifies ts, h, fileSystem @*/;
175 * Retrieve type of transaction element.
176 * @param te transaction element
179 rpmElementType rpmteType(rpmte te)
183 * Retrieve name string of transaction element.
184 * @param te transaction element
185 * @return name string
188 extern const char * rpmteN(rpmte te)
192 * Retrieve epoch string of transaction element.
193 * @param te transaction element
194 * @return epoch string
196 /*@observer@*/ /*@null@*/
197 extern const char * rpmteE(rpmte te)
201 * Retrieve version string of transaction element.
202 * @param te transaction element
203 * @return version string
205 /*@observer@*/ /*@null@*/
206 extern const char * rpmteV(rpmte te)
210 * Retrieve release string of transaction element.
211 * @param te transaction element
212 * @return release string
214 /*@observer@*/ /*@null@*/
215 extern const char * rpmteR(rpmte te)
219 * Retrieve arch string of transaction element.
220 * @param te transaction element
221 * @return arch string
223 /*@observer@*/ /*@null@*/
224 extern const char * rpmteA(rpmte te)
228 * Retrieve os string of transaction element.
229 * @param te transaction element
232 /*@observer@*/ /*@null@*/
233 extern const char * rpmteO(rpmte te)
237 * Retrieve color bits of transaction element.
238 * @param te transaction element
241 uint_32 rpmteColor(rpmte te)
245 * Set color bits of transaction element.
246 * @param te transaction element
247 * @param color new color bits
248 * @return previous color bits
250 uint_32 rpmteSetColor(rpmte te, uint_32 color)
254 * Retrieve size in bytes of package file.
255 * @todo Signature header is estimated at 256b.
256 * @param te transaction element
257 * @return size in bytes of package file.
259 uint_32 rpmtePkgFileSize(rpmte te)
263 * Retrieve tsort tree depth of transaction element.
264 * @param te transaction element
267 int rpmteDepth(rpmte te)
271 * Set tsort tree depth of transaction element.
272 * @param te transaction element
273 * @param ndepth new depth
274 * @return previous depth
276 int rpmteSetDepth(rpmte te, int ndepth)
280 * Retrieve tsort no. of predecessors of transaction element.
281 * @param te transaction element
282 * @return no. of predecessors
284 int rpmteNpreds(rpmte te)
288 * Set tsort no. of predecessors of transaction element.
289 * @param te transaction element
290 * @param npreds new no. of predecessors
291 * @return previous no. of predecessors
293 int rpmteSetNpreds(rpmte te, int npreds)
297 * Retrieve tree index of transaction element.
298 * @param te transaction element
301 int rpmteTree(rpmte te)
305 * Set tree index of transaction element.
306 * @param te transaction element
307 * @param ntree new tree index
308 * @return previous tree index
310 int rpmteSetTree(rpmte te, int ntree)
314 * Retrieve parent transaction element.
315 * @param te transaction element
316 * @return parent transaction element
318 /*@observer@*/ /*@unused@*/
319 rpmte rpmteParent(rpmte te)
323 * Set parent transaction element.
324 * @param te transaction element
325 * @param pte new parent transaction element
326 * @return previous parent transaction element
329 rpmte rpmteSetParent(rpmte te, rpmte pte)
333 * Retrieve number of children of transaction element.
334 * @param te transaction element
337 int rpmteDegree(rpmte te)
341 * Set number of children of transaction element.
342 * @param te transaction element
343 * @param ndegree new number of children
344 * @return previous number of children
346 int rpmteSetDegree(rpmte te, int ndegree)
350 * Retrieve tsort info for transaction element.
351 * @param te transaction element
354 tsortInfo rpmteTSI(rpmte te)
358 * Destroy tsort info of transaction element.
359 * @param te transaction element
361 void rpmteFreeTSI(rpmte te)
365 * Initialize tsort info of transaction element.
366 * @param te transaction element
368 void rpmteNewTSI(rpmte te)
372 * Destroy dependency set info of transaction element.
373 * @param te transaction element
376 void rpmteCleanDS(rpmte te)
380 * Retrieve pkgKey of TR_ADDED transaction element.
381 * @param te transaction element
384 /*@exposed@*/ /*@dependent@*/ /*@null@*/
385 alKey rpmteAddedKey(rpmte te)
389 * Set pkgKey of TR_ADDED transaction element.
390 * @param te transaction element
391 * @param npkgKey new pkgKey
392 * @return previous pkgKey
394 /*@exposed@*/ /*@dependent@*/ /*@null@*/
395 alKey rpmteSetAddedKey(rpmte te,
396 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
400 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
401 * @param te transaction element
402 * @return dependent pkgKey
404 /*@exposed@*/ /*@dependent@*/ /*@null@*/
405 alKey rpmteDependsOnKey(rpmte te)
409 * Retrieve rpmdb instance of TR_REMOVED transaction element.
410 * @param te transaction element
411 * @return rpmdb instance
413 int rpmteDBOffset(rpmte te)
417 * Retrieve name-version-release string from transaction element.
418 * @param te transaction element
419 * @return name-version-release string
422 extern const char * rpmteNEVR(rpmte te)
426 * Retrieve name-version-release.arch string from transaction element.
427 * @param te transaction element
428 * @return name-version-release.arch string
432 extern const char * rpmteNEVRA(rpmte te)
437 * Retrieve file handle from transaction element.
438 * @param te transaction element
439 * @return file handle
441 FD_t rpmteFd(rpmte te)
445 * Retrieve key from transaction element.
446 * @param te transaction element
450 fnpyKey rpmteKey(rpmte te)
454 * Retrieve dependency tag set from transaction element.
455 * @param te transaction element
456 * @param tag dependency tag
457 * @return dependency tag set
459 rpmds rpmteDS(rpmte te, rpmTag tag)
463 * Retrieve file info tag set from transaction element.
464 * @param te transaction element
465 * @param tag file info tag (RPMTAG_BASENAMES)
466 * @return file info tag set
468 rpmfi rpmteFI(rpmte te, rpmTag tag)
472 * Calculate transaction element dependency colors/refs from file info.
473 * @param te transaction element
474 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
477 void rpmteColorDS(rpmte te, rpmTag tag)
482 * Return transaction element index.
483 * @param tsi transaction element iterator
484 * @return transaction element index
486 int rpmtsiOc(rpmtsi tsi)
490 * Destroy transaction element iterator.
491 * @param tsi transaction element iterator
492 * @return NULL always
494 /*@unused@*/ /*@null@*/
495 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
496 /*@globals fileSystem @*/
497 /*@modifies fileSystem @*/;
500 * Destroy transaction element iterator.
501 * @param tsi transaction element iterator
504 * @return NULL always
507 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
508 const char * fn, unsigned int ln)
509 /*@globals fileSystem @*/
510 /*@modifies fileSystem @*/;
511 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
514 * Create transaction element iterator.
515 * @param ts transaction set
516 * @return transaction element iterator
518 /*@unused@*/ /*@only@*/
519 rpmtsi rpmtsiInit(rpmts ts)
523 * Create transaction element iterator.
524 * @param ts transaction set
527 * @return transaction element iterator
529 /*@unused@*/ /*@only@*/
530 rpmtsi XrpmtsiInit(rpmts ts,
531 const char * fn, unsigned int ln)
533 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
536 * Return next transaction element of type.
537 * @param tsi transaction element iterator
538 * @param type transaction element type selector (0 for any)
539 * @return next transaction element of type, NULL on termination
541 /*@dependent@*/ /*@null@*/
542 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)