pkg: add resolver flags to pkg_find() and pkg_verify_dependency().

feature/tap-sh
William Pitcock 2012-05-02 23:14:53 +00:00
parent 62f1bfbc5b
commit 187b4e538f
3 changed files with 9 additions and 9 deletions

4
main.c
View File

@ -215,7 +215,7 @@ pkg_queue_walk(pkg_queue_t *head)
{
pkg_t *pkg;
pkg = pkg_verify_dependency(iter);
pkg = pkg_verify_dependency(iter, global_traverse_flags);
print_requires(pkg, NULL);
}
}
@ -362,7 +362,7 @@ main(int argc, char *argv[])
if (package == NULL)
return EXIT_SUCCESS;
pkg = pkg_find(package);
pkg = pkg_find(package, global_traverse_flags);
if (pkg == NULL)
return EXIT_FAILURE;

10
pkg.c
View File

@ -59,7 +59,7 @@ path_split(const char *text, char ***parv)
}
pkg_t *
pkg_find(const char *name)
pkg_find(const char *name, unsigned int flags)
{
char locbuf[PKG_CONFIG_PATH_SZ];
char **path;
@ -233,17 +233,17 @@ pkg_get_comparator(pkg_dependency_t *pkgdep)
}
/*
* pkg_verify_dependency(pkgdep)
* pkg_verify_dependency(pkgdep, flags)
*
* verify a pkg_dependency_t node in the depgraph. if the dependency is solvable,
* return the appropriate pkg_t object, else NULL.
*/
pkg_t *
pkg_verify_dependency(pkg_dependency_t *pkgdep)
pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags)
{
pkg_t *pkg;
pkg = pkg_find(pkgdep->package);
pkg = pkg_find(pkgdep->package, flags);
if (pkg == NULL)
return NULL;
@ -312,7 +312,7 @@ pkg_walk_list(pkg_t *parent,
if (*node->package == '\0')
continue;
pkgdep = pkg_verify_dependency(node);
pkgdep = pkg_verify_dependency(node, flags);
if (pkgdep == NULL)
{
fprintf(stderr, "Package %s was not found in the pkg-config search path.\n", node->package);

4
pkg.h
View File

@ -103,11 +103,11 @@ struct pkg_ {
#define PKGF_NONE 0x0
#define PKGF_SEARCH_PRIVATE 0x1
pkg_t *pkg_find(const char *name);
pkg_t *pkg_find(const char *name, unsigned int flags);
void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *data), void *data, int maxdepth, unsigned int flags);
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);
pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags);
const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
/* parse.c */