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 /*@refcounted@*/ /*@null@*/
110 FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
112 /*@-fielduse@*/ /* LCL: confused by union? */
114 /*@exposed@*/ /*@dependent@*/ /*@null@*/
117 /*@exposed@*/ /*@dependent@*/ /*@null@*/
127 * Iterator across transaction elements, forward on install, backward on erase.
131 rpmts ts; /*!< transaction set. */
132 int reverse; /*!< reversed traversal? */
133 int ocsave; /*!< last returned iterator index. */
134 int oc; /*!< iterator index. */
137 #endif /* _RPMTE_INTERNAL */
144 * Destroy a transaction element.
145 * @param te transaction element
146 * @return NULL always
149 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
150 /*@globals fileSystem @*/
151 /*@modifies te, fileSystem @*/;
154 * Create a transaction element.
155 * @param ts transaction set
157 * @param type TR_ADDED/TR_REMOVED
158 * @param key (TR_ADDED) package retrieval key (e.g. file name)
159 * @param relocs (TR_ADDED) package file relocations
160 * @param dboffset (TR_REMOVED) rpmdb instance
161 * @param pkgKey associated added package (if any)
162 * @return new transaction element
164 /*@only@*/ /*@null@*/
165 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
166 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
167 /*@null@*/ rpmRelocation * relocs,
169 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
170 /*@globals fileSystem @*/
171 /*@modifies ts, h, fileSystem @*/;
174 * Retrieve type of transaction element.
175 * @param te transaction element
178 rpmElementType rpmteType(rpmte te)
182 * Retrieve name string of transaction element.
183 * @param te transaction element
184 * @return name string
187 extern const char * rpmteN(rpmte te)
191 * Retrieve epoch string of transaction element.
192 * @param te transaction element
193 * @return epoch string
195 /*@observer@*/ /*@null@*/
196 extern const char * rpmteE(rpmte te)
200 * Retrieve version string of transaction element.
201 * @param te transaction element
202 * @return version string
204 /*@observer@*/ /*@null@*/
205 extern const char * rpmteV(rpmte te)
209 * Retrieve release string of transaction element.
210 * @param te transaction element
211 * @return release string
213 /*@observer@*/ /*@null@*/
214 extern const char * rpmteR(rpmte te)
218 * Retrieve arch string of transaction element.
219 * @param te transaction element
220 * @return arch string
222 /*@observer@*/ /*@null@*/
223 extern const char * rpmteA(rpmte te)
227 * Retrieve os string of transaction element.
228 * @param te transaction element
231 /*@observer@*/ /*@null@*/
232 extern const char * rpmteO(rpmte te)
236 * Retrieve color bits of transaction element.
237 * @param te transaction element
240 uint_32 rpmteColor(rpmte te)
244 * Set color bits of transaction element.
245 * @param te transaction element
246 * @param color new color bits
247 * @return previous color bits
249 uint_32 rpmteSetColor(rpmte te, uint_32 color)
253 * Retrieve size in bytes of package file.
254 * @todo Signature header is estimated at 256b.
255 * @param te transaction element
256 * @return size in bytes of package file.
258 uint_32 rpmtePkgFileSize(rpmte te)
262 * Retrieve tsort tree depth of transaction element.
263 * @param te transaction element
266 int rpmteDepth(rpmte te)
270 * Set tsort tree depth of transaction element.
271 * @param te transaction element
272 * @param ndepth new depth
273 * @return previous depth
275 int rpmteSetDepth(rpmte te, int ndepth)
279 * Retrieve tsort no. of predecessors of transaction element.
280 * @param te transaction element
281 * @return no. of predecessors
283 int rpmteNpreds(rpmte te)
287 * Set tsort no. of predecessors of transaction element.
288 * @param te transaction element
289 * @param npreds new no. of predecessors
290 * @return previous no. of predecessors
292 int rpmteSetNpreds(rpmte te, int npreds)
296 * Retrieve tree index of transaction element.
297 * @param te transaction element
300 int rpmteTree(rpmte te)
304 * Set tree index of transaction element.
305 * @param te transaction element
306 * @param ntree new tree index
307 * @return previous tree index
309 int rpmteSetTree(rpmte te, int ntree)
313 * Retrieve parent transaction element.
314 * @param te transaction element
315 * @return parent transaction element
317 /*@observer@*/ /*@unused@*/
318 rpmte rpmteParent(rpmte te)
322 * Set parent transaction element.
323 * @param te transaction element
324 * @param pte new parent transaction element
325 * @return previous parent transaction element
328 rpmte rpmteSetParent(rpmte te, rpmte pte)
332 * Retrieve number of children of transaction element.
333 * @param te transaction element
336 int rpmteDegree(rpmte te)
340 * Set number of children of transaction element.
341 * @param te transaction element
342 * @param ndegree new number of children
343 * @return previous number of children
345 int rpmteSetDegree(rpmte te, int ndegree)
349 * Retrieve tsort info for transaction element.
350 * @param te transaction element
353 tsortInfo rpmteTSI(rpmte te)
357 * Destroy tsort info of transaction element.
358 * @param te transaction element
360 void rpmteFreeTSI(rpmte te)
364 * Initialize tsort info of transaction element.
365 * @param te transaction element
367 void rpmteNewTSI(rpmte te)
371 * Destroy dependency set info of transaction element.
372 * @param te transaction element
375 void rpmteCleanDS(rpmte te)
379 * Retrieve pkgKey of TR_ADDED transaction element.
380 * @param te transaction element
383 /*@exposed@*/ /*@dependent@*/ /*@null@*/
384 alKey rpmteAddedKey(rpmte te)
388 * Set pkgKey of TR_ADDED transaction element.
389 * @param te transaction element
390 * @param npkgKey new pkgKey
391 * @return previous pkgKey
393 /*@exposed@*/ /*@dependent@*/ /*@null@*/
394 alKey rpmteSetAddedKey(rpmte te,
395 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
399 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
400 * @param te transaction element
401 * @return dependent pkgKey
403 /*@exposed@*/ /*@dependent@*/ /*@null@*/
404 alKey rpmteDependsOnKey(rpmte te)
408 * Retrieve rpmdb instance of TR_REMOVED transaction element.
409 * @param te transaction element
410 * @return rpmdb instance
412 int rpmteDBOffset(rpmte te)
416 * Retrieve name-version-release string from transaction element.
417 * @param te transaction element
418 * @return name-version-release string
421 extern const char * rpmteNEVR(rpmte te)
425 * Retrieve name-version-release.arch string from transaction element.
426 * @param te transaction element
427 * @return name-version-release.arch string
431 extern const char * rpmteNEVRA(rpmte te)
436 * Retrieve file handle from transaction element.
437 * @param te transaction element
438 * @return file handle
440 FD_t rpmteFd(rpmte te)
444 * Retrieve key from transaction element.
445 * @param te transaction element
449 fnpyKey rpmteKey(rpmte te)
453 * Retrieve dependency tag set from transaction element.
454 * @param te transaction element
455 * @param tag dependency tag
456 * @return dependency tag set
458 rpmds rpmteDS(rpmte te, rpmTag tag)
462 * Retrieve file info tag set from transaction element.
463 * @param te transaction element
464 * @param tag file info tag (RPMTAG_BASENAMES)
465 * @return file info tag set
467 rpmfi rpmteFI(rpmte te, rpmTag tag)
471 * Calculate transaction element dependency colors/refs from file info.
472 * @param te transaction element
473 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
476 void rpmteColorDS(rpmte te, rpmTag tag)
481 * Return transaction element index.
482 * @param tsi transaction element iterator
483 * @return transaction element index
485 int rpmtsiOc(rpmtsi tsi)
489 * Destroy transaction element iterator.
490 * @param tsi transaction element iterator
491 * @return NULL always
493 /*@unused@*/ /*@null@*/
494 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
495 /*@globals fileSystem @*/
496 /*@modifies fileSystem @*/;
499 * Destroy transaction element iterator.
500 * @param tsi transaction element iterator
503 * @return NULL always
506 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
507 const char * fn, unsigned int ln)
508 /*@globals fileSystem @*/
509 /*@modifies fileSystem @*/;
510 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
513 * Create transaction element iterator.
514 * @param ts transaction set
515 * @return transaction element iterator
517 /*@unused@*/ /*@only@*/
518 rpmtsi rpmtsiInit(rpmts ts)
522 * Create transaction element iterator.
523 * @param ts transaction set
526 * @return transaction element iterator
528 /*@unused@*/ /*@only@*/
529 rpmtsi XrpmtsiInit(rpmts ts,
530 const char * fn, unsigned int ln)
532 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
535 * Return next transaction element of type.
536 * @param tsi transaction element iterator
537 * @param type transaction element type selector (0 for any)
538 * @return next transaction element of type, NULL on termination
540 /*@dependent@*/ /*@null@*/
541 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)