4 /** \ingroup rpmts rpmte
6 * Structures used for an "rpmte" transaction element.
9 #include <rpm/rpmtypes.h>
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.
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 unused
52 * @return new transaction element
54 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
56 rpmRelocation * relocs,
60 * Retrieve header from transaction element.
61 * @param te transaction element
64 Header rpmteHeader(rpmte te);
67 * Save header into transaction element.
68 * @param te transaction element
72 Header rpmteSetHeader(rpmte te, Header h);
75 * Retrieve type of transaction element.
76 * @param te transaction element
79 rpmElementType rpmteType(rpmte te);
82 * Retrieve name string of transaction element.
83 * @param te transaction element
86 const char * rpmteN(rpmte te);
89 * Retrieve epoch string of transaction element.
90 * @param te transaction element
91 * @return epoch string
93 const char * rpmteE(rpmte te);
96 * Retrieve version string of transaction element.
97 * @param te transaction element
98 * @return version string
100 const char * rpmteV(rpmte te);
103 * Retrieve release string of transaction element.
104 * @param te transaction element
105 * @return release string
107 const char * rpmteR(rpmte te);
110 * Retrieve arch string of transaction element.
111 * @param te transaction element
112 * @return arch string
114 const char * rpmteA(rpmte te);
117 * Retrieve os string of transaction element.
118 * @param te transaction element
121 const char * rpmteO(rpmte te);
124 * Retrieve isSource attribute of transaction element.
125 * @param te transaction element
126 * @return isSource attribute
128 int rpmteIsSource(rpmte te);
131 * Retrieve color bits of transaction element.
132 * @param te transaction element
135 rpm_color_t rpmteColor(rpmte te);
138 * Set color bits of transaction element.
139 * @param te transaction element
140 * @param color new color bits
141 * @return previous color bits
143 rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color);
146 * Retrieve last instance installed to the database.
147 * @param te transaction element
148 * @return last install instance.
150 unsigned int rpmteDBInstance(rpmte te);
153 * Set last instance installed to the database.
154 * @param te transaction element
155 * @param instance Database instance of last install element.
156 * @return last install instance.
158 void rpmteSetDBInstance(rpmte te, unsigned int instance);
161 * Retrieve size in bytes of package file.
162 * @todo Signature header is estimated at 256b.
163 * @param te transaction element
164 * @return size in bytes of package file.
166 rpm_loff_t rpmtePkgFileSize(rpmte te);
169 * Retrieve dependency tree depth of transaction element.
170 * @param te transaction element
173 int rpmteDepth(rpmte te);
176 * Set dependency tree depth of transaction element.
177 * @param te transaction element
178 * @param ndepth new depth
179 * @return previous depth
181 int rpmteSetDepth(rpmte te, int ndepth);
184 * Retrieve tsort no. of predecessors of transaction element.
185 * @param te transaction element
186 * @return no. of predecessors
188 int rpmteNpreds(rpmte te);
191 * Set tsort no. of predecessors of transaction element.
192 * @param te transaction element
193 * @param npreds new no. of predecessors
194 * @return previous no. of predecessors
196 int rpmteSetNpreds(rpmte te, int npreds);
199 * Retrieve tree index of transaction element.
200 * @param te transaction element
203 int rpmteTree(rpmte te);
206 * Set tree index of transaction element.
207 * @param te transaction element
208 * @param ntree new tree index
209 * @return previous tree index
211 int rpmteSetTree(rpmte te, int ntree);
214 * Retrieve parent transaction element.
215 * @param te transaction element
216 * @return parent transaction element
218 rpmte rpmteParent(rpmte te);
221 * Set parent transaction element.
222 * @param te transaction element
223 * @param pte new parent transaction element
224 * @return previous parent transaction element
226 rpmte rpmteSetParent(rpmte te, rpmte pte);
229 * Retrieve number of children of transaction element.
230 * @param te transaction element
233 int rpmteDegree(rpmte te);
236 * Set number of children of transaction element.
237 * @param te transaction element
238 * @param ndegree new number of children
239 * @return previous number of children
241 int rpmteSetDegree(rpmte te, int ndegree);
244 * Retrieve tsort info for transaction element.
245 * @param te transaction element
248 tsortInfo rpmteTSI(rpmte te);
251 * Destroy tsort info of transaction element.
252 * @param te transaction element
254 void rpmteFreeTSI(rpmte te);
257 * Initialize tsort info of transaction element.
258 * @param te transaction element
260 void rpmteNewTSI(rpmte te);
263 * Destroy dependency set info of transaction element.
264 * @param te transaction element
266 void rpmteCleanDS(rpmte te);
269 * Set dependent element of TR_REMOVED transaction element.
270 * @param te transaction element
271 * @param depends dependent transaction element
273 void rpmteSetDependsOn(rpmte te, rpmte depends);
276 * Retrieve dependent element of TR_REMOVED transaction element.
277 * @param te transaction element
278 * @return dependent transaction element
280 rpmte rpmteDependsOn(rpmte te);
283 * Retrieve rpmdb instance of TR_REMOVED transaction element.
284 * @param te transaction element
285 * @return rpmdb instance
287 int rpmteDBOffset(rpmte te);
290 * Retrieve [epoch:]version-release string from transaction element.
291 * @param te transaction element
292 * @return [epoch:]version-release string
294 const char * rpmteEVR(rpmte te);
297 * Retrieve name-[epoch:]version-release string from transaction element.
298 * @param te transaction element
299 * @return name-[epoch:]version-release string
301 const char * rpmteNEVR(rpmte te);
304 * Retrieve name-[epoch:]version-release.arch string from transaction element.
305 * @param te transaction element
306 * @return name-[epoch:]version-release.arch string
308 const char * rpmteNEVRA(rpmte te);
311 * Retrieve key from transaction element.
312 * @param te transaction element
315 fnpyKey rpmteKey(rpmte te);
318 * Return failed status of transaction element.
319 * @param te transaction element
320 * @return 1 if transaction element (or its parents) failed
322 int rpmteFailed(rpmte te);
325 * Retrieve dependency tag set from transaction element.
326 * @param te transaction element
327 * @param tag dependency tag
328 * @return dependency tag set
330 rpmds rpmteDS(rpmte te, rpmTag tag);
333 * Retrieve file info tag set from transaction element.
334 * @param te transaction element
335 * @return file info tag set
337 rpmfi rpmteFI(rpmte te);
340 * Calculate transaction element dependency colors/refs from file info.
341 * @param te transaction element
342 * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
344 void rpmteColorDS(rpmte te, rpmTag tag);
347 * Destroy transaction element iterator.
348 * @param tsi transaction element iterator
349 * @return NULL always
351 rpmtsi rpmtsiFree(rpmtsi tsi);
354 * Create transaction element iterator.
355 * @param ts transaction set
356 * @return transaction element iterator
358 rpmtsi rpmtsiInit(rpmts ts);
361 * Return next transaction element of type.
362 * @param tsi transaction element iterator
363 * @param type transaction element type selector (0 for any)
364 * @return next transaction element of type, NULL on termination
366 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type);