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 */
59 int numProblems; /*!< Current probs array size. */
60 int numProblemsAlloced; /*!< Allocated probs array size. */
61 rpmProblem probs; /*!< Array of specific problems. */
62 int nrefs; /*!< Reference count. */
66 * Return formatted string representation of a problem.
67 * @param prob rpm problem
68 * @return formatted string (malloc'd)
70 extern const char * rpmProblemString(const rpmProblem prob);
73 * Unreference a problem set instance.
74 * @param ps problem set
78 rpmps rpmpsUnlink (rpmps ps,
81 /** @todo Remove debugging entry from the ABI. */
82 rpmps XrpmpsUnlink (rpmps ps,
83 const char * msg, const char * fn, unsigned ln);
84 #define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
87 * Reference a problem set instance.
88 * @param ps transaction set
90 * @return new transaction set reference
92 rpmps rpmpsLink (rpmps ps, const char * msg);
94 /** @todo Remove debugging entry from the ABI. */
95 rpmps XrpmpsLink (rpmps ps,
96 const char * msg, const char * fn, unsigned ln);
97 #define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
100 * Return number of problems in set.
101 * @param ps problem set
102 * @return number of problems
104 int rpmpsNumProblems(rpmps ps);
107 * Create a problem set.
108 * @return new problem set
110 rpmps rpmpsCreate(void);
113 * Destroy a problem set.
114 * @param ps problem set
115 * @return NULL always
117 rpmps rpmpsFree(rpmps ps);
120 * Print problems to file handle.
121 * @param fp file handle (NULL uses stderr)
122 * @param ps problem set
124 void rpmpsPrint(FILE *fp, rpmps ps);
127 * Append a problem to current set of problems.
128 * @param ps problem set
129 * @param type type of problem
130 * @param pkgNEVR package name
131 * @param key filename or python object address
132 * @param dn directory name
133 * @param bn file base name
134 * @param altNEVR related (e.g. through a dependency) package name
135 * @param ulong1 generic pointer/long attribute
137 void rpmpsAppend(rpmps ps, rpmProblemType type,
138 const char * pkgNEVR,
140 const char * dn, const char * bn,
141 const char * altNEVR,
142 unsigned long ulong1);
145 * Filter a problem set.
147 * As the problem sets are generated in an order solely dependent
148 * on the ordering of the packages in the transaction, and that
149 * ordering can't be changed, the problem sets must be parallel to
150 * one another. Additionally, the filter set must be a subset of the
151 * target set, given the operations available on transaction set.
152 * This is good, as it lets us perform this trim in linear time, rather
153 * then logarithmic or quadratic.
155 * @param ps problem set
156 * @param filter problem filter (or NULL)
157 * @return 0 no problems, 1 if problems remain
159 int rpmpsTrim(rpmps ps, rpmps filter);