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 */
48 * @param prob rpm problem
49 * @return package NEVR
51 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
53 * Return related (e.g. through a dependency) package NEVR
54 * @param prob rpm problem
55 * @return related (e.g. through a dependency) package NEVR
57 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
60 * Return type of problem (dependency, diskpace etc)
61 * @param prob rpm problem
62 * @return type of problem
65 rpmProblemType rpmProblemGetType(const rpmProblem prob);
68 * Return filename or python object address of a problem
69 * @param prob rpm problem
70 * @return filename or python object address
72 fnpyKey rpmProblemGetKey(const rpmProblem prob);
75 * Return a generic data string from a problem
76 * @param prob rpm problem
77 * @return a generic data string
78 * @todo needs a better name
80 const char * rpmProblemGetStr(const rpmProblem prob);
82 * Return generic pointer/long attribute from a problem
83 * @param prob rpm problem
84 * @return a generic pointer/long attribute
85 * @todo needs a better name
87 unsigned long rpmProblemGetLong(const rpmProblem prob);
90 * Return formatted string representation of a problem.
91 * @param prob rpm problem
92 * @return formatted string (malloc'd)
94 extern const char * rpmProblemString(const rpmProblem prob);
97 * Unreference a problem set instance.
98 * @param ps problem set
100 * @return problem set
102 rpmps rpmpsUnlink (rpmps ps,
105 /** @todo Remove debugging entry from the ABI. */
106 rpmps XrpmpsUnlink (rpmps ps,
107 const char * msg, const char * fn, unsigned ln);
108 #define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
111 * Reference a problem set instance.
112 * @param ps transaction set
114 * @return new transaction set reference
116 rpmps rpmpsLink (rpmps ps, const char * msg);
118 /** @todo Remove debugging entry from the ABI. */
119 rpmps XrpmpsLink (rpmps ps,
120 const char * msg, const char * fn, unsigned ln);
121 #define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
124 * Return number of problems in set.
125 * @param ps problem set
126 * @return number of problems
128 int rpmpsNumProblems(rpmps ps);
131 * Initialize problem set iterator.
132 * @param ps problem set
133 * @return problem set iterator
135 rpmpsi rpmpsInitIterator(rpmps ps);
138 * Destroy problem set iterator.
139 * @param psi problem set iterator
140 * @return problem set iterator (NULL)
142 rpmpsi rpmpsFreeIterator(rpmpsi psi);
145 * Return next problem set iterator index
146 * @param psi problem set iterator
147 * @return iterator index, -1 on termination
149 int rpmpsNextIterator(rpmpsi psi);
152 * Return current problem from problem set
153 * @param psi problem set iterator
154 * @return current rpmProblem
156 rpmProblem rpmpsProblem(rpmpsi psi);
159 * Create a problem set.
160 * @return new problem set
162 rpmps rpmpsCreate(void);
165 * Destroy a problem set.
166 * @param ps problem set
167 * @return NULL always
169 rpmps rpmpsFree(rpmps ps);
172 * Print problems to file handle.
173 * @param fp file handle (NULL uses stderr)
174 * @param ps problem set
176 void rpmpsPrint(FILE *fp, rpmps ps);
179 * Append a problem to current set of problems.
180 * @param ps problem set
181 * @param type type of problem
182 * @param pkgNEVR package name
183 * @param key filename or python object address
184 * @param dn directory name
185 * @param bn file base name
186 * @param altNEVR related (e.g. through a dependency) package name
187 * @param ulong1 generic pointer/long attribute
189 void rpmpsAppend(rpmps ps, rpmProblemType type,
190 const char * pkgNEVR,
192 const char * dn, const char * bn,
193 const char * altNEVR,
194 unsigned long ulong1);
197 * Filter a problem set.
199 * As the problem sets are generated in an order solely dependent
200 * on the ordering of the packages in the transaction, and that
201 * ordering can't be changed, the problem sets must be parallel to
202 * one another. Additionally, the filter set must be a subset of the
203 * target set, given the operations available on transaction set.
204 * This is good, as it lets us perform this trim in linear time, rather
205 * then logarithmic or quadratic.
207 * @param ps problem set
208 * @param filter problem filter (or NULL)
209 * @return 0 no problems, 1 if problems remain
211 int rpmpsTrim(rpmps ps, rpmps filter);