4 /** \ingroup rpmdep rpmtrans
6 * Structures used for a transactionElement.
9 typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
11 typedef /*@abstract@*/ struct teIterator_s * teIterator;
19 * Dependncy ordering information.
21 /*@-fielduse@*/ /* LCL: confused by union? */
25 /*@exposed@*/ /*@dependent@*/ /*@null@*/
26 transactionElement suc;
28 #define tsi_count tsi_u.count
29 #define tsi_suc tsi_u.suc
30 /*@owned@*/ /*@null@*/
31 struct tsortInfo_s * tsi_next;
32 /*@exposed@*/ /*@dependent@*/ /*@null@*/
33 transactionElement tsi_chain;
41 typedef enum rpmTransactionType_e {
42 TR_ADDED = (1 << 0), /*!< Package will be installed. */
43 TR_REMOVED = (1 << 1) /*!< Package will be removed. */
47 * A single package instance to be installed/removed atomically.
49 struct transactionElement_s {
50 rpmTransactionType type; /*!< Package disposition (installed/removed). */
52 /*@refcounted@*/ /*@null@*/
53 Header h; /*!< Package header. */
55 const char * NEVR; /*!< Package name-version-release. */
57 const char * name; /*!< Name: */
60 /*@dependent@*/ /*@null@*/
61 char * version; /*!< Version: */
62 /*@dependent@*/ /*@null@*/
63 char * release; /*!< Release: */
65 const char * arch; /*!< Architecture hint. */
67 const char * os; /*!< Operating system hint. */
69 transactionElement parent; /*!< Parent transaction element. */
70 int degree; /*!< No. of immediate children. */
71 int depth; /*!< Max. depth in dependency tree. */
72 int npreds; /*!< No. of predecessors. */
73 int tree; /*!< Tree index. */
75 tsortInfo tsi; /*!< Dependency ordering chains. */
77 /*@refcounted@*/ /*@null@*/
78 rpmDepSet this; /*!< This package's provided NEVR. */
79 /*@refcounted@*/ /*@null@*/
80 rpmDepSet provides; /*!< Provides: dependencies. */
81 /*@refcounted@*/ /*@null@*/
82 rpmDepSet requires; /*!< Requires: dependencies. */
83 /*@refcounted@*/ /*@null@*/
84 rpmDepSet conflicts; /*!< Conflicts: dependencies. */
85 /*@refcounted@*/ /*@null@*/
86 rpmDepSet obsoletes; /*!< Obsoletes: dependencies. */
87 /*@refcounted@*/ /*@null@*/
88 TFI_t fi; /*!< File information. */
90 uint_32 multiLib; /*!< (TR_ADDED) MULTILIB */
92 /*@exposed@*/ /*@dependent@*/ /*@null@*/
93 fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
94 /*@owned@*/ /*@null@*/
95 rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
96 /*@refcounted@*/ /*@null@*/
97 FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
99 /*@-fielduse@*/ /* LCL: confused by union? */
101 /*@exposed@*/ /*@dependent@*/ /*@null@*/
104 /*@exposed@*/ /*@dependent@*/ /*@null@*/
114 * Iterator across transaction elements, forward on install, backward on erase.
116 struct teIterator_s {
118 rpmTransactionSet ts; /*!< transaction set. */
119 int reverse; /*!< reversed traversal? */
120 int ocsave; /*!< last returned iterator index. */
121 int oc; /*!< iterator index. */
129 * Destroy a transaction element.
130 * @param te transaction element
131 * @return NULL always
134 transactionElement teFree(/*@only@*/ /*@null@*/ transactionElement te)
137 * Create a transaction element.
138 * @param ts transaction set
140 * @param type TR_ADDED/TR_REMOVED
141 * @param key (TR_ADDED) package retrieval key (e.g. file name)
142 * @param relocs (TR_ADDED) package file relocations
143 * @param dboffset (TR_REMOVED) rpmdb instance
144 * @param pkgKey associated added package (if any)
145 * @return new transaction element
147 /*@only@*/ /*@null@*/
148 transactionElement teNew(const rpmTransactionSet ts, Header h,
149 rpmTransactionType type,
150 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
151 /*@null@*/ rpmRelocation * relocs,
153 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
154 /*@modifies ts, h @*/;
157 * Retrieve type of transaction element.
158 * @param te transaction element
161 rpmTransactionType teGetType(transactionElement te)
165 * Retrieve name string of transaction element.
166 * @param te transaction element
167 * @return name string
170 const char * teGetN(transactionElement te)
174 * Retrieve epoch string of transaction element.
175 * @param te transaction element
176 * @return epoch string
178 /*@observer@*/ /*@null@*/
179 const char * teGetE(transactionElement te)
183 * Retrieve version string of transaction element.
184 * @param te transaction element
185 * @return version string
187 /*@observer@*/ /*@null@*/
188 const char * teGetV(transactionElement te)
192 * Retrieve release string of transaction element.
193 * @param te transaction element
194 * @return release string
196 /*@observer@*/ /*@null@*/
197 const char * teGetR(transactionElement te)
201 * Retrieve arch string of transaction element.
202 * @param te transaction element
203 * @return arch string
205 /*@observer@*/ /*@null@*/
206 const char * teGetA(transactionElement te)
210 * Retrieve os string of transaction element.
211 * @param te transaction element
214 /*@observer@*/ /*@null@*/
215 const char * teGetO(transactionElement te)
219 * Retrieve multlib flags of transaction element.
220 * @param te transaction element
221 * @return multilib flags
223 int teGetMultiLib(transactionElement te)
227 * Set multlib flags of transaction element.
228 * @param te transaction element
229 * @param nmultiLib new multilib flags
230 * @return previous multilib flags
232 int teSetMultiLib(transactionElement te, int nmultiLib)
236 * Retrieve tsort tree depth of transaction element.
237 * @param te transaction element
240 int teGetDepth(transactionElement te)
244 * Set tsort tree depth of transaction element.
245 * @param te transaction element
246 * @param ndepth new depth
247 * @return previous depth
249 int teSetDepth(transactionElement te, int ndepth)
253 * Retrieve tsort no. of predecessors of transaction element.
254 * @param te transaction element
255 * @return no. of predecessors
257 int teGetNpreds(transactionElement te)
261 * Set tsort no. of predecessors of transaction element.
262 * @param te transaction element
263 * @param npreds new no. of predecessors
264 * @return previous no. of predecessors
266 int teSetNpreds(transactionElement te, int npreds)
270 * Retrieve tree index of transaction element.
271 * @param te transaction element
274 int teGetTree(transactionElement te)
278 * Set tree index of transaction element.
279 * @param te transaction element
280 * @param ntree new tree index
281 * @return previous tree index
283 int teSetTree(transactionElement te, int ntree)
287 * Retrieve parent transaction element.
288 * @param te transaction element
289 * @return parent transaction element
291 /*@observer@*/ /*@unused@*/
292 transactionElement teGetParent(transactionElement te)
296 * Set parent transaction element.
297 * @param te transaction element
298 * @param pte new parent transaction element
299 * @return previous parent transaction element
301 transactionElement teSetParent(transactionElement te, transactionElement pte)
305 * Retrieve number of children of transaction element.
306 * @param te transaction element
309 int teGetDegree(transactionElement te)
313 * Set number of children of transaction element.
314 * @param te transaction element
315 * @param ndegree new number of children
316 * @return previous number of children
318 int teSetDegree(transactionElement te, int ndegree)
322 * Retrieve tsort info for transaction element.
323 * @param te transaction element
326 tsortInfo teGetTSI(transactionElement te)
330 * Destroy tsort info of transaction element.
331 * @param te transaction element
333 void teFreeTSI(transactionElement te)
337 * Initialize tsort info of transaction element.
338 * @param te transaction element
340 void teNewTSI(transactionElement te)
344 * Destroy dependency set info of transaction element.
345 * @param te transaction element
348 void teCleanDS(transactionElement te)
352 * Retrieve pkgKey of TR_ADDED transaction element.
353 * @param te transaction element
356 /*@exposed@*/ /*@dependent@*/ /*@null@*/
357 alKey teGetAddedKey(transactionElement te)
361 * Set pkgKey of TR_ADDED transaction element.
362 * @param te transaction element
363 * @param npkgKey new pkgKey
364 * @return previous pkgKey
366 /*@exposed@*/ /*@dependent@*/ /*@null@*/
367 alKey teSetAddedKey(transactionElement te,
368 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
372 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
373 * @param te transaction element
374 * @return dependent pkgKey
376 /*@exposed@*/ /*@dependent@*/ /*@null@*/
377 alKey teGetDependsOnKey(transactionElement te)
381 * Retrieve rpmdb instance of TR_REMOVED transaction element.
382 * @param te transaction element
383 * @return rpmdb instance
385 int teGetDBOffset(transactionElement te)
389 * Retrieve name-version-release string from transaction element.
390 * @param te transaction element
391 * @return name-version-release string
394 const char * teGetNEVR(transactionElement te)
398 * Retrieve file handle from transaction element.
399 * @param te transaction element
400 * @return file handle
402 FD_t teGetFd(transactionElement te)
406 * Retrieve key from transaction element.
407 * @param te transaction element
411 fnpyKey teGetKey(transactionElement te)
415 * Retrieve dependency tag set from transaction element.
416 * @param te transaction element
417 * @param tag dependency tag
418 * @return dependency tag set
420 rpmDepSet teGetDS(transactionElement te, rpmTag tag)
424 * Retrieve file info tag set from transaction element.
425 * @param te transaction element
426 * @param tag file info tag
427 * @return file info tag set
429 TFI_t teGetFI(transactionElement te, rpmTag tag)
433 * Return transaction element index.
434 * @param tei transaction element iterator
435 * @return transaction element index
437 int teiGetOc(teIterator tei)
441 * Destroy transaction element iterator.
442 * @param tei transaction element iterator
443 * @return NULL always
445 /*@unused@*/ /*@null@*/
446 teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
450 * Destroy transaction element iterator.
451 * @param tei transaction element iterator
452 * @return NULL always
455 teIterator XteFreeIterator(/*@only@*//*@null@*/ teIterator tei,
456 const char * fn, unsigned int ln)
458 #define teFreeIterator(_tei) XteFreeIterator(_tei, __FILE__, __LINE__)
461 * Create transaction element iterator.
462 * @param ts transaction set
463 * @return transaction element iterator
465 /*@unused@*/ /*@only@*/
466 teIterator teInitIterator(rpmTransactionSet ts)
470 * Create transaction element iterator.
471 * @param ts transaction set
472 * @return transaction element iterator
474 /*@unused@*/ /*@only@*/
475 teIterator XteInitIterator(rpmTransactionSet ts,
476 const char * fn, unsigned int ln)
478 #define teInitIterator(_ts) XteInitIterator(_ts, __FILE__, __LINE__)
481 * Return next transaction element
482 * @param tei transaction element iterator
483 * @return transaction element, NULL on termination
485 /*@dependent@*/ /*@null@*/
486 transactionElement teNextIterator(teIterator tei)
490 * Return next transaction element of type.
491 * @param tei transaction element iterator
492 * @param type transaction element type selector
493 * @return next transaction element of type, NULL on termination
495 /*@dependent@*/ /*@null@*/
496 transactionElement teNext(teIterator tei, rpmTransactionType type)