forked from ariadne/pkgconf
pkg: add pkg_get_comparator()
parent
774ebc9716
commit
648c39cf8e
29
pkg.c
29
pkg.c
|
@ -142,6 +142,35 @@ pkg_compare_version(const char *a, const char *b)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* pkg_get_comparator(pkgdep)
|
||||
*
|
||||
* returns the comparator used in a depgraph dependency node as a string.
|
||||
*/
|
||||
const char *
|
||||
pkg_get_comparator(pkg_dependency_t *pkgdep)
|
||||
{
|
||||
switch(pkgdep->compare)
|
||||
{
|
||||
case PKG_LESS_THAN:
|
||||
return "<";
|
||||
case PKG_GREATER_THAN:
|
||||
return ">";
|
||||
case PKG_LESS_THAN_EQUAL:
|
||||
return "<=";
|
||||
case PKG_GREATER_THAN_EQUAL:
|
||||
return ">=";
|
||||
case PKG_EQUAL:
|
||||
return "=";
|
||||
case PKG_NOT_EQUAL:
|
||||
return "!=";
|
||||
case PKG_ANY:
|
||||
return "(any)";
|
||||
}
|
||||
|
||||
return "???";
|
||||
}
|
||||
|
||||
/*
|
||||
* pkg_verify_dependency(pkgdep)
|
||||
*
|
||||
|
|
1
pkg.h
1
pkg.h
|
@ -93,6 +93,7 @@ void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *d
|
|||
void pkg_verify_graph(pkg_t *root, int depth);
|
||||
int pkg_compare_version(const char *a, const char *b);
|
||||
pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep);
|
||||
const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
|
||||
|
||||
/* parse.c */
|
||||
pkg_t *parse_file(const char *path);
|
||||
|
|
Loading…
Reference in New Issue