1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
#ifndef H_RPMTE
#define H_RPMTE
/** \ingroup rpmts rpmte
* \file lib/rpmte.h
* Structures used for an "rpmte" transaction element.
*/
/**
*/
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmte_debug;
/*@=exportlocal@*/
/**
* Transaction element ordering chain linkage.
*/
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
/**
* Transaction element iterator.
*/
typedef /*@abstract@*/ struct rpmtsi_s * rpmtsi;
/** \ingroup rpmte
* Transaction element type.
*/
typedef enum rpmElementType_e {
TR_ADDED = (1 << 0), /*!< Package will be installed. */
TR_REMOVED = (1 << 1) /*!< Package will be removed. */
} rpmElementType;
#if defined(_RPMTE_INTERNAL)
/** \ingroup rpmte
* Dependncy ordering information.
*/
/*@-fielduse@*/ /* LCL: confused by union? */
struct tsortInfo_s {
union {
int count;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
/*@owned@*/ /*@null@*/
struct tsortInfo_s * tsi_next;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte tsi_chain;
int tsi_reqx;
int tsi_qcnt;
};
/*@=fielduse@*/
/** \ingroup rpmte
* A single package instance to be installed/removed atomically.
*/
struct rpmte_s {
rpmElementType type; /*!< Package disposition (installed/removed). */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Package header. */
/*@only@*/
const char * NEVR; /*!< Package name-version-release. */
/*@owned@*/
const char * name; /*!< Name: */
/*@only@*/ /*@null@*/
char * epoch;
/*@dependent@*/ /*@null@*/
char * version; /*!< Version: */
/*@dependent@*/ /*@null@*/
char * release; /*!< Release: */
/*@only@*/ /*@null@*/
const char * arch; /*!< Architecture hint. */
/*@only@*/ /*@null@*/
const char * os; /*!< Operating system hint. */
rpmte parent; /*!< Parent transaction element. */
int degree; /*!< No. of immediate children. */
int depth; /*!< Max. depth in dependency tree. */
int npreds; /*!< No. of predecessors. */
int tree; /*!< Tree index. */
/*@owned@*/
tsortInfo tsi; /*!< Dependency ordering chains. */
/*@refcounted@*/ /*@null@*/
rpmds this; /*!< This package's provided NEVR. */
/*@refcounted@*/ /*@null@*/
rpmds provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmds requires; /*!< Requires: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmds conflicts; /*!< Conflicts: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmds obsoletes; /*!< Obsoletes: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmfi fi; /*!< File information. */
uint_32 multiLib; /*!< (TR_ADDED) MULTILIB */
/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
/*@owned@*/ /*@null@*/
rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
/*@refcounted@*/ /*@null@*/
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
/*@-fielduse@*/ /* LCL: confused by union? */
union {
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey addedKey;
struct {
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey dependsOnKey;
int dboffset;
} removed;
} u;
/*@=fielduse@*/
};
/**
* Iterator across transaction elements, forward on install, backward on erase.
*/
struct rpmtsi_s {
/*@refcounted@*/
rpmts ts; /*!< transaction set. */
int reverse; /*!< reversed traversal? */
int ocsave; /*!< last returned iterator index. */
int ocmax; /*!< iterator max index. */
int oc; /*!< iterator index. */
};
#endif /* _RPMTE_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
/**
* Destroy a transaction element.
* @param te transaction element
* @return NULL always
*/
/*@null@*/
rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
/*@modifies te@*/;
/**
* Create a transaction element.
* @param ts transaction set
* @param h header
* @param type TR_ADDED/TR_REMOVED
* @param key (TR_ADDED) package retrieval key (e.g. file name)
* @param relocs (TR_ADDED) package file relocations
* @param dboffset (TR_REMOVED) rpmdb instance
* @param pkgKey associated added package (if any)
* @return new transaction element
*/
/*@only@*/ /*@null@*/
rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation * relocs,
int dboffset,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
/*@modifies ts, h @*/;
/**
* Retrieve type of transaction element.
* @param te transaction element
* @return type
*/
rpmElementType rpmteType(rpmte te)
/*@*/;
/**
* Retrieve name string of transaction element.
* @param te transaction element
* @return name string
*/
/*@observer@*/
extern const char * rpmteN(rpmte te)
/*@*/;
/**
* Retrieve epoch string of transaction element.
* @param te transaction element
* @return epoch string
*/
/*@observer@*/ /*@null@*/
extern const char * rpmteE(rpmte te)
/*@*/;
/**
* Retrieve version string of transaction element.
* @param te transaction element
* @return version string
*/
/*@observer@*/ /*@null@*/
extern const char * rpmteV(rpmte te)
/*@*/;
/**
* Retrieve release string of transaction element.
* @param te transaction element
* @return release string
*/
/*@observer@*/ /*@null@*/
extern const char * rpmteR(rpmte te)
/*@*/;
/**
* Retrieve arch string of transaction element.
* @param te transaction element
* @return arch string
*/
/*@observer@*/ /*@null@*/
extern const char * rpmteA(rpmte te)
/*@*/;
/**
* Retrieve os string of transaction element.
* @param te transaction element
* @return os string
*/
/*@observer@*/ /*@null@*/
extern const char * rpmteO(rpmte te)
/*@*/;
/**
* Retrieve multlib flags of transaction element.
* @param te transaction element
* @return multilib flags
*/
int rpmteMultiLib(rpmte te)
/*@*/;
/**
* Set multlib flags of transaction element.
* @param te transaction element
* @param nmultiLib new multilib flags
* @return previous multilib flags
*/
int rpmteSetMultiLib(rpmte te, int nmultiLib)
/*@modifies te @*/;
/**
* Retrieve tsort tree depth of transaction element.
* @param te transaction element
* @return depth
*/
int rpmteDepth(rpmte te)
/*@*/;
/**
* Set tsort tree depth of transaction element.
* @param te transaction element
* @param ndepth new depth
* @return previous depth
*/
int rpmteSetDepth(rpmte te, int ndepth)
/*@modifies te @*/;
/**
* Retrieve tsort no. of predecessors of transaction element.
* @param te transaction element
* @return no. of predecessors
*/
int rpmteNpreds(rpmte te)
/*@*/;
/**
* Set tsort no. of predecessors of transaction element.
* @param te transaction element
* @param npreds new no. of predecessors
* @return previous no. of predecessors
*/
int rpmteSetNpreds(rpmte te, int npreds)
/*@modifies te @*/;
/**
* Retrieve tree index of transaction element.
* @param te transaction element
* @return tree index
*/
int rpmteTree(rpmte te)
/*@*/;
/**
* Set tree index of transaction element.
* @param te transaction element
* @param ntree new tree index
* @return previous tree index
*/
int rpmteSetTree(rpmte te, int ntree)
/*@modifies te @*/;
/**
* Retrieve parent transaction element.
* @param te transaction element
* @return parent transaction element
*/
/*@observer@*/ /*@unused@*/
rpmte rpmteParent(rpmte te)
/*@*/;
/**
* Set parent transaction element.
* @param te transaction element
* @param pte new parent transaction element
* @return previous parent transaction element
*/
rpmte rpmteSetParent(rpmte te, rpmte pte)
/*@modifies te @*/;
/**
* Retrieve number of children of transaction element.
* @param te transaction element
* @return tree index
*/
int rpmteDegree(rpmte te)
/*@*/;
/**
* Set number of children of transaction element.
* @param te transaction element
* @param ndegree new number of children
* @return previous number of children
*/
int rpmteSetDegree(rpmte te, int ndegree)
/*@modifies te @*/;
/**
* Retrieve tsort info for transaction element.
* @param te transaction element
* @return tsort info
*/
tsortInfo rpmteTSI(rpmte te)
/*@*/;
/**
* Destroy tsort info of transaction element.
* @param te transaction element
*/
void rpmteFreeTSI(rpmte te)
/*@modifies te @*/;
/**
* Initialize tsort info of transaction element.
* @param te transaction element
*/
void rpmteNewTSI(rpmte te)
/*@modifies te @*/;
/**
* Destroy dependency set info of transaction element.
* @param te transaction element
*/
/*@unused@*/
void rpmteCleanDS(rpmte te)
/*@modifies te @*/;
/**
* Retrieve pkgKey of TR_ADDED transaction element.
* @param te transaction element
* @return pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteAddedKey(rpmte te)
/*@*/;
/**
* Set pkgKey of TR_ADDED transaction element.
* @param te transaction element
* @param npkgKey new pkgKey
* @return previous pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteSetAddedKey(rpmte te,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
/*@modifies te @*/;
/**
* Retrieve dependent pkgKey of TR_REMOVED transaction element.
* @param te transaction element
* @return dependent pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteDependsOnKey(rpmte te)
/*@*/;
/**
* Retrieve rpmdb instance of TR_REMOVED transaction element.
* @param te transaction element
* @return rpmdb instance
*/
int rpmteDBOffset(rpmte te)
/*@*/;
/**
* Retrieve name-version-release string from transaction element.
* @param te transaction element
* @return name-version-release string
*/
/*@observer@*/
extern const char * rpmteNEVR(rpmte te)
/*@*/;
/**
* Retrieve file handle from transaction element.
* @param te transaction element
* @return file handle
*/
FD_t rpmteFd(rpmte te)
/*@*/;
/**
* Retrieve key from transaction element.
* @param te transaction element
* @return key
*/
/*@exposed@*/
fnpyKey rpmteKey(rpmte te)
/*@*/;
/**
* Retrieve dependency tag set from transaction element.
* @param te transaction element
* @param tag dependency tag
* @return dependency tag set
*/
rpmds rpmteDS(rpmte te, rpmTag tag)
/*@*/;
/**
* Retrieve file info tag set from transaction element.
* @param te transaction element
* @param tag file info tag
* @return file info tag set
*/
rpmfi rpmteFI(rpmte te, rpmTag tag)
/*@*/;
/**
* Return transaction element index.
* @param tsi transaction element iterator
* @return transaction element index
*/
int rpmtsiOc(rpmtsi tsi)
/*@*/;
/**
* Destroy transaction element iterator.
* @param tsi transaction element iterator
* @return NULL always
*/
/*@unused@*/ /*@null@*/
rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
/*@*/;
/**
* Destroy transaction element iterator.
* @param tsi transaction element iterator
* @param fn
* @param ln
* @return NULL always
*/
/*@null@*/
rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
const char * fn, unsigned int ln)
/*@*/;
#define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
/**
* Create transaction element iterator.
* @param ts transaction set
* @return transaction element iterator
*/
/*@unused@*/ /*@only@*/
rpmtsi rpmtsiInit(rpmts ts)
/*@modifies ts @*/;
/**
* Create transaction element iterator.
* @param ts transaction set
* @param fn
* @param ln
* @return transaction element iterator
*/
/*@unused@*/ /*@only@*/
rpmtsi XrpmtsiInit(rpmts ts,
const char * fn, unsigned int ln)
/*@modifies ts @*/;
#define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
/**
* Return next transaction element of type.
* @param tsi transaction element iterator
* @param type transaction element type selector (0 for any)
* @return next transaction element of type, NULL on termination
*/
/*@dependent@*/ /*@null@*/
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
/*@modifies tsi @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_RPMTE */
|