~ubuntu-branches/ubuntu/precise/rpm/precise-proposed

« back to all changes in this revision

Viewing changes to .pc/debian-disable-rpm.patch/lib/rpmps.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-06-17 12:49:40 UTC
  • Revision ID: james.westby@ubuntu.com-20100617124940-fqdib7b61vrom8bd
Tags: 4.7.2-1lbuild2
No change rebuild for liblzma1 -> liblzma2 transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef H_RPMPS
 
2
#define H_RPMPS
 
3
 
 
4
/** \ingroup rpmps
 
5
 * \file lib/rpmps.h
 
6
 * Structures and prototypes used for an "rpmps" problem set.
 
7
 */
 
8
 
 
9
#include <stdio.h>
 
10
#include <rpm/rpmtypes.h>
 
11
 
 
12
#ifdef __cplusplus
 
13
extern "C" {
 
14
#endif
 
15
 
 
16
extern int _rpmps_debug;
 
17
 
 
18
/** \ingroup rpmps
 
19
 * @todo Generalize filter mechanism.
 
20
 */
 
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 */
 
32
} rpmprobFilterFlags;
 
33
 
 
34
/**
 
35
 * Raw data for an element of a problem set.
 
36
 */
 
37
typedef struct rpmProblem_s * rpmProblem;
 
38
 
 
39
/** \ingroup rpmps
 
40
 * Transaction problems found while processing a transaction set/
 
41
 */
 
42
typedef struct rpmps_s * rpmps;
 
43
 
 
44
typedef struct rpmpsi_s * rpmpsi;
 
45
 
 
46
/** \ingroup rpmps
 
47
 * Enumerate transaction set problem types.
 
48
 */
 
49
typedef enum rpmProblemType_e {
 
50
    RPMPROB_BADARCH,    /*!< package ... is for a different architecture */
 
51
    RPMPROB_BADOS,      /*!< package ... is for a different operating system */
 
52
    RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
 
53
    RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
 
54
    RPMPROB_REQUIRES,   /*!< package ... has unsatisfied Requires: ... */
 
55
    RPMPROB_CONFLICT,   /*!< package ... has unsatisfied Conflicts: ... */
 
56
    RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
 
57
    RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
 
58
    RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
 
59
    RPMPROB_DISKSPACE,  /*!< installing package ... needs ... on the ... filesystem */
 
60
    RPMPROB_DISKNODES,  /*!< installing package ... needs ... on the ... filesystem */
 
61
 } rpmProblemType;
 
62
 
 
63
/** \ingroup rpmps
 
64
 * Create a problem item.
 
65
 * @param type          type of problem
 
66
 * @param pkgNEVR       package name
 
67
 * @param key           filename or python object address
 
68
 * @param dn            directory name
 
69
 * @param bn            file base name
 
70
 * @param altNEVR       related (e.g. through a dependency) package name
 
71
 * @param number        generic number attribute
 
72
 * @return              rpmProblem
 
73
 */
 
74
rpmProblem rpmProblemCreate(rpmProblemType type,
 
75
                            const char * pkgNEVR,
 
76
                            fnpyKey key,
 
77
                            const char * dn, const char * bn,
 
78
                            const char * altNEVR,
 
79
                            uint64_t number);
 
80
 
 
81
/** \ingroup rpmps
 
82
 * Destroy a problem item.
 
83
 * @param prob          rpm problem
 
84
 * @return              rpm problem (NULL)
 
85
 */
 
86
rpmProblem rpmProblemFree(rpmProblem prob);
 
87
 
 
88
/** \ingroup rpmps
 
89
 * Return package NEVR
 
90
 * @param prob          rpm problem
 
91
 * @return              package NEVR
 
92
 */
 
93
const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
 
94
/** \ingroup rpmps
 
95
 * Return related (e.g. through a dependency) package NEVR
 
96
 * @param prob          rpm problem
 
97
 * @return              related (e.g. through a dependency) package NEVR
 
98
 */
 
99
const char * rpmProblemGetAltNEVR(const rpmProblem prob);
 
100
 
 
101
/** \ingroup rpmps
 
102
 * Return type of problem (dependency, diskpace etc)
 
103
 * @param prob          rpm problem
 
104
 * @return              type of problem
 
105
 */
 
106
 
 
107
rpmProblemType rpmProblemGetType(const rpmProblem prob);
 
108
 
 
109
/** \ingroup rpmps
 
110
 * Return filename or python object address of a problem
 
111
 * @param prob          rpm problem
 
112
 * @return              filename or python object address
 
113
 */
 
114
fnpyKey rpmProblemGetKey(const rpmProblem prob);
 
115
 
 
116
/** \ingroup rpmps
 
117
 * Return a generic data string from a problem
 
118
 * @param prob          rpm problem
 
119
 * @return              a generic data string
 
120
 * @todo                needs a better name
 
121
 */
 
122
const char * rpmProblemGetStr(const rpmProblem prob);
 
123
 
 
124
/** \ingroup rpmps
 
125
 * Return disk requirement (needed disk space / number of inodes)
 
126
 * depending on problem type. On problem types other than RPMPROB_DISKSPACE
 
127
 * and RPMPROB_DISKNODES return value is undefined.
 
128
 * @param prob          rpm problem
 
129
 * @return              disk requirement
 
130
 */
 
131
rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
 
132
 
 
133
/** \ingroup rpmps
 
134
 * Return formatted string representation of a problem.
 
135
 * @param prob          rpm problem
 
136
 * @return              formatted string (malloc'd)
 
137
 */
 
138
char * rpmProblemString(const rpmProblem prob);
 
139
 
 
140
/** \ingroup rpmps
 
141
 * Unreference a problem set instance.
 
142
 * @param ps            problem set
 
143
 * @param msg
 
144
 * @return              problem set
 
145
 */
 
146
rpmps rpmpsUnlink (rpmps ps,
 
147
                const char * msg);
 
148
 
 
149
/** \ingroup rpmps
 
150
 * Reference a problem set instance.
 
151
 * @param ps            transaction set
 
152
 * @param msg
 
153
 * @return              new transaction set reference
 
154
 */
 
155
rpmps rpmpsLink (rpmps ps, const char * msg);
 
156
 
 
157
/** \ingroup rpmps
 
158
 * Return number of problems in set.
 
159
 * @param ps            problem set
 
160
 * @return              number of problems
 
161
 */
 
162
int rpmpsNumProblems(rpmps ps);
 
163
 
 
164
/** \ingroup rpmps
 
165
 * Initialize problem set iterator.
 
166
 * @param ps            problem set
 
167
 * @return              problem set iterator
 
168
 */
 
169
rpmpsi rpmpsInitIterator(rpmps ps);
 
170
 
 
171
/** \ingroup rpmps
 
172
 * Destroy problem set iterator.
 
173
 * @param psi           problem set iterator
 
174
 * @return              problem set iterator (NULL)
 
175
 */
 
176
rpmpsi rpmpsFreeIterator(rpmpsi psi);
 
177
 
 
178
/** \ingroup rpmps
 
179
 * Return next problem set iterator index
 
180
 * @param psi           problem set iterator
 
181
 * @return              iterator index, -1 on termination
 
182
 */
 
183
int rpmpsNextIterator(rpmpsi psi);
 
184
 
 
185
/** \ingroup rpmps
 
186
 * Return current problem from problem set
 
187
 * @param psi           problem set iterator
 
188
 * @return              current rpmProblem 
 
189
 */
 
190
rpmProblem rpmpsGetProblem(rpmpsi psi);
 
191
 
 
192
/** \ingroup rpmps
 
193
 * Create a problem set.
 
194
 * @return              new problem set
 
195
 */
 
196
rpmps rpmpsCreate(void);
 
197
 
 
198
/** \ingroup rpmps
 
199
 * Destroy a problem set.
 
200
 * @param ps            problem set
 
201
 * @return              NULL always
 
202
 */
 
203
rpmps rpmpsFree(rpmps ps);
 
204
 
 
205
/** \ingroup rpmps
 
206
 * Print problems to file handle.
 
207
 * @param fp            file handle (NULL uses stderr)
 
208
 * @param ps            problem set
 
209
 */
 
210
void rpmpsPrint(FILE *fp, rpmps ps);
 
211
 
 
212
/** \ingroup rpmps
 
213
 * Append a problem to current set of problems.
 
214
 * @param ps            problem set
 
215
 * @param prob          rpmProblem 
 
216
 */
 
217
void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
 
218
 
 
219
/** \ingroup rpmps
 
220
 * Append a problem to current set of problems.
 
221
 * @param ps            problem set
 
222
 * @param type          type of problem
 
223
 * @param pkgNEVR       package name
 
224
 * @param key           filename or python object address
 
225
 * @param dn            directory name
 
226
 * @param bn            file base name
 
227
 * @param altNEVR       related (e.g. through a dependency) package name
 
228
 * @param number        generic number attribute
 
229
 */
 
230
void rpmpsAppend(rpmps ps, rpmProblemType type,
 
231
                const char * pkgNEVR,
 
232
                fnpyKey key,
 
233
                const char * dn, const char * bn,
 
234
                const char * altNEVR,
 
235
                uint64_t number);
 
236
 
 
237
/** \ingroup rpmps
 
238
 * Filter a problem set.
 
239
 *
 
240
 * As the problem sets are generated in an order solely dependent
 
241
 * on the ordering of the packages in the transaction, and that
 
242
 * ordering can't be changed, the problem sets must be parallel to
 
243
 * one another. Additionally, the filter set must be a subset of the
 
244
 * target set, given the operations available on transaction set.
 
245
 * This is good, as it lets us perform this trim in linear time, rather
 
246
 * then logarithmic or quadratic.
 
247
 *
 
248
 * @param ps            problem set
 
249
 * @param filter        problem filter (or NULL)
 
250
 * @return              0 no problems, 1 if problems remain
 
251
 */
 
252
int rpmpsTrim(rpmps ps, rpmps filter);
 
253
 
 
254
#ifdef __cplusplus
 
255
}
 
256
#endif
 
257
 
 
258
#endif  /* H_RPMPS */