blob: d34552867ff6b7ad3d23a4ca26af89faa96a8793 (
plain)
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
|
#ifndef H_DEPENDS
#define H_DEPENDS
/** \ingroup rpmdep rpmtrans
* \file lib/depends.h
* Structures used for dependency checking.
*/
#include <header.h>
#include <rpmhash.h>
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
typedef /*@abstract@*/ struct transactionElement_s * transactionElement;
typedef /*@abstract@*/ struct teIterator_s * teIterator;
typedef /*@abstract@*/ struct availableList_s * availableList;
/*@unchecked@*/
/*@-exportlocal@*/
extern int _cacheDependsRC;
/*@=exportlocal@*/
/*@unchecked@*/
/*@-exportlocal@*/
extern int _te_debug;
/*@=exportlocal@*/
/*@unchecked@*/
/*@-exportlocal@*/
extern int _ts_debug;
/*@=exportlocal@*/
/**
* Iterator across transaction elements, forward on install, backward on erase.
*/
struct teIterator_s {
/*@refcounted@*/
rpmTransactionSet ts; /*!< transaction set. */
int reverse; /*!< reversed traversal? */
int ocsave; /*!< last returned iterator index. */
int oc; /*!< iterator index. */
};
/** \ingroup rpmdep
* Dependncy ordering information.
*/
/*@-fielduse@*/ /* LCL: confused by union? */
struct tsortInfo_s {
union {
int count;
/*@kept@*/ /*@null@*/ transactionElement suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
/*@owned@*/ /*@null@*/
struct tsortInfo_s * tsi_next;
/*@null@*/
transactionElement tsi_chain;
int tsi_reqx;
int tsi_qcnt;
};
/*@=fielduse@*/
/** \ingroup rpmdep
* A single package instance to be installed/removed atomically.
*/
struct transactionElement_s {
/*@only@*/ /*@null@*/
char * NEVR;
/*@owned@*/ /*@null@*/
char * name;
/*@dependent@*/ /*@null@*/
char * version;
/*@dependent@*/ /*@null@*/
char * release;
int npreds; /*!< No. of predecessors. */
int depth; /*!< Max. depth in dependency tree. */
/*@owned@*/
tsortInfo tsi; /*!< Ordering info. */
enum rpmTransactionType {
TR_ADDED, /*!< Package will be installed. */
TR_REMOVED /*!< Package will be removed. */
} type; /*!< Package disposition (installed/removed). */
uint_32 multiLib; /* (TR_ADDED) MULTILIB */
int_32 filesCount; /* (TR_ADDED) No. files in package. */
/*@kept@*//*@null@*/
fnpyKey key;
/*!< (TR_ADDED) Retrieval key (CLI uses file name, e.g.). */
/*@owned@*/ /*@null@*/
rpmRelocation * relocs;
/*!< (TR_ADDED) Payload file relocations. */
/*@refcounted@*/ /*@null@*/
FD_t fd; /*!< (TR_ADDED) Payload file descriptor (usually NULL). */
/*@-fielduse@*/ /* LCL: confused by union? */
union {
/*@unused@*/ alKey addedKey;
/*@unused@*/ struct {
alKey dependsOnKey;
int dboffset;
} removed;
} u;
/*@=fielduse@*/
};
/** \ingroup rpmdep
* The set of packages to be installed/removed atomically.
*/
struct rpmTransactionSet_s {
rpmtransFlags transFlags; /*!< Bit(s) to control operation. */
/*@observer@*/ /*@null@*/
rpmCallbackFunction notify; /*!< Callback function. */
/*@observer@*/ /*@null@*/
rpmCallbackData notifyData; /*!< Callback private data. */
/*@dependent@*/
rpmProblemSet probs; /*!< Current problems in transaction. */
rpmprobFilterFlags ignoreSet;
/*!< Bits to filter current problems. */
int filesystemCount; /*!< No. of mounted filesystems. */
/*@dependent@*/
const char ** filesystems; /*!< Mounted filesystem names. */
/*@only@*/
struct diskspaceInfo * di; /*!< Per filesystem disk/inode usage. */
int dbmode; /*!< Database open mode. */
/*@refcounted@*/ /*@null@*/
rpmdb rpmdb; /*!< Database handle. */
/*@only@*/ hashTable ht; /*!< Fingerprint hash table. */
/*@only@*/
int * removedPackages; /*!< Set of packages being removed. */
int numRemovedPackages; /*!< No. removed package instances. */
int allocedRemovedPackages; /*!< Size of removed packages array. */
/*@only@*/
availableList addedPackages;/*!< Set of packages being installed. */
int numAddedPackages; /*!< No. added package instances. */
/*@only@*/
availableList availablePackages;
/*!< Universe of available packages. */
int numAvailablePackages; /*!< No. available package instances. */
/*@owned@*/
transactionElement order; /*!< Packages sorted by dependencies. */
int orderCount; /*!< No. of transaction elements. */
int orderAlloced; /*!< No. of allocated transaction elements. */
/*@only@*/ TFI_t flList; /*!< Transaction element(s) file info. */
int flEntries; /*!< No. of transaction elements. */
int chrootDone; /*!< Has chroot(2) been been done? */
/*@only@*/ const char * rootDir;/*!< Path to top of install tree. */
/*@only@*/ const char * currDir;/*!< Current working directory. */
/*@null@*/ FD_t scriptFd; /*!< Scriptlet stdout/stderr. */
int delta; /*!< Delta for reallocation. */
int_32 id; /*!< Transaction id. */
int verify_legacy; /*!< Verify legacy signatures? */
/*@observer@*/ /*@dependent@*/ /*@null@*/
const char * fn; /*!< Current package fn. */
int_32 sigtag; /*!< Current package signature tag. */
int_32 sigtype; /*!< Current package signature data type. */
/*@null@*/ const void * sig; /*!< Current package signature. */
int_32 siglen; /*!< Current package signature length. */
/*@null@*/
struct pgpDig_s * dig; /*!< Current signature/pubkey parametrs. */
/*@refs@*/ int nrefs; /*!< Reference count. */
} ;
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_NEED_TEITERATOR)
/*@access teIterator @*/
/*@access rpmTransactionSet @*/
/**
* Return transaction element index.
* @param tei transaction element iterator
* @return element index
*/
/*@unused@*/ static inline
int teGetOc(teIterator tei)
/*@*/
{
return tei->ocsave;
}
/**
* Destroy transaction element iterator.
* @param tei transaction element iterator
* @return NULL always
*/
/*@unused@*/ static inline /*@null@*/
teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
/*@*/
{
if (tei)
tei->ts = rpmtsUnlink(tei->ts, "tsIterator");
return _free(tei);
}
/**
* Create transaction element iterator.
* @param ts transaction set
* @return transaction element iterator
*/
/*@unused@*/ static inline /*@only@*/
teIterator teInitIterator(rpmTransactionSet ts)
/*@modifies ts @*/
{
teIterator tei = NULL;
tei = xcalloc(1, sizeof(*tei));
tei->ts = rpmtsLink(ts, "teIterator");
tei->reverse = ((ts->transFlags & RPMTRANS_FLAG_REVERSE) ? 1 : 0);
tei->oc = (tei->reverse ? (ts->orderCount - 1) : 0);
tei->ocsave = tei->oc;
return tei;
}
/**
* Return next transaction element
* @param tei transaction element iterator
* @return transaction element, NULL on termination
*/
/*@unused@*/ static inline /*@dependent@*/ /*@null@*/
transactionElement teNextIterator(teIterator tei)
/*@modifies tei @*/
{
transactionElement te = NULL;
int oc = -1;
if (tei->reverse) {
if (tei->oc >= 0) oc = tei->oc--;
} else {
if (tei->oc < tei->ts->orderCount) oc = tei->oc++;
}
tei->ocsave = oc;
if (oc != -1)
te = tei->ts->order + oc;
/*@-compdef -usereleased@*/ /* FIX: ts->order may be released */
return te;
/*@=compdef =usereleased@*/
}
/**
* Return next transaction element of type.
* @param tei transaction element iterator
* @return next transaction element of type, NULL on termination
*/
/*@unused@*/ static inline /*@dependent@*/ /*@null@*/
transactionElement teNext(teIterator tei, enum rpmTransactionType type)
/*@modifies tei @*/
{
transactionElement p;
while ((p = teNextIterator(tei)) != NULL) {
if (p->type == type)
break;
}
return p;
}
#endif /* defined(_NEED_TEITERATOR) */
/**
* Return (malloc'd) header name-version-release string.
* @param h header
* @retval np name tag value
* @return name-version-release string
*/
/*@only@*/ char * hGetNVR(Header h, /*@out@*/ const char ** np )
/*@modifies *np @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_DEPENDS */
|