2001-11-03 10:34:15 +08:00
|
|
|
#ifndef H_RPMDS
|
|
|
|
#define H_RPMDS
|
|
|
|
|
|
|
|
/** \ingroup rpmdep rpmtrans
|
|
|
|
* \file lib/rpmds.h
|
2001-11-14 03:04:33 +08:00
|
|
|
* Structure(s) used for dependency tag sets.
|
2001-11-03 10:34:15 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A package dependency set.
|
|
|
|
*/
|
|
|
|
struct rpmDepSet_s {
|
|
|
|
int i; /*!< Element index. */
|
|
|
|
|
|
|
|
/*@observer@*/
|
|
|
|
const char * Type; /*!< Tag name. */
|
|
|
|
/*@only@*/ /*@null@*/
|
|
|
|
const char * DNEVR; /*!< Formatted dependency string. */
|
|
|
|
|
|
|
|
rpmTag tagN; /*!< Header tag. */
|
|
|
|
/*@refcounted@*/ /*@null@*/
|
|
|
|
Header h; /*!< Header for dependency set (or NULL) */
|
2001-11-05 22:09:22 +08:00
|
|
|
|
2001-11-03 10:34:15 +08:00
|
|
|
/*@only@*/
|
|
|
|
const char ** N; /*!< Name. */
|
|
|
|
/*@only@*/
|
|
|
|
const char ** EVR; /*!< Epoch-Version-Release. */
|
|
|
|
/*@only@*/
|
2001-11-11 08:11:33 +08:00
|
|
|
int_32 * Flags; /*!< Flags identifying context/comparison. */
|
2001-11-03 10:34:15 +08:00
|
|
|
rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
|
2001-11-05 22:09:22 +08:00
|
|
|
int_32 Count; /*!< No. of elements */
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@refs@*/ int nrefs; /*!< Reference count. */
|
2001-11-03 10:34:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2001-11-10 07:13:50 +08:00
|
|
|
/**
|
|
|
|
* Unreference a dependency set instance.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return NULL always
|
|
|
|
*/
|
|
|
|
/*@unused@*/ /*@null@*/
|
|
|
|
rpmDepSet rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
|
2001-11-11 03:24:19 +08:00
|
|
|
/*@null@*/ const char * msg)
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@modifies ds @*/;
|
|
|
|
|
|
|
|
/** @todo Remove debugging entry from the ABI. */
|
|
|
|
/*@-exportlocal@*/
|
|
|
|
/*@null@*/
|
|
|
|
rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
|
2001-11-11 03:24:19 +08:00
|
|
|
/*@null@*/ const char * msg, const char * fn, unsigned ln)
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@modifies ds @*/;
|
|
|
|
/*@=exportlocal@*/
|
|
|
|
#define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference a dependency set instance.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return new dependency set reference
|
|
|
|
*/
|
|
|
|
/*@unused@*/
|
2001-11-11 03:24:19 +08:00
|
|
|
rpmDepSet rpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg)
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@modifies ds @*/;
|
|
|
|
|
|
|
|
/** @todo Remove debugging entry from the ABI. */
|
2001-11-11 03:24:19 +08:00
|
|
|
rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg,
|
2001-11-10 07:13:50 +08:00
|
|
|
const char * fn, unsigned ln)
|
|
|
|
/*@modifies ds @*/;
|
|
|
|
#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
|
|
|
|
|
2001-11-05 22:09:22 +08:00
|
|
|
/**
|
|
|
|
* Destroy a dependency set.
|
2001-11-03 10:34:15 +08:00
|
|
|
* @param ds dependency set
|
|
|
|
* @return NULL always
|
|
|
|
*/
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@null@*/
|
|
|
|
rpmDepSet dsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds)
|
2001-11-03 10:34:15 +08:00
|
|
|
/*@modifies ds@*/;
|
|
|
|
/**
|
|
|
|
* Create and load a dependency set.
|
|
|
|
* @param h header
|
|
|
|
* @param tagN type of dependency
|
|
|
|
* @param scareMem Use pointers to refcounted header memory?
|
|
|
|
* @return new dependency set
|
|
|
|
*/
|
2001-11-10 07:13:50 +08:00
|
|
|
/*@null@*/
|
2001-11-03 10:34:15 +08:00
|
|
|
rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
|
|
|
|
/*@modifies h @*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return new formatted dependency string.
|
2001-11-05 06:00:11 +08:00
|
|
|
* @param dspfx formatted dependency string prefix
|
|
|
|
* @param ds dependency set
|
2001-11-03 10:34:15 +08:00
|
|
|
* @return new formatted dependency (malloc'ed)
|
|
|
|
*/
|
|
|
|
/*@only@*/
|
2001-11-05 06:00:11 +08:00
|
|
|
char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
|
2001-11-03 10:34:15 +08:00
|
|
|
/*@*/;
|
|
|
|
|
2001-11-11 08:11:33 +08:00
|
|
|
/**
|
|
|
|
* Create, load and initialize a dependency for this header.
|
|
|
|
* @param h header
|
|
|
|
* @param tagN type of dependency
|
|
|
|
* @param Flags comparison flags
|
|
|
|
* @return new dependency set
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
|
|
|
rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create, load and initialize a dependency set of size 1.
|
|
|
|
* @param tagN type of dependency
|
|
|
|
* @param N name
|
|
|
|
* @param EVR epoch:version-release
|
|
|
|
* @param Flags comparison flags
|
|
|
|
* @return new dependency set
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
|
|
|
rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
|
|
|
|
/*@*/;
|
|
|
|
|
2001-11-08 08:12:49 +08:00
|
|
|
/**
|
|
|
|
* Return dependency set count.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return current count
|
|
|
|
*/
|
|
|
|
int dsiGetCount(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return dependency set index.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return current index
|
|
|
|
*/
|
|
|
|
int dsiGetIx(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set dependency set index.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @param ix new index
|
|
|
|
* @return current index
|
|
|
|
*/
|
|
|
|
int dsiSetIx(/*@null@*/ rpmDepSet ds, int ix)
|
|
|
|
/*@modifies ds @*/;
|
|
|
|
|
2001-11-03 10:34:15 +08:00
|
|
|
/**
|
|
|
|
* Return current formatted dependency string.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return current dependency DNEVR, NULL on invalid
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
|
|
|
const char * dsiGetDNEVR(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return current dependency name.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return current dependency name, NULL on invalid
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
|
|
|
const char * dsiGetN(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return current dependency epoch-version-release.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return current dependency EVR, NULL on invalid
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
|
|
|
const char * dsiGetEVR(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
2001-11-14 08:14:01 +08:00
|
|
|
* Return current dependency flags.
|
2001-11-03 10:34:15 +08:00
|
|
|
* @param ds dependency set
|
2001-11-14 08:14:01 +08:00
|
|
|
* @return current dependency flags, 0 on invalid
|
2001-11-03 10:34:15 +08:00
|
|
|
*/
|
|
|
|
int_32 dsiGetFlags(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
/**
|
2001-11-14 08:14:01 +08:00
|
|
|
* Notify of results of dependency match.
|
2001-11-03 10:34:15 +08:00
|
|
|
* @param ds dependency set
|
|
|
|
* @param where where dependency was resolved (or NULL)
|
|
|
|
* @param rc 0 == YES, otherwise NO
|
|
|
|
*/
|
|
|
|
/*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
|
|
|
|
void dsiNotify(/*@null@*/ rpmDepSet ds, /*@null@*/ const char * where, int rc)
|
|
|
|
/*@globals fileSystem @*/
|
|
|
|
/*@modifies fileSystem @*/;
|
|
|
|
/*@=globuse@*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return next dependency set iterator index.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return dependency set iterator index, -1 on termination
|
|
|
|
*/
|
|
|
|
int dsiNext(/*@null@*/ rpmDepSet ds)
|
|
|
|
/*@modifies ds @*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize dependency set iterator.
|
|
|
|
* @param ds dependency set
|
|
|
|
* @return dependency set
|
|
|
|
*/
|
|
|
|
/*@null@*/
|
2001-11-17 16:02:17 +08:00
|
|
|
rpmDepSet dsiInit(/*@null@*/ rpmDepSet ds)
|
2001-11-03 10:34:15 +08:00
|
|
|
/*@modifies ds @*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare two versioned dependency ranges, looking for overlap.
|
|
|
|
* @param A 1st dependency
|
|
|
|
* @param B 2nd dependency
|
|
|
|
* @return 1 if dependencies overlap, 0 otherwise
|
|
|
|
*/
|
|
|
|
int dsCompare(const rpmDepSet A, const rpmDepSet B)
|
|
|
|
/*@*/;
|
|
|
|
|
2001-11-04 23:43:26 +08:00
|
|
|
/**
|
|
|
|
* Report a Requires: or Conflicts: dependency problem.
|
|
|
|
*/
|
2001-11-11 08:11:33 +08:00
|
|
|
void dsProblem(/*@null@*/ rpmProblemSet tsprobs,
|
|
|
|
const char * pkgNEVR, const rpmDepSet ds,
|
2001-11-08 08:12:49 +08:00
|
|
|
/*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys)
|
2001-11-11 08:11:33 +08:00
|
|
|
/*@modifies tsprobs @*/;
|
2001-11-04 23:43:26 +08:00
|
|
|
|
2001-11-03 10:34:15 +08:00
|
|
|
/**
|
|
|
|
* Compare package provides dependencies from header with a single dependency.
|
|
|
|
* @param h header
|
|
|
|
* @param ds dependency set
|
|
|
|
*/
|
|
|
|
int rangeMatchesDepFlags (Header h, const rpmDepSet req)
|
|
|
|
/*@modifies h @*/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare package name-version-release from header with a single dependency.
|
|
|
|
* @deprecated Remove from API when obsoletes is correctly implemented.
|
|
|
|
* @param h header
|
|
|
|
* @param req dependency
|
|
|
|
* @return 1 if dependency overlaps, 0 otherwise
|
|
|
|
*/
|
2001-11-11 09:46:43 +08:00
|
|
|
int headerMatchesDepFlags(const Header h, const rpmDepSet req)
|
2001-11-03 10:34:15 +08:00
|
|
|
/*@*/;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* H_RPMDS */
|