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;
28 * Enumerate transaction set problem types.
30 typedef enum rpmProblemType_e {
31 RPMPROB_BADARCH, /*!< package ... is for a different architecture */
32 RPMPROB_BADOS, /*!< package ... is for a different operating system */
33 RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
34 RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
35 RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
36 RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
37 RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
38 RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
39 RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
40 RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
41 RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
42 RPMPROB_BADPRETRANS /*!< (unimplemented) */
60 int numProblems; /*!< Current probs array size. */
61 int numProblemsAlloced; /*!< Allocated probs array size. */
62 rpmProblem probs; /*!< Array of specific problems. */
63 int nrefs; /*!< Reference count. */
67 * Return formatted string representation of a problem.
68 * @param prob rpm problem
69 * @return formatted string (malloc'd)
71 extern const char * rpmProblemString(const rpmProblem prob);
74 * Unreference a problem set instance.
75 * @param ps problem set
79 rpmps rpmpsUnlink (rpmps ps,
82 /** @todo Remove debugging entry from the ABI. */
83 rpmps XrpmpsUnlink (rpmps ps,
84 const char * msg, const char * fn, unsigned ln);
85 #define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
88 * Reference a problem set instance.
89 * @param ps transaction set
91 * @return new transaction set reference
93 rpmps rpmpsLink (rpmps ps, const char * msg);
95 /** @todo Remove debugging entry from the ABI. */
96 rpmps XrpmpsLink (rpmps ps,
97 const char * msg, const char * fn, unsigned ln);
98 #define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
101 * Return number of problems in set.
102 * @param ps problem set
103 * @return number of problems
105 int rpmpsNumProblems(rpmps ps);
108 * Create a problem set.
109 * @return new problem set
111 rpmps rpmpsCreate(void);
114 * Destroy a problem set.
115 * @param ps problem set
116 * @return NULL always
118 rpmps rpmpsFree(rpmps ps);
121 * Print problems to file handle.
122 * @param fp file handle (NULL uses stderr)
123 * @param ps problem set
125 void rpmpsPrint(FILE *fp, rpmps ps);
128 * Append a problem to current set of problems.
129 * @param ps problem set
130 * @param type type of problem
131 * @param pkgNEVR package name
132 * @param key filename or python object address
133 * @param dn directory name
134 * @param bn file base name
135 * @param altNEVR related (e.g. through a dependency) package name
136 * @param ulong1 generic pointer/long attribute
138 void rpmpsAppend(rpmps ps, rpmProblemType type,
139 const char * pkgNEVR,
141 const char * dn, const char * bn,
142 const char * altNEVR,
143 unsigned long ulong1);
146 * Filter a problem set.
148 * As the problem sets are generated in an order solely dependent
149 * on the ordering of the packages in the transaction, and that
150 * ordering can't be changed, the problem sets must be parallel to
151 * one another. Additionally, the filter set must be a subset of the
152 * target set, given the operations available on transaction set.
153 * This is good, as it lets us perform this trim in linear time, rather
154 * then logarithmic or quadratic.
156 * @param ps problem set
157 * @param filter problem filter (or NULL)
158 * @return 0 no problems, 1 if problems remain
160 int rpmpsTrim(rpmps ps, rpmps filter);