6 * Structures and prototypes used for an "rpmps" problem set.
10 #include <rpm/rpmtypes.h>
17 * @todo Generalize filter mechanism.
19 typedef enum rpmprobFilterFlags_e {
20 RPMPROB_FILTER_NONE = 0,
21 RPMPROB_FILTER_IGNOREOS = (1 << 0), /*!< from --ignoreos */
22 RPMPROB_FILTER_IGNOREARCH = (1 << 1), /*!< from --ignorearch */
23 RPMPROB_FILTER_REPLACEPKG = (1 << 2), /*!< from --replacepkgs */
24 RPMPROB_FILTER_FORCERELOCATE= (1 << 3), /*!< from --badreloc */
25 RPMPROB_FILTER_REPLACENEWFILES= (1 << 4), /*!< from --replacefiles */
26 RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5), /*!< from --replacefiles */
27 RPMPROB_FILTER_OLDPACKAGE = (1 << 6), /*!< from --oldpackage */
28 RPMPROB_FILTER_DISKSPACE = (1 << 7), /*!< from --ignoresize */
29 RPMPROB_FILTER_DISKNODES = (1 << 8) /*!< from --ignoresize */
33 * Raw data for an element of a problem set.
35 typedef struct rpmProblem_s * rpmProblem;
38 * Problem set iterator
40 typedef struct rpmpsi_s * rpmpsi;
43 * Enumerate transaction set problem types.
45 typedef enum rpmProblemType_e {
46 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
47 RPMPROB_BADOS, /*!< package ... is for a different operating system */
48 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
49 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
50 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
51 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
52 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
53 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
54 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
55 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
56 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
57 RPMPROB_OBSOLETES, /*!< package ... is obsoleted by ... */
61 * Create a problem item.
62 * @param type type of problem
63 * @param pkgNEVR package name
64 * @param key filename or python object address
65 * @param dn directory name
66 * @param bn file base name
67 * @param altNEVR related (e.g. through a dependency) package name
68 * @param number generic number attribute
71 rpmProblem rpmProblemCreate(rpmProblemType type,
74 const char * dn, const char * bn,
79 * Destroy a problem item.
80 * @param prob rpm problem
81 * @return rpm problem (NULL)
83 rpmProblem rpmProblemFree(rpmProblem prob);
86 * Reference an rpmProblem instance
87 * @param prob rpm problem
90 rpmProblem rpmProblemLink(rpmProblem prob);
93 * Unreference an rpmProblem instance
94 * @param prob rpm problem
97 rpmProblem rpmProblemUnlink(rpmProblem prob);
100 * Return package NEVR
101 * @param prob rpm problem
102 * @return package NEVR
104 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
106 * Return related (e.g. through a dependency) package NEVR
107 * @param prob rpm problem
108 * @return related (e.g. through a dependency) package NEVR
110 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
113 * Return type of problem (dependency, diskpace etc)
114 * @param prob rpm problem
115 * @return type of problem
118 rpmProblemType rpmProblemGetType(const rpmProblem prob);
121 * Return filename or python object address of a problem
122 * @param prob rpm problem
123 * @return filename or python object address
125 fnpyKey rpmProblemGetKey(const rpmProblem prob);
128 * Return a generic data string from a problem
129 * @param prob rpm problem
130 * @return a generic data string
131 * @todo needs a better name
133 const char * rpmProblemGetStr(const rpmProblem prob);
136 * Return disk requirement (needed disk space / number of inodes)
137 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
138 * and RPMPROB_DISKNODES return value is undefined.
139 * @param prob rpm problem
140 * @return disk requirement
142 rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
145 * Return formatted string representation of a problem.
146 * @param prob rpm problem
147 * @return formatted string (malloc'd)
149 char * rpmProblemString(const rpmProblem prob);
152 * Unreference a problem set instance.
153 * @param ps problem set
154 * @return problem set
156 rpmps rpmpsUnlink (rpmps ps);
159 * Reference a problem set instance.
160 * @param ps transaction set
161 * @return new transaction set reference
163 rpmps rpmpsLink (rpmps ps);
166 * Return number of problems in set.
167 * @param ps problem set
168 * @return number of problems
170 int rpmpsNumProblems(rpmps ps);
173 * Initialize problem set iterator.
174 * @param ps problem set
175 * @return problem set iterator
177 rpmpsi rpmpsInitIterator(rpmps ps);
180 * Destroy problem set iterator.
181 * @param psi problem set iterator
182 * @return problem set iterator (NULL)
184 rpmpsi rpmpsFreeIterator(rpmpsi psi);
187 * Return next problem set iterator index
188 * @param psi problem set iterator
189 * @return iterator index, -1 on termination
191 int rpmpsNextIterator(rpmpsi psi);
194 * Return current problem from problem set
195 * @param psi problem set iterator
196 * @return current rpmProblem
198 rpmProblem rpmpsGetProblem(rpmpsi psi);
201 * Create a problem set.
202 * @return new problem set
204 rpmps rpmpsCreate(void);
207 * Destroy a problem set.
208 * @param ps problem set
209 * @return NULL always
211 rpmps rpmpsFree(rpmps ps);
214 * Print problems to file handle.
215 * @param fp file handle (NULL uses stderr)
216 * @param ps problem set
218 void rpmpsPrint(FILE *fp, rpmps ps);
221 * Append a problem to current set of problems.
222 * @param ps problem set
223 * @param prob rpmProblem
225 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
228 * Append a problem to current set of problems.
229 * @param ps problem set
230 * @param type type of problem
231 * @param pkgNEVR package name
232 * @param key filename or python object address
233 * @param dn directory name
234 * @param bn file base name
235 * @param altNEVR related (e.g. through a dependency) package name
236 * @param number generic number attribute
238 void rpmpsAppend(rpmps ps, rpmProblemType type,
239 const char * pkgNEVR,
241 const char * dn, const char * bn,
242 const char * altNEVR,
246 * Filter a problem set.
248 * As the problem sets are generated in an order solely dependent
249 * on the ordering of the packages in the transaction, and that
250 * ordering can't be changed, the problem sets must be parallel to
251 * one another. Additionally, the filter set must be a subset of the
252 * target set, given the operations available on transaction set.
253 * This is good, as it lets us perform this trim in linear time, rather
254 * then logarithmic or quadratic.
256 * @param ps problem set
257 * @param filter problem filter (or NULL)
258 * @return 0 no problems, 1 if problems remain
260 int rpmpsTrim(rpmps ps, rpmps filter);