6 * Structures and prototypes used for an "rpmps" problem set.
10 #include <rpm/rpmtypes.h>
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 * Problem set iterator
42 typedef struct rpmpsi_s * rpmpsi;
45 * Enumerate transaction set problem types.
47 typedef enum rpmProblemType_e {
48 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
49 RPMPROB_BADOS, /*!< package ... is for a different operating system */
50 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
51 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
52 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
53 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
54 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
55 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
56 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
57 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
58 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
59 RPMPROB_OBSOLETES, /*!< package ... is obsoleted by ... */
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 number generic number attribute
73 rpmProblem rpmProblemCreate(rpmProblemType type,
76 const char * dn, const char * bn,
81 * Destroy a problem item.
82 * @param prob rpm problem
83 * @return rpm problem (NULL)
85 rpmProblem rpmProblemFree(rpmProblem prob);
88 * Reference an rpmProblem instance
89 * @param prob rpm problem
92 rpmProblem rpmProblemLink(rpmProblem prob);
95 * Unreference an rpmProblem instance
96 * @param prob rpm problem
99 rpmProblem rpmProblemUnlink(rpmProblem prob);
102 * Return package NEVR
103 * @param prob rpm problem
104 * @return package NEVR
106 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
108 * Return related (e.g. through a dependency) package NEVR
109 * @param prob rpm problem
110 * @return related (e.g. through a dependency) package NEVR
112 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
115 * Return type of problem (dependency, diskpace etc)
116 * @param prob rpm problem
117 * @return type of problem
120 rpmProblemType rpmProblemGetType(const rpmProblem prob);
123 * Return filename or python object address of a problem
124 * @param prob rpm problem
125 * @return filename or python object address
127 fnpyKey rpmProblemGetKey(const rpmProblem prob);
130 * Return a generic data string from a problem
131 * @param prob rpm problem
132 * @return a generic data string
133 * @todo needs a better name
135 const char * rpmProblemGetStr(const rpmProblem prob);
138 * Return disk requirement (needed disk space / number of inodes)
139 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
140 * and RPMPROB_DISKNODES return value is undefined.
141 * @param prob rpm problem
142 * @return disk requirement
144 rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
147 * Return formatted string representation of a problem.
148 * @param prob rpm problem
149 * @return formatted string (malloc'd)
151 char * rpmProblemString(const rpmProblem prob);
154 * Unreference a problem set instance.
155 * @param ps problem set
157 * @return problem set
159 rpmps rpmpsUnlink (rpmps ps,
163 * Reference a problem set instance.
164 * @param ps transaction set
166 * @return new transaction set reference
168 rpmps rpmpsLink (rpmps ps, const char * msg);
171 * Return number of problems in set.
172 * @param ps problem set
173 * @return number of problems
175 int rpmpsNumProblems(rpmps ps);
178 * Initialize problem set iterator.
179 * @param ps problem set
180 * @return problem set iterator
182 rpmpsi rpmpsInitIterator(rpmps ps);
185 * Destroy problem set iterator.
186 * @param psi problem set iterator
187 * @return problem set iterator (NULL)
189 rpmpsi rpmpsFreeIterator(rpmpsi psi);
192 * Return next problem set iterator index
193 * @param psi problem set iterator
194 * @return iterator index, -1 on termination
196 int rpmpsNextIterator(rpmpsi psi);
199 * Return current problem from problem set
200 * @param psi problem set iterator
201 * @return current rpmProblem
203 rpmProblem rpmpsGetProblem(rpmpsi psi);
206 * Create a problem set.
207 * @return new problem set
209 rpmps rpmpsCreate(void);
212 * Destroy a problem set.
213 * @param ps problem set
214 * @return NULL always
216 rpmps rpmpsFree(rpmps ps);
219 * Print problems to file handle.
220 * @param fp file handle (NULL uses stderr)
221 * @param ps problem set
223 void rpmpsPrint(FILE *fp, rpmps ps);
226 * Append a problem to current set of problems.
227 * @param ps problem set
228 * @param prob rpmProblem
230 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
233 * Append a problem to current set of problems.
234 * @param ps problem set
235 * @param type type of problem
236 * @param pkgNEVR package name
237 * @param key filename or python object address
238 * @param dn directory name
239 * @param bn file base name
240 * @param altNEVR related (e.g. through a dependency) package name
241 * @param number generic number attribute
243 void rpmpsAppend(rpmps ps, rpmProblemType type,
244 const char * pkgNEVR,
246 const char * dn, const char * bn,
247 const char * altNEVR,
251 * Filter a problem set.
253 * As the problem sets are generated in an order solely dependent
254 * on the ordering of the packages in the transaction, and that
255 * ordering can't be changed, the problem sets must be parallel to
256 * one another. Additionally, the filter set must be a subset of the
257 * target set, given the operations available on transaction set.
258 * This is good, as it lets us perform this trim in linear time, rather
259 * then logarithmic or quadratic.
261 * @param ps problem set
262 * @param filter problem filter (or NULL)
263 * @return 0 no problems, 1 if problems remain
265 int rpmpsTrim(rpmps ps, rpmps filter);