summaryrefslogtreecommitdiff
path: root/lib/rpmal.h
blob: 418eab2e6781dcbe0f2da1952f4d0ceefa6fe61b (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
#ifndef H_RPMAL
#define H_RPMAL

/** \ingroup rpmdep rpmtrans
 * \file lib/rpmal.h
 * Structures used for managing added/available package lists.
 */

/**
 * A package from an availableList.
 */
typedef /*@abstract@*/ struct availablePackage_s * availablePackage;

/**
 * Return number of packages in list.
 * @param al		available list
 * @return		no. of packages in list
 */
int alGetSize(const availableList al)
	/*@*/;

#ifdef	DYING
/**
 * Return available package multiLib flag.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		available package multiLib flag
 */
int alGetMultiLib(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;

/**
 * Return available package files count.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		available package files count
 */
int alGetFilesCount(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;

/**
 * Return available package provides.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		available package provides
 */
/*@null@*/
rpmDepSet alGetProvides(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;

/**
 * Return available package requires.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		available package requires
 */
/*@null@*/
rpmDepSet alGetRequires(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;
#endif

/**
 * Return available package header.
 * @param al		available list
 * @param pkgKey	available package key
 * @param unlink	Should alp->h be unlinked?
 * @return		available package header
 */
Header alGetHeader(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey,
		int unlink)
	/*@modifies al @*/;

/**
 * Return available package.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		available package pointer
 */
/*@-exportlocal@*/
/*@dependent@*/ /*@null@*/
availablePackage alGetPkg(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;
/*@=exportlocal@*/

/**
 * Return (malloc'd) available package name-version-release string.
 * @param al		available list
 * @param pkgKey	available package key
 * @return		name-version-release string
 */
/*@only@*/ /*@null@*/
char * alGetNVR(/*@null@*/const availableList al, /*@null@*/ alKey pkgKey)
	/*@*/;

/**
 * Initialize available packckages, items, and directory list.
 * @param delta		no. of entries to add on each realloc
 * @return al		new available list
 */
/*@only@*/
availableList alCreate(int delta)
	/*@*/;

/**
 * Free available packages, items, and directory members.
 * @param al		available list
 * @return		NULL always
 */
/*@null@*/
availableList alFree(/*@only@*/ /*@null@*/ availableList al)
	/*@modifies al @*/;

/**
 * Delete package from available list.
 * @param al		available list
 * @param pkgKey	package key
 */
/*@-exportlocal@*/
void alDelPackage(availableList al, /*@null@*/ alKey pkgKey)
	/*@modifies al @*/;
/*@=exportlocal@*/

/**
 * Add package to available list.
 * @param al		available list
 * @param pkgKey	package key, RPMAL_NOMATCH to force an append
 * @param key		associated file name/python object
 * @param h		package header
 * @param provides	provides dependency set
 * @param fns		file info set
 * @return		available package index
 */
alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey,
		fnpyKey key, Header h, rpmDepSet provides, rpmFNSet fns)
	/*@modifies al, h, fns @*/;

/**
 * Add package provides to available list index.
 * @param al		available list
 * @param pkgKey	package key
 * @param provides	added package provides
 */
/*@-exportlocal@*/
void alAddProvides(availableList al, /*@null@*/ alKey pkgKey,
		/*@null@*/ rpmDepSet provides)
	/*@modifies al, provides @*/;
/*@=exportlocal@*/

/**
 * Generate index for available list.
 * @param al		available list
 */
void alMakeIndex(availableList al)
	/*@modifies al @*/;

/**
 * Check added package file lists for package(s) that provide a file.
 * @param al		available list
 * @param ds		dependency set
 * @retval keyp		added package key pointer (or NULL)
 * @return		associated package key(s), NULL if none
 */
/*@-exportlocal@*/
/*@only@*/ /*@null@*/
fnpyKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds,
		/*@null@*/ alKey * keyp)
	/*@globals fileSystem @*/
	/*@modifies al, *keyp, fileSystem @*/;
/*@=exportlocal@*/

/**
 * Check added package file lists for package(s) that have a provide.
 * @param al		available list
 * @param ds		dependency set
 * @retval keyp		added package key pointer (or NULL)
 * @return		associated package key(s), NULL if none
 */
/*@only@*/ /*@null@*/
fnpyKey * alAllSatisfiesDepend(const availableList al, const rpmDepSet ds,
		/*@null@*/ alKey * keyp)
	/*@globals fileSystem @*/
	/*@modifies al, *keyp, fileSystem @*/;

/**
 * Check added package file lists for first package that has a provide.
 * @todo Eliminate.
 * @param al		available list
 * @param ds		dependency set
 * @retval keyp		added package key pointer (or NULL)
 * @return		associated package key, NULL if none
 */
fnpyKey alSatisfiesDepend(const availableList al, const rpmDepSet ds,
		/*@null@*/ alKey * keyp)
	/*@globals fileSystem @*/
	/*@modifies al, *keyp, fileSystem @*/;

#ifdef __cplusplus
}
#endif

#endif	/* H_RPMAL */