4 /** \ingroup rpmts rpmte
6 * Structures used for an "rpmte" transaction element.
17 extern int _rpmte_debug;
20 * Transaction element ordering chain linkage.
22 typedef struct tsortInfo_s * tsortInfo;
25 * Transaction element iterator.
27 typedef struct rpmtsi_s * rpmtsi;
30 * Transaction element type.
32 typedef enum rpmElementType_e {
33 TR_ADDED = (1 << 0), /*!< Package will be installed. */
34 TR_REMOVED = (1 << 1) /*!< Package will be removed. */
38 * Destroy a transaction element.
39 * @param te transaction element
42 rpmte rpmteFree(rpmte te);
45 * Create a transaction element.
46 * @param ts transaction set
48 * @param type TR_ADDED/TR_REMOVED
49 * @param key (TR_ADDED) package retrieval key (e.g. file name)
50 * @param relocs (TR_ADDED) package file relocations
51 * @param dboffset (TR_REMOVED) rpmdb instance
52 * @param pkgKey associated added package (if any)
53 * @return new transaction element
55 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
57 rpmRelocation * relocs,
62 * Retrieve header from transaction element.
63 * @param te transaction element
66 extern Header rpmteHeader(rpmte te);
69 * Save header into transaction element.
70 * @param te transaction element
74 extern Header rpmteSetHeader(rpmte te, Header h);
77 * Retrieve type of transaction element.
78 * @param te transaction element
81 rpmElementType rpmteType(rpmte te);
84 * Retrieve name string of transaction element.
85 * @param te transaction element
88 extern const char * rpmteN(rpmte te);
91 * Retrieve epoch string of transaction element.
92 * @param te transaction element
93 * @return epoch string
95 extern const char * rpmteE(rpmte te);
98 * Retrieve version string of transaction element.
99 * @param te transaction element
100 * @return version string
102 extern const char * rpmteV(rpmte te);
105 * Retrieve release string of transaction element.
106 * @param te transaction element
107 * @return release string
109 extern const char * rpmteR(rpmte te);
112 * Retrieve arch string of transaction element.
113 * @param te transaction element
114 * @return arch string
116 extern const char * rpmteA(rpmte te);
119 * Retrieve os string of transaction element.
120 * @param te transaction element
123 extern const char * rpmteO(rpmte te);
126 * Retrieve isSource attribute of transaction element.
127 * @param te transaction element
128 * @return isSource attribute
130 extern int rpmteIsSource(rpmte te);
133 * Retrieve color bits of transaction element.
134 * @param te transaction element
137 uint32_t rpmteColor(rpmte te);
140 * Set color bits of transaction element.
141 * @param te transaction element
142 * @param color new color bits
143 * @return previous color bits
145 uint32_t rpmteSetColor(rpmte te, uint32_t color);
148 * Retrieve last instance installed to the database.
149 * @param te transaction element
150 * @return last install instance.
152 unsigned int rpmteDBInstance(rpmte te);
155 * Set last instance installed to the database.
156 * @param te transaction element
157 * @param instance Database instance of last install element.
158 * @return last install instance.
160 void rpmteSetDBInstance(rpmte te, unsigned int instance);
163 * Retrieve size in bytes of package file.
164 * @todo Signature header is estimated at 256b.
165 * @param te transaction element
166 * @return size in bytes of package file.
168 rpm_off_t rpmtePkgFileSize(rpmte te);
171 * Retrieve dependency tree depth of transaction element.
172 * @param te transaction element
175 int rpmteDepth(rpmte te);
178 * Set dependency tree depth of transaction element.
179 * @param te transaction element
180 * @param ndepth new depth
181 * @return previous depth
183 int rpmteSetDepth(rpmte te, int ndepth);
186 * Retrieve dependency tree breadth of transaction element.
187 * @param te transaction element
190 int rpmteBreadth(rpmte te);
193 * Set dependency tree breadth of transaction element.
194 * @param te transaction element
195 * @param nbreadth new breadth
196 * @return previous breadth
198 int rpmteSetBreadth(rpmte te, int nbreadth);
201 * Retrieve tsort no. of predecessors of transaction element.
202 * @param te transaction element
203 * @return no. of predecessors
205 int rpmteNpreds(rpmte te);
208 * Set tsort no. of predecessors of transaction element.
209 * @param te transaction element
210 * @param npreds new no. of predecessors
211 * @return previous no. of predecessors
213 int rpmteSetNpreds(rpmte te, int npreds);
216 * Retrieve tree index of transaction element.
217 * @param te transaction element
220 int rpmteTree(rpmte te);
223 * Set tree index of transaction element.
224 * @param te transaction element
225 * @param ntree new tree index
226 * @return previous tree index
228 int rpmteSetTree(rpmte te, int ntree);
231 * Retrieve parent transaction element.
232 * @param te transaction element
233 * @return parent transaction element
235 rpmte rpmteParent(rpmte te);
238 * Set parent transaction element.
239 * @param te transaction element
240 * @param pte new parent transaction element
241 * @return previous parent transaction element
243 rpmte rpmteSetParent(rpmte te, rpmte pte);
246 * Retrieve number of children of transaction element.
247 * @param te transaction element
250 int rpmteDegree(rpmte te);
253 * Set number of children of transaction element.
254 * @param te transaction element
255 * @param ndegree new number of children
256 * @return previous number of children
258 int rpmteSetDegree(rpmte te, int ndegree);
261 * Retrieve tsort info for transaction element.
262 * @param te transaction element
265 tsortInfo rpmteTSI(rpmte te);
268 * Destroy tsort info of transaction element.
269 * @param te transaction element
271 void rpmteFreeTSI(rpmte te);
274 * Initialize tsort info of transaction element.
275 * @param te transaction element
277 void rpmteNewTSI(rpmte te);
280 * Destroy dependency set info of transaction element.
281 * @param te transaction element
283 void rpmteCleanDS(rpmte te);
286 * Retrieve pkgKey of TR_ADDED transaction element.
287 * @param te transaction element
290 rpmalKey rpmteAddedKey(rpmte te);
293 * Set pkgKey of TR_ADDED transaction element.
294 * @param te transaction element
295 * @param npkgKey new pkgKey
296 * @return previous pkgKey
298 rpmalKey rpmteSetAddedKey(rpmte te,
302 * Retrieve dependent pkgKey of TR_REMOVED transaction element.
303 * @param te transaction element
304 * @return dependent pkgKey
306 rpmalKey rpmteDependsOnKey(rpmte te);
309 * Retrieve rpmdb instance of TR_REMOVED transaction element.
310 * @param te transaction element
311 * @return rpmdb instance
313 int rpmteDBOffset(rpmte te);
316 * Retrieve name-version-release string from transaction element.
317 * @param te transaction element
318 * @return name-version-release string
320 extern const char * rpmteNEVR(rpmte te);
323 * Retrieve name-version-release.arch string from transaction element.
324 * @param te transaction element
325 * @return name-version-release.arch string
327 extern const char * rpmteNEVRA(rpmte te);
330 * Retrieve file handle from transaction element.
331 * @param te transaction element
332 * @return file handle
334 FD_t rpmteFd(rpmte te);
337 * Retrieve key from transaction element.
338 * @param te transaction element
341 fnpyKey rpmteKey(rpmte te);
344 * Retrieve dependency tag set from transaction element.
345 * @param te transaction element
346 * @param tag dependency tag
347 * @return dependency tag set
349 rpmds rpmteDS(rpmte te, rpm_tag_t tag);
352 * Retrieve file info tag set from transaction element.
353 * @param te transaction element
354 * @param tag file info tag (RPMTAG_BASENAMES)
355 * @return file info tag set
357 rpmfi rpmteFI(rpmte te, rpm_tag_t tag);
360 * Calculate transaction element dependency colors/refs from file info.
361 * @param te transaction element
362 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
364 void rpmteColorDS(rpmte te, rpm_tag_t tag);
367 * Return transaction element index.
368 * @param tsi transaction element iterator
369 * @return transaction element index
371 int rpmtsiOc(rpmtsi tsi);
374 * Destroy transaction element iterator.
375 * @param tsi transaction element iterator
376 * @return NULL always
378 rpmtsi rpmtsiFree(rpmtsi tsi);
381 * Destroy transaction element iterator.
382 * @param tsi transaction element iterator
385 * @return NULL always
387 rpmtsi XrpmtsiFree(rpmtsi tsi,
388 const char * fn, unsigned int ln);
389 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
392 * Create transaction element iterator.
393 * @param ts transaction set
394 * @return transaction element iterator
396 rpmtsi rpmtsiInit(rpmts ts);
399 * Create transaction element iterator.
400 * @param ts transaction set
403 * @return transaction element iterator
405 rpmtsi XrpmtsiInit(rpmts ts,
406 const char * fn, unsigned int ln);
407 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
410 * Return next transaction element of type.
411 * @param tsi transaction element iterator
412 * @param type transaction element type selector (0 for any)
413 * @return next transaction element of type, NULL on termination
415 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type);