On Tue, Mar 1, 2011 at 2:17 PM, Rémy Oudompheng <[email protected]> wrote: > --- > lib/libalpm/alpm.h | 34 ++++++++++++++++++++++++++++++++++ > 1 files changed, 34 insertions(+), 0 deletions(-) > > diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h > index 7fa27d8..14a2782 100644 > --- a/lib/libalpm/alpm.h > +++ b/lib/libalpm/alpm.h > @@ -593,12 +593,19 @@ int alpm_remove_pkg(pmpkg_t *pkg); > * Dependencies and conflicts > */ > > +/** @brief Types of version constraints in dependency specs. */ > typedef enum _pmdepmod_t { > + /** No version constraint */ > PM_DEP_MOD_ANY = 1, > + /** Test version equality (package=x.y.z) */ > PM_DEP_MOD_EQ, > + /** Test for at least a version (package>=x.y.z) */ > PM_DEP_MOD_GE, > + /** Test for at most a version (package<=x.y.z) */ > PM_DEP_MOD_LE, > + /** Test for greater than some version (package>x.y.z) */ > PM_DEP_MOD_GT, > + /** Test for less than some version (package<x.y.z) */ > PM_DEP_MOD_LT > } pmdepmod_t; > > @@ -617,9 +624,36 @@ const char *alpm_conflict_get_package1(pmconflict_t > *conflict); > const char *alpm_conflict_get_package2(pmconflict_t *conflict); > const char *alpm_conflict_get_reason(pmconflict_t *conflict); > > +/** > + * @brief Returns the type of version constraint.
If this dependency did not specify a version, PM_DEP_MOD_ANY is returned. > + * @param dep a dependency info structure > + * @return the type of version constraint. > + */ > pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep); > + > +/** > + * @brief Returns the package name of a dependency constraint. > + * @param dep a dependency info structure > + * @return a pointer to an internal string. > + */ > const char *alpm_dep_get_name(const pmdepend_t *dep); > + > +/** > + * @brief Returns the version specified by a dependency constraint. > + * > + * The version information is stored in the same form as returned by ######alpm_pkg_get_version(). If this dependency did not specify a version, NULL is returned. > as a string of the form > + * "1.2.3-4". > + * @param dep a dependency info structure > + * @return a pointer to an internal string or NULL. > + */ > const char *alpm_dep_get_version(const pmdepend_t *dep); > + > +/** > + * Returns a newly allocated string representing the dependency > + * information. > + * @param dep a dependency info structure > + * @return a formatted string, e.g. "glibc>=2.12" > + */ > char *alpm_dep_compute_string(const pmdepend_t *dep); > > /* > -- > 1.7.4.1
