6 * Structures and prototypes used for an "rpmps" problem set.
10 #include <rpm/rpmcallback.h> /* for fnpyKey */
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 ulong1 generic pointer/long attribute
74 rpmProblem rpmProblemCreate(rpmProblemType type,
77 const char * dn, const char * bn,
79 unsigned long ulong1);
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);
124 * Return generic pointer/long attribute from a problem
125 * @param prob rpm problem
126 * @return a generic pointer/long attribute
127 * @todo needs a better name
129 unsigned long rpmProblemGetLong(const rpmProblem prob);
132 * Return formatted string representation of a problem.
133 * @param prob rpm problem
134 * @return formatted string (malloc'd)
136 extern char * rpmProblemString(const rpmProblem prob);
139 * Unreference a problem set instance.
140 * @param ps problem set
142 * @return problem set
144 rpmps rpmpsUnlink (rpmps ps,
148 * Reference a problem set instance.
149 * @param ps transaction set
151 * @return new transaction set reference
153 rpmps rpmpsLink (rpmps ps, const char * msg);
156 * Return number of problems in set.
157 * @param ps problem set
158 * @return number of problems
160 int rpmpsNumProblems(rpmps ps);
163 * Initialize problem set iterator.
164 * @param ps problem set
165 * @return problem set iterator
167 rpmpsi rpmpsInitIterator(rpmps ps);
170 * Destroy problem set iterator.
171 * @param psi problem set iterator
172 * @return problem set iterator (NULL)
174 rpmpsi rpmpsFreeIterator(rpmpsi psi);
177 * Return next problem set iterator index
178 * @param psi problem set iterator
179 * @return iterator index, -1 on termination
181 int rpmpsNextIterator(rpmpsi psi);
184 * Return current problem from problem set
185 * @param psi problem set iterator
186 * @return current rpmProblem
188 rpmProblem rpmpsGetProblem(rpmpsi psi);
191 * Create a problem set.
192 * @return new problem set
194 rpmps rpmpsCreate(void);
197 * Destroy a problem set.
198 * @param ps problem set
199 * @return NULL always
201 rpmps rpmpsFree(rpmps ps);
204 * Print problems to file handle.
205 * @param fp file handle (NULL uses stderr)
206 * @param ps problem set
208 void rpmpsPrint(FILE *fp, rpmps ps);
211 * Append a problem to current set of problems.
212 * @param ps problem set
213 * @param prob rpmProblem
215 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
218 * Append a problem to current set of problems.
219 * @param ps problem set
220 * @param type type of problem
221 * @param pkgNEVR package name
222 * @param key filename or python object address
223 * @param dn directory name
224 * @param bn file base name
225 * @param altNEVR related (e.g. through a dependency) package name
226 * @param ulong1 generic pointer/long attribute
228 void rpmpsAppend(rpmps ps, rpmProblemType type,
229 const char * pkgNEVR,
231 const char * dn, const char * bn,
232 const char * altNEVR,
233 unsigned long ulong1);
236 * Filter a problem set.
238 * As the problem sets are generated in an order solely dependent
239 * on the ordering of the packages in the transaction, and that
240 * ordering can't be changed, the problem sets must be parallel to
241 * one another. Additionally, the filter set must be a subset of the
242 * target set, given the operations available on transaction set.
243 * This is good, as it lets us perform this trim in linear time, rather
244 * then logarithmic or quadratic.
246 * @param ps problem set
247 * @param filter problem filter (or NULL)
248 * @return 0 no problems, 1 if problems remain
250 int rpmpsTrim(rpmps ps, rpmps filter);