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 * Problem set iterator
42 typedef struct rpmpsi_s * rpmpsi;
45 * Enumerate transaction set problem types.
47 typedef enum rpmProblemType_e {
48 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
49 RPMPROB_BADOS, /*!< package ... is for a different operating system */
50 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
51 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
52 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
53 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
54 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
55 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
56 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
57 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
58 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
62 * Create a problem item.
63 * @param type type of problem
64 * @param pkgNEVR package name
65 * @param key filename or python object address
66 * @param dn directory name
67 * @param bn file base name
68 * @param altNEVR related (e.g. through a dependency) package name
69 * @param number generic number attribute
72 rpmProblem rpmProblemCreate(rpmProblemType type,
75 const char * dn, const char * bn,
80 * Destroy a problem item.
81 * @param prob rpm problem
82 * @return rpm problem (NULL)
84 rpmProblem rpmProblemFree(rpmProblem prob);
87 * Reference an rpmProblem instance
88 * @param prob rpm problem
91 rpmProblem rpmProblemLink(rpmProblem prob);
94 * Unreference an rpmProblem instance
95 * @param prob rpm problem
98 rpmProblem rpmProblemUnlink(rpmProblem prob);
101 * Return package NEVR
102 * @param prob rpm problem
103 * @return package NEVR
105 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
107 * Return related (e.g. through a dependency) package NEVR
108 * @param prob rpm problem
109 * @return related (e.g. through a dependency) package NEVR
111 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
114 * Return type of problem (dependency, diskpace etc)
115 * @param prob rpm problem
116 * @return type of problem
119 rpmProblemType rpmProblemGetType(const rpmProblem prob);
122 * Return filename or python object address of a problem
123 * @param prob rpm problem
124 * @return filename or python object address
126 fnpyKey rpmProblemGetKey(const rpmProblem prob);
129 * Return a generic data string from a problem
130 * @param prob rpm problem
131 * @return a generic data string
132 * @todo needs a better name
134 const char * rpmProblemGetStr(const rpmProblem prob);
137 * Return disk requirement (needed disk space / number of inodes)
138 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
139 * and RPMPROB_DISKNODES return value is undefined.
140 * @param prob rpm problem
141 * @return disk requirement
143 rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
146 * Return formatted string representation of a problem.
147 * @param prob rpm problem
148 * @return formatted string (malloc'd)
150 char * rpmProblemString(const rpmProblem prob);
153 * Unreference a problem set instance.
154 * @param ps problem set
156 * @return problem set
158 rpmps rpmpsUnlink (rpmps ps,
162 * Reference a problem set instance.
163 * @param ps transaction set
165 * @return new transaction set reference
167 rpmps rpmpsLink (rpmps ps, const char * msg);
170 * Return number of problems in set.
171 * @param ps problem set
172 * @return number of problems
174 int rpmpsNumProblems(rpmps ps);
177 * Initialize problem set iterator.
178 * @param ps problem set
179 * @return problem set iterator
181 rpmpsi rpmpsInitIterator(rpmps ps);
184 * Destroy problem set iterator.
185 * @param psi problem set iterator
186 * @return problem set iterator (NULL)
188 rpmpsi rpmpsFreeIterator(rpmpsi psi);
191 * Return next problem set iterator index
192 * @param psi problem set iterator
193 * @return iterator index, -1 on termination
195 int rpmpsNextIterator(rpmpsi psi);
198 * Return current problem from problem set
199 * @param psi problem set iterator
200 * @return current rpmProblem
202 rpmProblem rpmpsGetProblem(rpmpsi psi);
205 * Create a problem set.
206 * @return new problem set
208 rpmps rpmpsCreate(void);
211 * Destroy a problem set.
212 * @param ps problem set
213 * @return NULL always
215 rpmps rpmpsFree(rpmps ps);
218 * Print problems to file handle.
219 * @param fp file handle (NULL uses stderr)
220 * @param ps problem set
222 void rpmpsPrint(FILE *fp, rpmps ps);
225 * Append a problem to current set of problems.
226 * @param ps problem set
227 * @param prob rpmProblem
229 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
232 * Append a problem to current set of problems.
233 * @param ps problem set
234 * @param type type of problem
235 * @param pkgNEVR package name
236 * @param key filename or python object address
237 * @param dn directory name
238 * @param bn file base name
239 * @param altNEVR related (e.g. through a dependency) package name
240 * @param number generic number attribute
242 void rpmpsAppend(rpmps ps, rpmProblemType type,
243 const char * pkgNEVR,
245 const char * dn, const char * bn,
246 const char * altNEVR,
250 * Filter a problem set.
252 * As the problem sets are generated in an order solely dependent
253 * on the ordering of the packages in the transaction, and that
254 * ordering can't be changed, the problem sets must be parallel to
255 * one another. Additionally, the filter set must be a subset of the
256 * target set, given the operations available on transaction set.
257 * This is good, as it lets us perform this trim in linear time, rather
258 * then logarithmic or quadratic.
260 * @param ps problem set
261 * @param filter problem filter (or NULL)
262 * @return 0 no problems, 1 if problems remain
264 int rpmpsTrim(rpmps ps, rpmps filter);