6 * Structures and prototypes used for an "rpmps" problem set.
10 #include <rpm/rpmtypes.h>
17 * @todo Generalize filter mechanism.
19 typedef enum rpmprobFilterFlags_e {
20 RPMPROB_FILTER_NONE = 0,
21 RPMPROB_FILTER_IGNOREOS = (1 << 0), /*!< from --ignoreos */
22 RPMPROB_FILTER_IGNOREARCH = (1 << 1), /*!< from --ignorearch */
23 RPMPROB_FILTER_REPLACEPKG = (1 << 2), /*!< from --replacepkgs */
24 RPMPROB_FILTER_FORCERELOCATE= (1 << 3), /*!< from --badreloc */
25 RPMPROB_FILTER_REPLACENEWFILES= (1 << 4), /*!< from --replacefiles */
26 RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5), /*!< from --replacefiles */
27 RPMPROB_FILTER_OLDPACKAGE = (1 << 6), /*!< from --oldpackage */
28 RPMPROB_FILTER_DISKSPACE = (1 << 7), /*!< from --ignoresize */
29 RPMPROB_FILTER_DISKNODES = (1 << 8) /*!< from --ignoresize */
33 * Raw data for an element of a problem set.
35 typedef struct rpmProblem_s * rpmProblem;
38 * Problem set iterator
40 typedef struct rpmpsi_s * rpmpsi;
43 * Enumerate transaction set problem types.
45 typedef enum rpmProblemType_e {
46 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
47 RPMPROB_BADOS, /*!< package ... is for a different operating system */
48 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
49 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
50 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
51 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
52 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
53 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
54 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
55 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
56 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
57 RPMPROB_OBSOLETES, /*!< package ... is obsoleted by ... */
61 * Create a problem item.
62 * @param type type of problem
63 * @param pkgNEVR package name
64 * @param key filename or python object address
65 * @param dn directory name
66 * @param bn file base name
67 * @param altNEVR related (e.g. through a dependency) package name
68 * @param number generic number attribute
71 rpmProblem rpmProblemCreate(rpmProblemType type,
74 const char * dn, const char * bn,
79 * Destroy a problem item.
80 * @param prob rpm problem
81 * @return rpm problem (NULL)
83 rpmProblem rpmProblemFree(rpmProblem prob);
86 * Reference an rpmProblem instance
87 * @param prob rpm problem
90 rpmProblem rpmProblemLink(rpmProblem prob);
93 * Unreference an rpmProblem instance
94 * @param prob rpm problem
97 rpmProblem rpmProblemUnlink(rpmProblem prob);
100 * Compare two problems for equality.
101 * @param ap 1st problem
102 * @param bp 2nd problem
103 * @return 1 if the problems differ, 0 otherwise
105 int rpmProblemCompare(rpmProblem ap, rpmProblem bp);
108 * Return package NEVR
109 * @param prob rpm problem
110 * @return package NEVR
112 const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
114 * Return related (e.g. through a dependency) package NEVR
115 * @param prob rpm problem
116 * @return related (e.g. through a dependency) package NEVR
118 const char * rpmProblemGetAltNEVR(const rpmProblem prob);
121 * Return type of problem (dependency, diskpace etc)
122 * @param prob rpm problem
123 * @return type of problem
126 rpmProblemType rpmProblemGetType(const rpmProblem prob);
129 * Return filename or python object address of a problem
130 * @param prob rpm problem
131 * @return filename or python object address
133 fnpyKey rpmProblemGetKey(const rpmProblem prob);
136 * Return a generic data string from a problem
137 * @param prob rpm problem
138 * @return a generic data string
139 * @todo needs a better name
141 const char * rpmProblemGetStr(const rpmProblem prob);
144 * Return disk requirement (needed disk space / number of inodes)
145 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
146 * and RPMPROB_DISKNODES return value is undefined.
147 * @param prob rpm problem
148 * @return disk requirement
150 rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
153 * Return formatted string representation of a problem.
154 * @param prob rpm problem
155 * @return formatted string (malloc'd)
157 char * rpmProblemString(const rpmProblem prob);
160 * Unreference a problem set instance.
161 * @param ps problem set
162 * @return problem set
164 rpmps rpmpsUnlink (rpmps ps);
167 * Reference a problem set instance.
168 * @param ps transaction set
169 * @return new transaction set reference
171 rpmps rpmpsLink (rpmps ps);
174 * Return number of problems in set.
175 * @param ps problem set
176 * @return number of problems
178 int rpmpsNumProblems(rpmps ps);
181 * Initialize problem set iterator.
182 * @param ps problem set
183 * @return problem set iterator
185 rpmpsi rpmpsInitIterator(rpmps ps);
188 * Destroy problem set iterator.
189 * @param psi problem set iterator
190 * @return problem set iterator (NULL)
192 rpmpsi rpmpsFreeIterator(rpmpsi psi);
195 * Return next problem set iterator index
196 * @param psi problem set iterator
197 * @return iterator index, -1 on termination
199 int rpmpsNextIterator(rpmpsi psi);
202 * Return current problem from problem set
203 * @param psi problem set iterator
204 * @return current rpmProblem
206 rpmProblem rpmpsGetProblem(rpmpsi psi);
209 * Create a problem set.
210 * @return new problem set
212 rpmps rpmpsCreate(void);
215 * Destroy a problem set.
216 * @param ps problem set
217 * @return NULL always
219 rpmps rpmpsFree(rpmps ps);
222 * Print problems to file handle.
223 * @param fp file handle (NULL uses stderr)
224 * @param ps problem set
226 void rpmpsPrint(FILE *fp, rpmps ps);
229 * Append a problem to current set of problems.
230 * @param ps problem set
231 * @param prob rpmProblem
233 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
236 * Append a problem to current set of problems.
237 * @param ps problem set
238 * @param type type of problem
239 * @param pkgNEVR package name
240 * @param key filename or python object address
241 * @param dn directory name
242 * @param bn file base name
243 * @param altNEVR related (e.g. through a dependency) package name
244 * @param number generic number attribute
246 void rpmpsAppend(rpmps ps, rpmProblemType type,
247 const char * pkgNEVR,
249 const char * dn, const char * bn,
250 const char * altNEVR,
254 * Filter a problem set.
256 * As the problem sets are generated in an order solely dependent
257 * on the ordering of the packages in the transaction, and that
258 * ordering can't be changed, the problem sets must be parallel to
259 * one another. Additionally, the filter set must be a subset of the
260 * target set, given the operations available on transaction set.
261 * This is good, as it lets us perform this trim in linear time, rather
262 * then logarithmic or quadratic.
264 * @param ps problem set
265 * @param filter problem filter (or NULL)
266 * @return 0 no problems, 1 if problems remain
268 int rpmpsTrim(rpmps ps, rpmps filter);