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 */
61 int numProblems; /*!< Current probs array size. */
62 int numProblemsAlloced; /*!< Allocated probs array size. */
63 rpmProblem probs; /*!< Array of specific problems. */
64 int nrefs; /*!< Reference count. */
73 * Return formatted string representation of a problem.
74 * @param prob rpm problem
75 * @return formatted string (malloc'd)
77 extern const char * rpmProblemString(const rpmProblem prob);
80 * Unreference a problem set instance.
81 * @param ps problem set
85 rpmps rpmpsUnlink (rpmps ps,
88 /** @todo Remove debugging entry from the ABI. */
89 rpmps XrpmpsUnlink (rpmps ps,
90 const char * msg, const char * fn, unsigned ln);
91 #define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
94 * Reference a problem set instance.
95 * @param ps transaction set
97 * @return new transaction set reference
99 rpmps rpmpsLink (rpmps ps, const char * msg);
101 /** @todo Remove debugging entry from the ABI. */
102 rpmps XrpmpsLink (rpmps ps,
103 const char * msg, const char * fn, unsigned ln);
104 #define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
107 * Return number of problems in set.
108 * @param ps problem set
109 * @return number of problems
111 int rpmpsNumProblems(rpmps ps);
114 * Initialize problem set iterator.
115 * @param ps problem set
116 * @return problem set iterator
118 rpmpsi rpmpsInitIterator(rpmps ps);
121 * Destroy problem set iterator.
122 * @param psi problem set iterator
123 * @return problem set iterator (NULL)
125 rpmpsi rpmpsFreeIterator(rpmpsi psi);
128 * Return next problem set iterator index
129 * @param psi problem set iterator
130 * @return iterator index, -1 on termination
132 int rpmpsNextIterator(rpmpsi psi);
135 * Return current problem from problem set
136 * @param psi problem set iterator
137 * @return current rpmProblem
139 rpmProblem rpmpsProblem(rpmpsi psi);
142 * Create a problem set.
143 * @return new problem set
145 rpmps rpmpsCreate(void);
148 * Destroy a problem set.
149 * @param ps problem set
150 * @return NULL always
152 rpmps rpmpsFree(rpmps ps);
155 * Print problems to file handle.
156 * @param fp file handle (NULL uses stderr)
157 * @param ps problem set
159 void rpmpsPrint(FILE *fp, rpmps ps);
162 * Append a problem to current set of problems.
163 * @param ps problem set
164 * @param type type of problem
165 * @param pkgNEVR package name
166 * @param key filename or python object address
167 * @param dn directory name
168 * @param bn file base name
169 * @param altNEVR related (e.g. through a dependency) package name
170 * @param ulong1 generic pointer/long attribute
172 void rpmpsAppend(rpmps ps, rpmProblemType type,
173 const char * pkgNEVR,
175 const char * dn, const char * bn,
176 const char * altNEVR,
177 unsigned long ulong1);
180 * Filter a problem set.
182 * As the problem sets are generated in an order solely dependent
183 * on the ordering of the packages in the transaction, and that
184 * ordering can't be changed, the problem sets must be parallel to
185 * one another. Additionally, the filter set must be a subset of the
186 * target set, given the operations available on transaction set.
187 * This is good, as it lets us perform this trim in linear time, rather
188 * then logarithmic or quadratic.
190 * @param ps problem set
191 * @param filter problem filter (or NULL)
192 * @return 0 no problems, 1 if problems remain
194 int rpmpsTrim(rpmps ps, rpmps filter);