6 * Structures and prototypes used for an "rpmps" problem set.
9 #include <rpmcallback.h> /* for fnpyKey */
15 extern int _rpmps_debug;
18 * @todo Generalize filter mechanism.
20 typedef enum rpmprobFilterFlags_e {
21 RPMPROB_FILTER_NONE = 0,
22 RPMPROB_FILTER_IGNOREOS = (1 << 0), /*!< from --ignoreos */
23 RPMPROB_FILTER_IGNOREARCH = (1 << 1), /*!< from --ignorearch */
24 RPMPROB_FILTER_REPLACEPKG = (1 << 2), /*!< from --replacepkgs */
25 RPMPROB_FILTER_FORCERELOCATE= (1 << 3), /*!< from --badreloc */
26 RPMPROB_FILTER_REPLACENEWFILES= (1 << 4), /*!< from --replacefiles */
27 RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5), /*!< from --replacefiles */
28 RPMPROB_FILTER_OLDPACKAGE = (1 << 6), /*!< from --oldpackage */
29 RPMPROB_FILTER_DISKSPACE = (1 << 7), /*!< from --ignoresize */
30 RPMPROB_FILTER_DISKNODES = (1 << 8) /*!< from --ignoresize */
34 * Raw data for an element of a problem set.
36 typedef struct rpmProblem_s * rpmProblem;
39 * Transaction problems found while processing a transaction set/
41 typedef struct rpmps_s * rpmps;
43 typedef struct rpmpsi_s * rpmpsi;
46 * Enumerate transaction set problem types.
48 typedef enum rpmProblemType_e {
49 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
50 RPMPROB_BADOS, /*!< package ... is for a different operating system */
51 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
52 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
53 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
54 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
55 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
56 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
57 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
58 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
59 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
63 * Create a problem item.
64 * @param type type of problem
65 * @param pkgNEVR package name
66 * @param key filename or python object address
67 * @param dn directory name
68 * @param bn file base name
69 * @param altNEVR related (e.g. through a dependency) package name
70 * @param ulong1 generic pointer/long attribute
73 rpmProblem rpmProblemCreate(rpmProblemType type,
76 const char * dn, const char * bn,
78 unsigned long ulong1);
81 * Destroy a problem item.
82 * @param prob rpm problem
83 * @return rpm problem (NULL)
85 rpmProblem rpmProblemFree(rpmProblem prob);
89 * @param prob rpm problem
90 * @return package NEVR
92 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
94 * Return related (e.g. through a dependency) package NEVR
95 * @param prob rpm problem
96 * @return related (e.g. through a dependency) package NEVR
98 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
101 * Return type of problem (dependency, diskpace etc)
102 * @param prob rpm problem
103 * @return type of problem
106 rpmProblemType rpmProblemGetType(const rpmProblem prob);
109 * Return filename or python object address of a problem
110 * @param prob rpm problem
111 * @return filename or python object address
113 fnpyKey rpmProblemGetKey(const rpmProblem prob);
116 * Return a generic data string from a problem
117 * @param prob rpm problem
118 * @return a generic data string
119 * @todo needs a better name
121 const char * rpmProblemGetStr(const rpmProblem prob);
123 * Return generic pointer/long attribute from a problem
124 * @param prob rpm problem
125 * @return a generic pointer/long attribute
126 * @todo needs a better name
128 unsigned long rpmProblemGetLong(const rpmProblem prob);
131 * Return formatted string representation of a problem.
132 * @param prob rpm problem
133 * @return formatted string (malloc'd)
135 extern const char * rpmProblemString(const rpmProblem prob);
138 * Unreference a problem set instance.
139 * @param ps problem set
141 * @return problem set
143 rpmps rpmpsUnlink (rpmps ps,
147 * Reference a problem set instance.
148 * @param ps transaction set
150 * @return new transaction set reference
152 rpmps rpmpsLink (rpmps ps, const char * msg);
155 * Return number of problems in set.
156 * @param ps problem set
157 * @return number of problems
159 int rpmpsNumProblems(rpmps ps);
162 * Initialize problem set iterator.
163 * @param ps problem set
164 * @return problem set iterator
166 rpmpsi rpmpsInitIterator(rpmps ps);
169 * Destroy problem set iterator.
170 * @param psi problem set iterator
171 * @return problem set iterator (NULL)
173 rpmpsi rpmpsFreeIterator(rpmpsi psi);
176 * Return next problem set iterator index
177 * @param psi problem set iterator
178 * @return iterator index, -1 on termination
180 int rpmpsNextIterator(rpmpsi psi);
183 * Return current problem from problem set
184 * @param psi problem set iterator
185 * @return current rpmProblem
187 rpmProblem rpmpsGetProblem(rpmpsi psi);
190 * Create a problem set.
191 * @return new problem set
193 rpmps rpmpsCreate(void);
196 * Destroy a problem set.
197 * @param ps problem set
198 * @return NULL always
200 rpmps rpmpsFree(rpmps ps);
203 * Print problems to file handle.
204 * @param fp file handle (NULL uses stderr)
205 * @param ps problem set
207 void rpmpsPrint(FILE *fp, rpmps ps);
210 * Append a problem to current set of problems.
211 * @param ps problem set
212 * @param prob rpmProblem
214 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
217 * Append a problem to current set of problems.
218 * @param ps problem set
219 * @param type type of problem
220 * @param pkgNEVR package name
221 * @param key filename or python object address
222 * @param dn directory name
223 * @param bn file base name
224 * @param altNEVR related (e.g. through a dependency) package name
225 * @param ulong1 generic pointer/long attribute
227 void rpmpsAppend(rpmps ps, rpmProblemType type,
228 const char * pkgNEVR,
230 const char * dn, const char * bn,
231 const char * altNEVR,
232 unsigned long ulong1);
235 * Filter a problem set.
237 * As the problem sets are generated in an order solely dependent
238 * on the ordering of the packages in the transaction, and that
239 * ordering can't be changed, the problem sets must be parallel to
240 * one another. Additionally, the filter set must be a subset of the
241 * target set, given the operations available on transaction set.
242 * This is good, as it lets us perform this trim in linear time, rather
243 * then logarithmic or quadratic.
245 * @param ps problem set
246 * @param filter problem filter (or NULL)
247 * @return 0 no problems, 1 if problems remain
249 int rpmpsTrim(rpmps ps, rpmps filter);