6
* Structures and prototypes used for an "rpmps" problem set.
10
#include <rpm/rpmtypes.h>
16
extern int _rpmps_debug;
19
* @todo Generalize filter mechanism.
21
typedef enum rpmprobFilterFlags_e {
22
RPMPROB_FILTER_NONE = 0,
23
RPMPROB_FILTER_IGNOREOS = (1 << 0), /*!< from --ignoreos */
24
RPMPROB_FILTER_IGNOREARCH = (1 << 1), /*!< from --ignorearch */
25
RPMPROB_FILTER_REPLACEPKG = (1 << 2), /*!< from --replacepkgs */
26
RPMPROB_FILTER_FORCERELOCATE= (1 << 3), /*!< from --badreloc */
27
RPMPROB_FILTER_REPLACENEWFILES= (1 << 4), /*!< from --replacefiles */
28
RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5), /*!< from --replacefiles */
29
RPMPROB_FILTER_OLDPACKAGE = (1 << 6), /*!< from --oldpackage */
30
RPMPROB_FILTER_DISKSPACE = (1 << 7), /*!< from --ignoresize */
31
RPMPROB_FILTER_DISKNODES = (1 << 8) /*!< from --ignoresize */
35
* Raw data for an element of a problem set.
37
typedef struct rpmProblem_s * rpmProblem;
40
* Transaction problems found while processing a transaction set/
42
typedef struct rpmps_s * rpmps;
44
typedef struct rpmpsi_s * rpmpsi;
47
* Enumerate transaction set problem types.
49
typedef enum rpmProblemType_e {
50
RPMPROB_BADARCH, /*!< package ... is for a different architecture */
51
RPMPROB_BADOS, /*!< package ... is for a different operating system */
52
RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
53
RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
54
RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
55
RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
56
RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
57
RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
58
RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
59
RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
60
RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
64
* Create a problem item.
65
* @param type type of problem
66
* @param pkgNEVR package name
67
* @param key filename or python object address
68
* @param dn directory name
69
* @param bn file base name
70
* @param altNEVR related (e.g. through a dependency) package name
71
* @param number generic number attribute
74
rpmProblem rpmProblemCreate(rpmProblemType type,
77
const char * dn, const char * bn,
82
* Destroy a problem item.
83
* @param prob rpm problem
84
* @return rpm problem (NULL)
86
rpmProblem rpmProblemFree(rpmProblem prob);
90
* @param prob rpm problem
91
* @return package NEVR
93
const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
95
* Return related (e.g. through a dependency) package NEVR
96
* @param prob rpm problem
97
* @return related (e.g. through a dependency) package NEVR
99
const char * rpmProblemGetAltNEVR(const rpmProblem prob);
102
* Return type of problem (dependency, diskpace etc)
103
* @param prob rpm problem
104
* @return type of problem
107
rpmProblemType rpmProblemGetType(const rpmProblem prob);
110
* Return filename or python object address of a problem
111
* @param prob rpm problem
112
* @return filename or python object address
114
fnpyKey rpmProblemGetKey(const rpmProblem prob);
117
* Return a generic data string from a problem
118
* @param prob rpm problem
119
* @return a generic data string
120
* @todo needs a better name
122
const char * rpmProblemGetStr(const rpmProblem prob);
125
* Return disk requirement (needed disk space / number of inodes)
126
* depending on problem type. On problem types other than RPMPROB_DISKSPACE
127
* and RPMPROB_DISKNODES return value is undefined.
128
* @param prob rpm problem
129
* @return disk requirement
131
rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
134
* Return formatted string representation of a problem.
135
* @param prob rpm problem
136
* @return formatted string (malloc'd)
138
char * rpmProblemString(const rpmProblem prob);
141
* Unreference a problem set instance.
142
* @param ps problem set
144
* @return problem set
146
rpmps rpmpsUnlink (rpmps ps,
150
* Reference a problem set instance.
151
* @param ps transaction set
153
* @return new transaction set reference
155
rpmps rpmpsLink (rpmps ps, const char * msg);
158
* Return number of problems in set.
159
* @param ps problem set
160
* @return number of problems
162
int rpmpsNumProblems(rpmps ps);
165
* Initialize problem set iterator.
166
* @param ps problem set
167
* @return problem set iterator
169
rpmpsi rpmpsInitIterator(rpmps ps);
172
* Destroy problem set iterator.
173
* @param psi problem set iterator
174
* @return problem set iterator (NULL)
176
rpmpsi rpmpsFreeIterator(rpmpsi psi);
179
* Return next problem set iterator index
180
* @param psi problem set iterator
181
* @return iterator index, -1 on termination
183
int rpmpsNextIterator(rpmpsi psi);
186
* Return current problem from problem set
187
* @param psi problem set iterator
188
* @return current rpmProblem
190
rpmProblem rpmpsGetProblem(rpmpsi psi);
193
* Create a problem set.
194
* @return new problem set
196
rpmps rpmpsCreate(void);
199
* Destroy a problem set.
200
* @param ps problem set
201
* @return NULL always
203
rpmps rpmpsFree(rpmps ps);
206
* Print problems to file handle.
207
* @param fp file handle (NULL uses stderr)
208
* @param ps problem set
210
void rpmpsPrint(FILE *fp, rpmps ps);
213
* Append a problem to current set of problems.
214
* @param ps problem set
215
* @param prob rpmProblem
217
void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
220
* Append a problem to current set of problems.
221
* @param ps problem set
222
* @param type type of problem
223
* @param pkgNEVR package name
224
* @param key filename or python object address
225
* @param dn directory name
226
* @param bn file base name
227
* @param altNEVR related (e.g. through a dependency) package name
228
* @param number generic number attribute
230
void rpmpsAppend(rpmps ps, rpmProblemType type,
231
const char * pkgNEVR,
233
const char * dn, const char * bn,
234
const char * altNEVR,
238
* Filter a problem set.
240
* As the problem sets are generated in an order solely dependent
241
* on the ordering of the packages in the transaction, and that
242
* ordering can't be changed, the problem sets must be parallel to
243
* one another. Additionally, the filter set must be a subset of the
244
* target set, given the operations available on transaction set.
245
* This is good, as it lets us perform this trim in linear time, rather
246
* then logarithmic or quadratic.
248
* @param ps problem set
249
* @param filter problem filter (or NULL)
250
* @return 0 no problems, 1 if problems remain
252
int rpmpsTrim(rpmps ps, rpmps filter);