4 /** \ingroup rpmdep rpmtrans
6 * Structure used for handling a dependency set.
11 typedef struct sharedFileInfo_s * sharedFileInfo;
15 struct sharedFileInfo_s {
23 * A package filename set.
26 int i; /*!< File index. */
29 const char * Type; /*!< Tag name. */
31 rpmTag tagN; /*!< Header tag. */
32 /*@refcounted@*/ /*@null@*/
33 Header h; /*!< Header for file set (or NULL) */
36 const char ** bnl; /*!< Base name(s) (from header) */
38 const char ** dnl; /*!< Directory name(s) (from header) */
41 const char ** fmd5s; /*!< File MD5 sum(s) (from header) */
43 const char ** flinks; /*!< File link(s) (from header) */
45 const char ** flangs; /*!< File lang(s) */
48 uint_32 * dil; /*!< Directory indice(s) (from header) */
50 const uint_32 * fflags; /*!< File flag(s) (from header) */
52 const uint_32 * fsizes; /*!< File size(s) (from header) */
54 const uint_32 * fmtimes; /*!< File modification time(s) (from header) */
56 uint_16 * fmodes; /*!< File mode(s) (from header) */
58 const uint_16 * frdevs; /*!< File rdev(s) (from header) */
61 const char ** fuser; /*!< File owner(s) */
63 const char ** fgroup; /*!< File group(s) */
65 uid_t * fuids; /*!< File uid(s) */
67 gid_t * fgids; /*!< File gid(s) */
70 char * fstates; /*!< File state(s) (from header) */
72 int_32 dc; /*!< No. of directories. */
73 int_32 fc; /*!< No. of files. */
75 /*=============================*/
77 transactionElement te;
79 HGE_t hge; /*!< Vector to headerGetEntry() */
80 HAE_t hae; /*!< Vector to headerAddEntry() */
81 HME_t hme; /*!< Vector to headerModifyEntry() */
82 HRE_t hre; /*!< Vector to headerRemoveEntry() */
83 HFD_t hfd; /*!< Vector to headerFreeData() */
84 /*-----------------------------*/
85 uid_t uid; /*!< File uid (default). */
86 gid_t gid; /*!< File gid (default). */
87 uint_32 flags; /*!< File flags (default). */
88 fileAction action; /*!< File disposition (default). */
90 fileAction * actions; /*!< File disposition(s). */
92 struct fingerPrint_s * fps; /*!< File fingerprint(s). */
94 const char ** obnl; /*!< Original basename(s) (from header) */
96 const char ** odnl; /*!< Original dirname(s) (from header) */
98 int_32 * odil; /*!< Original dirindex(s) (from header) */
99 int bnlmax; /*!< Length (in bytes) of longest basename. */
100 int dnlmax; /*!< Length (in bytes) of longest dirname. */
103 unsigned int archiveSize;
104 mode_t dperms; /*!< Directory perms (0755) if not mapped. */
105 mode_t fperms; /*!< File perms (0644) if not mapped. */
106 /*@only@*/ /*@null@*/
109 /*@owned@*/ /*@null@*/
112 FSM_t fsm; /*!< File state machine data. */
113 int keep_header; /*!< Keep header? */
115 sharedFileInfo replaced; /*!< (TR_ADDED) */
117 uint_32 * replacedSizes; /*!< (TR_ADDED) */
118 unsigned int record; /*!< (TR_REMOVED) */
120 #define TFIMAGIC 0x09697923
121 /*=============================*/
123 /*@refs@*/ int nrefs; /*!< Reference count. */
127 * A package dependency set.
130 int i; /*!< Element index. */
133 const char * Type; /*!< Tag name. */
134 /*@only@*/ /*@null@*/
135 const char * DNEVR; /*!< Formatted dependency string. */
137 rpmTag tagN; /*!< Header tag. */
138 /*@refcounted@*/ /*@null@*/
139 Header h; /*!< Header for dependency set (or NULL) */
142 const char ** N; /*!< Name. */
144 const char ** EVR; /*!< Epoch-Version-Release. */
146 int_32 * Flags; /*!< Flags identifying context/comparison. */
147 rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
148 int_32 Count; /*!< No. of elements */
149 /*@refs@*/ int nrefs; /*!< Reference count. */
157 * Unreference a file info set instance.
158 * @param fi file info set
159 * @return NULL always
161 /*@unused@*/ /*@null@*/
162 TFI_t rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi,
163 /*@null@*/ const char * msg)
166 /** @todo Remove debugging entry from the ABI. */
169 TFI_t XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi,
170 /*@null@*/ const char * msg, const char * fn, unsigned ln)
173 #define rpmfiUnlink(_fi, _msg) XrpmfiUnlink(_fi, _msg, __FILE__, __LINE__)
176 * Reference a file info set instance.
177 * @param fi file info set
178 * @return new file info set reference
181 TFI_t rpmfiLink (/*@null@*/ TFI_t fi, /*@null@*/ const char * msg)
184 /** @todo Remove debugging entry from the ABI. */
185 TFI_t XrpmfiLink (/*@null@*/ TFI_t fi, /*@null@*/ const char * msg,
186 const char * fn, unsigned ln)
188 #define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__)
191 * Retrieve key from transaction element file info
192 * @param fi transaction element file info
193 * @return transaction element file info key
195 /*@exposed@*/ /*@dependent@*/ /*@null@*/
196 fnpyKey rpmfiGetKey(TFI_t fi)
200 * Destroy a file set.
202 * @param freefimem free fi memory too?
203 * @return NULL always
206 TFI_t fiFree(/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi, int freefimem)
210 * Create and load a file set.
211 * @param ts transaction set
212 * @param fi file set (NULL if creating)
214 * @param tagN RPMTAG_BASENAMES
215 * @param scareMem Use pointers to refcounted header memory?
216 * @return new file set
219 TFI_t fiNew(rpmTransactionSet ts, /*@null@*/ TFI_t fi,
220 Header h, rpmTag tagN, int scareMem)
221 /*@modifies ts, fi, h @*/;
224 * Unreference a dependency set instance.
225 * @param ds dependency set
226 * @return NULL always
228 /*@unused@*/ /*@null@*/
229 rpmDepSet rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
230 /*@null@*/ const char * msg)
233 /** @todo Remove debugging entry from the ABI. */
236 rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
237 /*@null@*/ const char * msg, const char * fn, unsigned ln)
240 #define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
243 * Reference a dependency set instance.
244 * @param ds dependency set
245 * @return new dependency set reference
248 rpmDepSet rpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg)
251 /** @todo Remove debugging entry from the ABI. */
252 rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg,
253 const char * fn, unsigned ln)
255 #define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
258 * Destroy a dependency set.
259 * @param ds dependency set
260 * @return NULL always
263 rpmDepSet dsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds)
266 * Create and load a dependency set.
268 * @param tagN type of dependency
269 * @param scareMem Use pointers to refcounted header memory?
270 * @return new dependency set
273 rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
277 * Return new formatted dependency string.
278 * @param dspfx formatted dependency string prefix
279 * @param ds dependency set
280 * @return new formatted dependency (malloc'ed)
283 char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
287 * Create, load and initialize a dependency for this header.
289 * @param tagN type of dependency
290 * @param Flags comparison flags
291 * @return new dependency set
294 rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
298 * Create, load and initialize a dependency set of size 1.
299 * @param tagN type of dependency
301 * @param EVR epoch:version-release
302 * @param Flags comparison flags
303 * @return new dependency set
306 rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
310 * Return dependency set count.
311 * @param ds dependency set
312 * @return current count
314 int dsiGetCount(/*@null@*/ rpmDepSet ds)
318 * Return dependency set index.
319 * @param ds dependency set
320 * @return current index
322 int dsiGetIx(/*@null@*/ rpmDepSet ds)
326 * Set dependency set index.
327 * @param ds dependency set
328 * @param ix new index
329 * @return current index
331 int dsiSetIx(/*@null@*/ rpmDepSet ds, int ix)
335 * Return current formatted dependency string.
336 * @param ds dependency set
337 * @return current dependency DNEVR, NULL on invalid
340 const char * dsiGetDNEVR(/*@null@*/ rpmDepSet ds)
344 * Return current dependency name.
345 * @param ds dependency set
346 * @return current dependency name, NULL on invalid
349 const char * dsiGetN(/*@null@*/ rpmDepSet ds)
353 * Return current dependency epoch-version-release.
354 * @param ds dependency set
355 * @return current dependency EVR, NULL on invalid
358 const char * dsiGetEVR(/*@null@*/ rpmDepSet ds)
362 * Return current dependency Flags.
363 * @param ds dependency set
364 * @return current dependency EVR, 0 on invalid
366 int_32 dsiGetFlags(/*@null@*/ rpmDepSet ds)
370 * Notify of results of dependency match;
371 * @param ds dependency set
372 * @param where where dependency was resolved (or NULL)
373 * @param rc 0 == YES, otherwise NO
375 /*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
376 void dsiNotify(/*@null@*/ rpmDepSet ds, /*@null@*/ const char * where, int rc)
377 /*@globals fileSystem @*/
378 /*@modifies fileSystem @*/;
382 * Return next dependency set iterator index.
383 * @param ds dependency set
384 * @return dependency set iterator index, -1 on termination
386 int dsiNext(/*@null@*/ rpmDepSet ds)
390 * Initialize dependency set iterator.
391 * @param ds dependency set
392 * @return dependency set
395 rpmDepSet dsiInit(/*@returned@*/ /*@null@*/ rpmDepSet ds)
399 * Compare two versioned dependency ranges, looking for overlap.
400 * @param A 1st dependency
401 * @param B 2nd dependency
402 * @return 1 if dependencies overlap, 0 otherwise
404 int dsCompare(const rpmDepSet A, const rpmDepSet B)
408 * Report a Requires: or Conflicts: dependency problem.
410 void dsProblem(/*@null@*/ rpmProblemSet tsprobs,
411 const char * pkgNEVR, const rpmDepSet ds,
412 /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys)
413 /*@modifies tsprobs @*/;
416 * Compare package provides dependencies from header with a single dependency.
418 * @param ds dependency set
420 int rangeMatchesDepFlags (Header h, const rpmDepSet req)
424 * Compare package name-version-release from header with a single dependency.
425 * @deprecated Remove from API when obsoletes is correctly implemented.
427 * @param req dependency
428 * @return 1 if dependency overlaps, 0 otherwise
430 int headerMatchesDepFlags(const Header h, const rpmDepSet req)