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@*/
113 #if defined(_NEED_TEITERATOR)
115 * Iterator across transaction elements, forward on install, backward on erase.
117 struct teIterator_s {
119 rpmTransactionSet ts; /*!< transaction set. */
120 int reverse; /*!< reversed traversal? */
121 int ocsave; /*!< last returned iterator index. */
122 int oc; /*!< iterator index. */
131 * Destroy a transaction element.
132 * @param te transaction element
133 * @return NULL always
136 transactionElement teFree(/*@only@*/ /*@null@*/ transactionElement te)
139 * Create a transaction element.
140 * @param ts transaction set
142 * @param type TR_ADDED/TR_REMOVED
143 * @param key (TR_ADDED) package retrieval key (e.g. file name)
144 * @param relocs (TR_ADDED) package file relocations
145 * @param dboffset (TR_REMOVED) rpmdb instance
146 * @param pkgKey associated added package (if any)
147 * @return new transaction element
149 /*@only@*/ /*@null@*/
150 transactionElement teNew(const rpmTransactionSet ts, Header h,
151 rpmTransactionType type,
152 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
153 /*@null@*/ rpmRelocation * relocs,
155 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
156 /*@modifies ts, h @*/;
159 * Retrieve type of transaction element.
160 * @param te transaction element
163 rpmTransactionType teGetType(transactionElement te)
167 * Retrieve name string of transaction element.
168 * @param te transaction element
169 * @return name string
172 const char * teGetN(transactionElement te)
176 * Retrieve epoch string of transaction element.
177 * @param te transaction element
178 * @return epoch string
180 /*@observer@*/ /*@null@*/
181 const char * teGetE(transactionElement te)
185 * Retrieve version string of transaction element.
186 * @param te transaction element
187 * @return version string
189 /*@observer@*/ /*@null@*/
190 const char * teGetV(transactionElement te)
194 * Retrieve release string of transaction element.
195 * @param te transaction element
196 * @return release string
198 /*@observer@*/ /*@null@*/
199 const char * teGetR(transactionElement te)
203 * Retrieve arch string of transaction element.
204 * @param te transaction element
205 * @return arch string
207 /*@observer@*/ /*@null@*/
208 const char * teGetA(transactionElement te)
212 * Retrieve os string of transaction element.
213 * @param te transaction element
216 /*@observer@*/ /*@null@*/
217 const char * teGetO(transactionElement te)
221 * Retrieve multlib flags of transaction element.
222 * @param te transaction element
223 * @return multilib flags
225 int teGetMultiLib(transactionElement te)
229 * Set multlib flags of transaction element.
230 * @param te transaction element
231 * @param nmultiLib new multilib flags
232 * @return previous multilib flags
234 int teSetMultiLib(transactionElement te, int nmultiLib)
238 * Retrieve tsort tree depth of transaction element.
239 * @param te transaction element
242 int teGetDepth(transactionElement te)
246 * Set tsort tree depth of transaction element.
247 * @param te transaction element
248 * @param ndepth new depth
249 * @return previous depth
251 int teSetDepth(transactionElement te, int ndepth)
255 * Retrieve tsort no. of predecessors of transaction element.
256 * @param te transaction element
257 * @return no. of predecessors
259 int teGetNpreds(transactionElement te)
263 * Set tsort no. of predecessors of transaction element.
264 * @param te transaction element
265 * @param npreds new no. of predecessors
266 * @return previous no. of predecessors
268 int teSetNpreds(transactionElement te, int npreds)
272 * Retrieve tree index of transaction element.
273 * @param te transaction element
276 int teGetTree(transactionElement te)
280 * Set tree index of transaction element.
281 * @param te transaction element
282 * @param ntree new tree index
283 * @return previous tree index
285 int teSetTree(transactionElement te, int ntree)
289 * Retrieve parent transaction element.
290 * @param te transaction element
291 * @return parent transaction element
293 /*@observer@*/ /*@unused@*/
294 transactionElement teGetParent(transactionElement te)
298 * Set parent transaction element.
299 * @param te transaction element
300 * @param pte new parent transaction element
301 * @return previous parent transaction element
303 transactionElement teSetParent(transactionElement te, transactionElement pte)
307 * Retrieve number of children of transaction element.
308 * @param te transaction element
311 int teGetDegree(transactionElement te)
315 * Set number of children of transaction element.
316 * @param te transaction element
317 * @param ndegree new number of children
318 * @return previous number of children
320 int teSetDegree(transactionElement te, int ndegree)
324 * Retrieve tsort info for transaction element.
325 * @param te transaction element
328 tsortInfo teGetTSI(transactionElement te)
332 * Destroy tsort info of transaction element.
333 * @param te transaction element
335 void teFreeTSI(transactionElement te)
339 * Initialize tsort info of transaction element.
340 * @param te transaction element
342 void teNewTSI(transactionElement te)
346 * Destroy dependency set info of transaction element.
347 * @param te transaction element
350 void teCleanDS(transactionElement te)
354 * Retrieve pkgKey of TR_ADDED transaction element.
355 * @param te transaction element
358 /*@exposed@*/ /*@dependent@*/ /*@null@*/
359 alKey teGetAddedKey(transactionElement te)
363 * Set pkgKey of TR_ADDED transaction element.
364 * @param te transaction element
365 * @param npkgKey new pkgKey
366 * @return previous pkgKey
368 /*@exposed@*/ /*@dependent@*/ /*@null@*/
369 alKey teSetAddedKey(transactionElement te,
370 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
374 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
375 * @param te transaction element
376 * @return dependent pkgKey
378 /*@exposed@*/ /*@dependent@*/ /*@null@*/
379 alKey teGetDependsOnKey(transactionElement te)
383 * Retrieve rpmdb instance of TR_REMOVED transaction element.
384 * @param te transaction element
385 * @return rpmdb instance
387 int teGetDBOffset(transactionElement te)
391 * Retrieve name-version-release string from transaction element.
392 * @param te transaction element
393 * @return name-version-release string
396 const char * teGetNEVR(transactionElement te)
400 * Retrieve file handle from transaction element.
401 * @param te transaction element
402 * @return file handle
404 FD_t teGetFd(transactionElement te)
408 * Retrieve key from transaction element.
409 * @param te transaction element
413 fnpyKey teGetKey(transactionElement te)
417 * Retrieve dependency tag set from transaction element.
418 * @param te transaction element
419 * @param tag dependency tag
420 * @return dependency tag set
422 rpmDepSet teGetDS(transactionElement te, rpmTag tag)
426 * Retrieve file info tag set from transaction element.
427 * @param te transaction element
428 * @param tag file info tag
429 * @return file info tag set
431 TFI_t teGetFI(transactionElement te, rpmTag tag)
434 #if defined(_NEED_TEITERATOR)
436 * Return transaction element index.
437 * @param tei transaction element iterator
438 * @return transaction element index
440 int teiGetOc(teIterator tei)
444 * Destroy transaction element iterator.
445 * @param tei transaction element iterator
446 * @return NULL always
448 /*@unused@*/ /*@null@*/
449 teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
453 * Destroy transaction element iterator.
454 * @param tei transaction element iterator
455 * @return NULL always
458 teIterator XteFreeIterator(/*@only@*//*@null@*/ teIterator tei,
459 const char * fn, unsigned int ln)
461 #define teFreeIterator(_tei) XteFreeIterator(_tei, __FILE__, __LINE__)
464 * Create transaction element iterator.
465 * @param ts transaction set
466 * @return transaction element iterator
468 /*@unused@*/ /*@only@*/
469 teIterator teInitIterator(rpmTransactionSet ts)
473 * Create transaction element iterator.
474 * @param ts transaction set
475 * @return transaction element iterator
477 /*@unused@*/ /*@only@*/
478 teIterator XteInitIterator(rpmTransactionSet ts,
479 const char * fn, unsigned int ln)
481 #define teInitIterator(_ts) XteInitIterator(_ts, __FILE__, __LINE__)
484 * Return next transaction element
485 * @param tei transaction element iterator
486 * @return transaction element, NULL on termination
488 /*@dependent@*/ /*@null@*/
489 transactionElement teNextIterator(teIterator tei)
493 * Return next transaction element of type.
494 * @param tei transaction element iterator
495 * @param type transaction element type selector
496 * @return next transaction element of type, NULL on termination
498 /*@dependent@*/ /*@null@*/
499 transactionElement teNext(teIterator tei, rpmTransactionType type)
502 #endif /* defined(_NEED_TEITERATOR) */