6 * Structures and prototypes used for an "rpmps" problem set.
9 #include <rpmmessages.h> /* for fnpyKey */
15 extern int _rpmps_debug;
18 * Raw data for an element of a problem set.
20 typedef struct rpmProblem_s * rpmProblem;
23 * Transaction problems found while processing a transaction set/
25 typedef struct rpmps_s * rpmps;
27 typedef struct rpmpsi_s * rpmpsi;
30 * Enumerate transaction set problem types.
32 typedef enum rpmProblemType_e {
33 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
34 RPMPROB_BADOS, /*!< package ... is for a different operating system */
35 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
36 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
37 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
38 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
39 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
40 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
41 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
42 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
43 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
47 * Create a problem item.
48 * @param type type of problem
49 * @param pkgNEVR package name
50 * @param key filename or python object address
51 * @param dn directory name
52 * @param bn file base name
53 * @param altNEVR related (e.g. through a dependency) package name
54 * @param ulong1 generic pointer/long attribute
57 rpmProblem rpmProblemCreate(rpmProblemType type,
60 const char * dn, const char * bn,
62 unsigned long ulong1);
65 * Destroy a problem item.
66 * @param prob rpm problem
67 * @return rpm problem (NULL)
69 rpmProblem rpmProblemFree(rpmProblem prob);
73 * @param prob rpm problem
74 * @return package NEVR
76 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
78 * Return related (e.g. through a dependency) package NEVR
79 * @param prob rpm problem
80 * @return related (e.g. through a dependency) package NEVR
82 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
85 * Return type of problem (dependency, diskpace etc)
86 * @param prob rpm problem
87 * @return type of problem
90 rpmProblemType rpmProblemGetType(const rpmProblem prob);
93 * Return filename or python object address of a problem
94 * @param prob rpm problem
95 * @return filename or python object address
97 fnpyKey rpmProblemGetKey(const rpmProblem prob);
100 * Return a generic data string from a problem
101 * @param prob rpm problem
102 * @return a generic data string
103 * @todo needs a better name
105 const char * rpmProblemGetStr(const rpmProblem prob);
107 * Return generic pointer/long attribute from a problem
108 * @param prob rpm problem
109 * @return a generic pointer/long attribute
110 * @todo needs a better name
112 unsigned long rpmProblemGetLong(const rpmProblem prob);
115 * Return formatted string representation of a problem.
116 * @param prob rpm problem
117 * @return formatted string (malloc'd)
119 extern const char * rpmProblemString(const rpmProblem prob);
122 * Unreference a problem set instance.
123 * @param ps problem set
125 * @return problem set
127 rpmps rpmpsUnlink (rpmps ps,
130 /** @todo Remove debugging entry from the ABI. */
131 rpmps XrpmpsUnlink (rpmps ps,
132 const char * msg, const char * fn, unsigned ln);
133 #define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
136 * Reference a problem set instance.
137 * @param ps transaction set
139 * @return new transaction set reference
141 rpmps rpmpsLink (rpmps ps, const char * msg);
143 /** @todo Remove debugging entry from the ABI. */
144 rpmps XrpmpsLink (rpmps ps,
145 const char * msg, const char * fn, unsigned ln);
146 #define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
149 * Return number of problems in set.
150 * @param ps problem set
151 * @return number of problems
153 int rpmpsNumProblems(rpmps ps);
156 * Initialize problem set iterator.
157 * @param ps problem set
158 * @return problem set iterator
160 rpmpsi rpmpsInitIterator(rpmps ps);
163 * Destroy problem set iterator.
164 * @param psi problem set iterator
165 * @return problem set iterator (NULL)
167 rpmpsi rpmpsFreeIterator(rpmpsi psi);
170 * Return next problem set iterator index
171 * @param psi problem set iterator
172 * @return iterator index, -1 on termination
174 int rpmpsNextIterator(rpmpsi psi);
177 * Return current problem from problem set
178 * @param psi problem set iterator
179 * @return current rpmProblem
181 rpmProblem rpmpsGetProblem(rpmpsi psi);
184 * Create a problem set.
185 * @return new problem set
187 rpmps rpmpsCreate(void);
190 * Destroy a problem set.
191 * @param ps problem set
192 * @return NULL always
194 rpmps rpmpsFree(rpmps ps);
197 * Print problems to file handle.
198 * @param fp file handle (NULL uses stderr)
199 * @param ps problem set
201 void rpmpsPrint(FILE *fp, rpmps ps);
204 * Append a problem to current set of problems.
205 * @param ps problem set
206 * @param prob rpmProblem
208 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
211 * Append a problem to current set of problems.
212 * @param ps problem set
213 * @param type type of problem
214 * @param pkgNEVR package name
215 * @param key filename or python object address
216 * @param dn directory name
217 * @param bn file base name
218 * @param altNEVR related (e.g. through a dependency) package name
219 * @param ulong1 generic pointer/long attribute
221 void rpmpsAppend(rpmps ps, rpmProblemType type,
222 const char * pkgNEVR,
224 const char * dn, const char * bn,
225 const char * altNEVR,
226 unsigned long ulong1);
229 * Filter a problem set.
231 * As the problem sets are generated in an order solely dependent
232 * on the ordering of the packages in the transaction, and that
233 * ordering can't be changed, the problem sets must be parallel to
234 * one another. Additionally, the filter set must be a subset of the
235 * target set, given the operations available on transaction set.
236 * This is good, as it lets us perform this trim in linear time, rather
237 * then logarithmic or quadratic.
239 * @param ps problem set
240 * @param filter problem filter (or NULL)
241 * @return 0 no problems, 1 if problems remain
243 int rpmpsTrim(rpmps ps, rpmps filter);