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. */
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
327 rpmte rpmteSetParent(rpmte te, rpmte pte)
331 * Retrieve number of children of transaction element.
332 * @param te transaction element
335 int rpmteDegree(rpmte te)
339 * Set number of children of transaction element.
340 * @param te transaction element
341 * @param ndegree new number of children
342 * @return previous number of children
344 int rpmteSetDegree(rpmte te, int ndegree)
348 * Retrieve tsort info for transaction element.
349 * @param te transaction element
352 tsortInfo rpmteTSI(rpmte te)
356 * Destroy tsort info of transaction element.
357 * @param te transaction element
359 void rpmteFreeTSI(rpmte te)
363 * Initialize tsort info of transaction element.
364 * @param te transaction element
366 void rpmteNewTSI(rpmte te)
370 * Destroy dependency set info of transaction element.
371 * @param te transaction element
374 void rpmteCleanDS(rpmte te)
378 * Retrieve pkgKey of TR_ADDED transaction element.
379 * @param te transaction element
382 /*@exposed@*/ /*@dependent@*/ /*@null@*/
383 alKey rpmteAddedKey(rpmte te)
387 * Set pkgKey of TR_ADDED transaction element.
388 * @param te transaction element
389 * @param npkgKey new pkgKey
390 * @return previous pkgKey
392 /*@exposed@*/ /*@dependent@*/ /*@null@*/
393 alKey rpmteSetAddedKey(rpmte te,
394 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
398 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
399 * @param te transaction element
400 * @return dependent pkgKey
402 /*@exposed@*/ /*@dependent@*/ /*@null@*/
403 alKey rpmteDependsOnKey(rpmte te)
407 * Retrieve rpmdb instance of TR_REMOVED transaction element.
408 * @param te transaction element
409 * @return rpmdb instance
411 int rpmteDBOffset(rpmte te)
415 * Retrieve name-version-release string from transaction element.
416 * @param te transaction element
417 * @return name-version-release string
420 extern const char * rpmteNEVR(rpmte te)
424 * Retrieve name-version-release.arch string from transaction element.
425 * @param te transaction element
426 * @return name-version-release.arch string
430 extern const char * rpmteNEVRA(rpmte te)
435 * Retrieve file handle from transaction element.
436 * @param te transaction element
437 * @return file handle
439 FD_t rpmteFd(rpmte te)
443 * Retrieve key from transaction element.
444 * @param te transaction element
448 fnpyKey rpmteKey(rpmte te)
452 * Retrieve dependency tag set from transaction element.
453 * @param te transaction element
454 * @param tag dependency tag
455 * @return dependency tag set
457 rpmds rpmteDS(rpmte te, rpmTag tag)
461 * Retrieve file info tag set from transaction element.
462 * @param te transaction element
463 * @param tag file info tag (RPMTAG_BASENAMES)
464 * @return file info tag set
466 rpmfi rpmteFI(rpmte te, rpmTag tag)
470 * Calculate transaction element dependency colors/refs from file info.
471 * @param te transaction element
472 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
475 void rpmteColorDS(rpmte te, rpmTag tag)
480 * Return transaction element index.
481 * @param tsi transaction element iterator
482 * @return transaction element index
484 int rpmtsiOc(rpmtsi tsi)
488 * Destroy transaction element iterator.
489 * @param tsi transaction element iterator
490 * @return NULL always
492 /*@unused@*/ /*@null@*/
493 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
494 /*@globals fileSystem @*/
495 /*@modifies fileSystem @*/;
498 * Destroy transaction element iterator.
499 * @param tsi transaction element iterator
502 * @return NULL always
505 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
506 const char * fn, unsigned int ln)
507 /*@globals fileSystem @*/
508 /*@modifies fileSystem @*/;
509 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
512 * Create transaction element iterator.
513 * @param ts transaction set
514 * @return transaction element iterator
516 /*@unused@*/ /*@only@*/
517 rpmtsi rpmtsiInit(rpmts ts)
521 * Create transaction element iterator.
522 * @param ts transaction set
525 * @return transaction element iterator
527 /*@unused@*/ /*@only@*/
528 rpmtsi XrpmtsiInit(rpmts ts,
529 const char * fn, unsigned int ln)
531 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
534 * Return next transaction element of type.
535 * @param tsi transaction element iterator
536 * @param type transaction element type selector (0 for any)
537 * @return next transaction element of type, NULL on termination
539 /*@dependent@*/ /*@null@*/
540 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)