4 /** \ingroup rpmdep rpmtrans
6 * Structure(s) used for dependency tag sets.
15 extern int _rpmds_debug;
22 extern int _rpmds_nopromote;
25 #if defined(_RPMDS_INTERNAL)
27 * A package dependency set.
31 const char * Type; /*!< Tag name. */
33 const char * DNEVR; /*!< Formatted dependency string. */
34 /*@refcounted@*/ /*@null@*/
35 Header h; /*!< Header for dependency set (or NULL) */
37 const char ** N; /*!< Name. */
39 const char ** EVR; /*!< Epoch-Version-Release. */
41 int_32 * Flags; /*!< Flags identifying context/comparison. */
42 rpmTag tagN; /*!< Header tag. */
43 rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
44 int_32 Count; /*!< No. of elements */
45 int i; /*!< Element index. */
46 unsigned l; /*!< Low element (bsearch). */
47 unsigned u; /*!< High element (bsearch). */
48 int nopromote; /*!< Don't promote Epoch: in rpmdsCompare()? */
50 int nrefs; /*!< Reference count. */
52 #endif /* _RPMDS_INTERNAL */
59 * Unreference a dependency set instance.
60 * @param ds dependency set
64 /*@unused@*/ /*@null@*/
65 rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
66 /*@null@*/ const char * msg)
69 /** @todo Remove debugging entry from the ABI. */
72 rpmds XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
73 /*@null@*/ const char * msg, const char * fn, unsigned ln)
76 #define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
79 * Reference a dependency set instance.
80 * @param ds dependency set
82 * @return new dependency set reference
84 /*@unused@*/ /*@newref@*/
85 rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
88 /** @todo Remove debugging entry from the ABI. */
90 rpmds XrpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg,
91 const char * fn, unsigned ln)
93 #define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
96 * Destroy a dependency set.
97 * @param ds dependency set
101 rpmds rpmdsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds)
104 * Create and load a dependency set.
106 * @param tagN type of dependency
107 * @param scareMem Use pointers to refcounted header memory?
108 * @return new dependency set
111 rpmds rpmdsNew(Header h, rpmTag tagN, int scareMem)
115 * Return new formatted dependency string.
116 * @param dspfx formatted dependency string prefix
117 * @param ds dependency set
118 * @return new formatted dependency (malloc'ed)
121 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
125 * Create, load and initialize a dependency for this header.
127 * @param tagN type of dependency
128 * @param Flags comparison flags
129 * @return new dependency set
132 rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
136 * Create, load and initialize a dependency set of size 1.
137 * @param tagN type of dependency
139 * @param EVR epoch:version-release
140 * @param Flags comparison flags
141 * @return new dependency set
144 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
148 * Return dependency set count.
149 * @param ds dependency set
150 * @return current count
152 int rpmdsCount(/*@null@*/ const rpmds ds)
156 * Return dependency set index.
157 * @param ds dependency set
158 * @return current index
160 int rpmdsIx(/*@null@*/ const rpmds ds)
164 * Set dependency set index.
165 * @param ds dependency set
166 * @param ix new index
167 * @return current index
169 int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
173 * Return current formatted dependency string.
174 * @param ds dependency set
175 * @return current dependency DNEVR, NULL on invalid
177 /*@observer@*/ /*@null@*/
178 extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
182 * Return current dependency name.
183 * @param ds dependency set
184 * @return current dependency name, NULL on invalid
186 /*@observer@*/ /*@null@*/
187 extern const char * rpmdsN(/*@null@*/ const rpmds ds)
191 * Return current dependency epoch-version-release.
192 * @param ds dependency set
193 * @return current dependency EVR, NULL on invalid
195 /*@observer@*/ /*@null@*/
196 extern const char * rpmdsEVR(/*@null@*/ const rpmds ds)
200 * Return current dependency flags.
201 * @param ds dependency set
202 * @return current dependency flags, 0 on invalid
204 int_32 rpmdsFlags(/*@null@*/ const rpmds ds)
208 * Return current dependency type.
209 * @param ds dependency set
210 * @return current dependency type, 0 on invalid
212 rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
216 * Return current "Don't promote Epoch:" flag.
218 * This flag controls for Epoch: promotion when a dependency set is
219 * compared. If the flag is set (for already installed packages), then
220 * an unspecified value will be treated as Epoch: 0. Otherwise (for added
221 * packages), the Epoch: portion of the comparison is skipped if the value
222 * is not specified, i.e. an unspecified Epoch: is assumed to be equal
223 * in dependency comparisons.
225 * @param ds dependency set
226 * @return current "Don't promote Epoch:" flag
228 int rpmdsNoPromote(/*@null@*/ const rpmds ds)
232 * Set "Don't promote Epoch:" flag.
233 * @param ds dependency set
234 * @param nopromote Should an unspecified Epoch: be treated as Epoch: 0?
235 * @return previous "Don't promote Epoch:" flag
237 int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
241 * Notify of results of dependency match.
242 * @param ds dependency set
243 * @param where where dependency was resolved (or NULL)
244 * @param rc 0 == YES, otherwise NO
246 /*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
247 void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
248 /*@globals fileSystem @*/
249 /*@modifies fileSystem @*/;
253 * Return next dependency set iterator index.
254 * @param ds dependency set
255 * @return dependency set iterator index, -1 on termination
257 int rpmdsNext(/*@null@*/ rpmds ds)
261 * Initialize dependency set iterator.
262 * @param ds dependency set
263 * @return dependency set
266 rpmds rpmdsInit(/*@null@*/ rpmds ds)
270 * Find a dependency set element using binary search.
271 * @param ds dependency set to search
272 * @param this dependency set element to find.
273 * @return dependency index (or -1 if not found)
276 int rpmdsFind(rpmds ds, /*@null@*/ rpmds this)
277 /*@modifies ds, this @*/;
280 * Merge a dependency set maintaining (N,EVR,Flags) sorted order.
281 * @retval *dsp (merged) dependency set
282 * @param this dependency set to merge
283 * @return (merged) dependency index
286 int rpmdsMerge(/*@out@*/ rpmds * dsp, /*@null@*/ rpmds this)
287 /*@modifies *dsp, this @*/;
290 * Compare two versioned dependency ranges, looking for overlap.
291 * @param A 1st dependency
292 * @param B 2nd dependency
293 * @return 1 if dependencies overlap, 0 otherwise
295 int rpmdsCompare(const rpmds A, const rpmds B)
299 * Report a Requires: or Conflicts: dependency problem.
300 * @param ps transaction set problems
301 * @param pkgNEVR package name/epoch/version/release
302 * @param ds dependency set
303 * @param suggestedKeys filename or python object address
304 * @param adding dependency problem is from added package set?
306 void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
307 /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys,
312 * Compare package provides dependencies from header with a single dependency.
314 * @param req dependency set
315 * @param nopromote Don't promote Epoch: in comparison?
316 * @return 1 if any dependency overlaps, 0 otherwise
318 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
322 * Compare package name-version-release from header with a single dependency.
324 * @param req dependency set
325 * @param nopromote Don't promote Epoch: in comparison?
326 * @return 1 if dependency overlaps, 0 otherwise
328 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)