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);
89 * Reference an rpmProblem instance
90 * @param prob rpm problem
93 rpmProblem rpmProblemLink(rpmProblem prob);
96 * Unreference an rpmProblem instance
97 * @param prob rpm problem
100 rpmProblem rpmProblemUnlink(rpmProblem prob);
103 * Return package NEVR
104 * @param prob rpm problem
105 * @return package NEVR
107 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
109 * Return related (e.g. through a dependency) package NEVR
110 * @param prob rpm problem
111 * @return related (e.g. through a dependency) package NEVR
113 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
116 * Return type of problem (dependency, diskpace etc)
117 * @param prob rpm problem
118 * @return type of problem
121 rpmProblemType rpmProblemGetType(const rpmProblem prob);
124 * Return filename or python object address of a problem
125 * @param prob rpm problem
126 * @return filename or python object address
128 fnpyKey rpmProblemGetKey(const rpmProblem prob);
131 * Return a generic data string from a problem
132 * @param prob rpm problem
133 * @return a generic data string
134 * @todo needs a better name
136 const char * rpmProblemGetStr(const rpmProblem prob);
139 * Return disk requirement (needed disk space / number of inodes)
140 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
141 * and RPMPROB_DISKNODES return value is undefined.
142 * @param prob rpm problem
143 * @return disk requirement
145 rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
148 * Return formatted string representation of a problem.
149 * @param prob rpm problem
150 * @return formatted string (malloc'd)
152 char * rpmProblemString(const rpmProblem prob);
155 * Unreference a problem set instance.
156 * @param ps problem set
158 * @return problem set
160 rpmps rpmpsUnlink (rpmps ps,
164 * Reference a problem set instance.
165 * @param ps transaction set
167 * @return new transaction set reference
169 rpmps rpmpsLink (rpmps ps, const char * msg);
172 * Return number of problems in set.
173 * @param ps problem set
174 * @return number of problems
176 int rpmpsNumProblems(rpmps ps);
179 * Initialize problem set iterator.
180 * @param ps problem set
181 * @return problem set iterator
183 rpmpsi rpmpsInitIterator(rpmps ps);
186 * Destroy problem set iterator.
187 * @param psi problem set iterator
188 * @return problem set iterator (NULL)
190 rpmpsi rpmpsFreeIterator(rpmpsi psi);
193 * Return next problem set iterator index
194 * @param psi problem set iterator
195 * @return iterator index, -1 on termination
197 int rpmpsNextIterator(rpmpsi psi);
200 * Return current problem from problem set
201 * @param psi problem set iterator
202 * @return current rpmProblem
204 rpmProblem rpmpsGetProblem(rpmpsi psi);
207 * Create a problem set.
208 * @return new problem set
210 rpmps rpmpsCreate(void);
213 * Destroy a problem set.
214 * @param ps problem set
215 * @return NULL always
217 rpmps rpmpsFree(rpmps ps);
220 * Print problems to file handle.
221 * @param fp file handle (NULL uses stderr)
222 * @param ps problem set
224 void rpmpsPrint(FILE *fp, rpmps ps);
227 * Append a problem to current set of problems.
228 * @param ps problem set
229 * @param prob rpmProblem
231 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
234 * Append a problem to current set of problems.
235 * @param ps problem set
236 * @param type type of problem
237 * @param pkgNEVR package name
238 * @param key filename or python object address
239 * @param dn directory name
240 * @param bn file base name
241 * @param altNEVR related (e.g. through a dependency) package name
242 * @param number generic number attribute
244 void rpmpsAppend(rpmps ps, rpmProblemType type,
245 const char * pkgNEVR,
247 const char * dn, const char * bn,
248 const char * altNEVR,
252 * Filter a problem set.
254 * As the problem sets are generated in an order solely dependent
255 * on the ordering of the packages in the transaction, and that
256 * ordering can't be changed, the problem sets must be parallel to
257 * one another. Additionally, the filter set must be a subset of the
258 * target set, given the operations available on transaction set.
259 * This is good, as it lets us perform this trim in linear time, rather
260 * then logarithmic or quadratic.
262 * @param ps problem set
263 * @param filter problem filter (or NULL)
264 * @return 0 no problems, 1 if problems remain
266 int rpmpsTrim(rpmps ps, rpmps filter);