libpkgconf: queue: nuke flags parameters (ref #105)

feature/tap-sh
William Pitcock 2017-01-19 17:32:38 -06:00
parent 597c3c7faf
commit 0ca6a16ce5
4 changed files with 60 additions and 57 deletions

View File

@ -33,7 +33,7 @@ Using the `queue` module functions is the recommended way of working with depend
:param pkgconf_list_t* list: The dependency resolution queue to release. :param pkgconf_list_t* list: The dependency resolution queue to release.
:return: nothing :return: nothing
.. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) .. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
feed the solution to a callback function if a complete dependency graph is found. feed the solution to a callback function if a complete dependency graph is found.
@ -42,18 +42,16 @@ Using the `queue` module functions is the recommended way of working with depend
:param pkgconf_list_t* list: The list of dependency requests to consider. :param pkgconf_list_t* list: The list of dependency requests to consider.
:param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver. :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
:param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited. :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
:param uint flags: A bitfield of flags that is passed to the dependency resolver, optionally modifying it's behaviour.
:param void* data: An opaque pointer which is passed to the callback function. :param void* data: An opaque pointer which is passed to the callback function.
:returns: true if the dependency resolver found a solution, otherwise false. :returns: true if the dependency resolver found a solution, otherwise false.
:rtype: bool :rtype: bool
.. c:function:: void pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) .. c:function:: void pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem. Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem.
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
:param pkgconf_list_t* list: The list of dependency requests to consider. :param pkgconf_list_t* list: The list of dependency requests to consider.
:param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited. :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
:param uint flags: A bitfield of flags that is passed to the dependency resolver, optionally modifying it's behaviour.
:returns: true if the dependency resolver found a solution, otherwise false. :returns: true if the dependency resolver found a solution, otherwise false.
:rtype: bool :rtype: bool

View File

@ -131,7 +131,7 @@ struct pkgconf_pkg_ {
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data); typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);
typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsigned int flags); typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsigned int flags);
typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags); typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth);
typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, const void *data); typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, const void *data);
struct pkgconf_client_ { struct pkgconf_client_ {
@ -261,8 +261,8 @@ void pkgconf_tuple_define_global(pkgconf_client_t *client, const char *kv);
void pkgconf_queue_push(pkgconf_list_t *list, const char *package); void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list); bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list);
void pkgconf_queue_free(pkgconf_list_t *list); void pkgconf_queue_free(pkgconf_list_t *list);
bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data); bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data);
bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth, unsigned int flags); bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth);
/* cache.c */ /* cache.c */
pkgconf_pkg_t *pkgconf_cache_lookup(const pkgconf_client_t *client, const char *id); pkgconf_pkg_t *pkgconf_cache_lookup(const pkgconf_client_t *client, const char *id);

View File

@ -107,18 +107,18 @@ pkgconf_queue_free(pkgconf_list_t *list)
} }
static inline unsigned int static inline unsigned int
pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth)
{ {
if (!pkgconf_queue_compile(client, world, list)) if (!pkgconf_queue_compile(client, world, list))
return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK; return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK;
return pkgconf_pkg_verify_graph(client, world, maxdepth, flags); return pkgconf_pkg_verify_graph(client, world, maxdepth, client->flags);
} }
/* /*
* !doc * !doc
* *
* .. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) * .. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
* *
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and * Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
* feed the solution to a callback function if a complete dependency graph is found. * feed the solution to a callback function if a complete dependency graph is found.
@ -127,13 +127,12 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis
* :param pkgconf_list_t* list: The list of dependency requests to consider. * :param pkgconf_list_t* list: The list of dependency requests to consider.
* :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver. * :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
* :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited. * :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
* :param uint flags: A bitfield of flags that is passed to the dependency resolver, optionally modifying it's behaviour.
* :param void* data: An opaque pointer which is passed to the callback function. * :param void* data: An opaque pointer which is passed to the callback function.
* :returns: true if the dependency resolver found a solution, otherwise false. * :returns: true if the dependency resolver found a solution, otherwise false.
* :rtype: bool * :rtype: bool
*/ */
bool bool
pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
{ {
pkgconf_pkg_t world = { pkgconf_pkg_t world = {
.id = "virtual:world", .id = "virtual:world",
@ -145,10 +144,10 @@ pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queu
if (!maxdepth) if (!maxdepth)
maxdepth = -1; maxdepth = -1;
if (pkgconf_queue_verify(client, &world, list, maxdepth, flags) != PKGCONF_PKG_ERRF_OK) if (pkgconf_queue_verify(client, &world, list, maxdepth) != PKGCONF_PKG_ERRF_OK)
return false; return false;
if (!func(client, &world, data, maxdepth, flags)) if (!func(client, &world, data, maxdepth))
{ {
pkgconf_pkg_free(client, &world); pkgconf_pkg_free(client, &world);
return false; return false;
@ -162,19 +161,18 @@ pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queu
/* /*
* !doc * !doc
* *
* .. c:function:: void pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, unsigned int flags, void *data) * .. c:function:: void pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
* *
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem. * Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem.
* *
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. * :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
* :param pkgconf_list_t* list: The list of dependency requests to consider. * :param pkgconf_list_t* list: The list of dependency requests to consider.
* :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited. * :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
* :param uint flags: A bitfield of flags that is passed to the dependency resolver, optionally modifying it's behaviour.
* :returns: true if the dependency resolver found a solution, otherwise false. * :returns: true if the dependency resolver found a solution, otherwise false.
* :rtype: bool * :rtype: bool
*/ */
bool bool
pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth, unsigned int flags) pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth)
{ {
bool retval = true; bool retval = true;
pkgconf_pkg_t world = { pkgconf_pkg_t world = {
@ -187,7 +185,7 @@ pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxde
if (!maxdepth) if (!maxdepth)
maxdepth = -1; maxdepth = -1;
if (pkgconf_queue_verify(client, &world, list, maxdepth, flags) != PKGCONF_PKG_ERRF_OK) if (pkgconf_queue_verify(client, &world, list, maxdepth) != PKGCONF_PKG_ERRF_OK)
retval = false; retval = false;
pkgconf_pkg_free(client, &world); pkgconf_pkg_free(client, &world);

85
main.c
View File

@ -220,7 +220,7 @@ print_provides(pkgconf_pkg_t *pkg)
} }
static bool static bool
apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
(void) unused; (void) unused;
@ -231,7 +231,7 @@ apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_dependency_t *dep = iter->data; pkgconf_dependency_t *dep = iter->data;
pkg = pkgconf_pkg_verify_dependency(client, dep, flags, NULL); pkg = pkgconf_pkg_verify_dependency(client, dep, client->flags, NULL);
print_provides(pkg); print_provides(pkg);
pkgconf_pkg_free(&pkg_client, pkg); pkgconf_pkg_free(&pkg_client, pkg);
@ -259,7 +259,7 @@ print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused, u
} }
static bool static bool
apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
int eflag; int eflag;
@ -267,7 +267,7 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n"); printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
printf("node [fontname=Sans fontsize=8]\n"); printf("node [fontname=Sans fontsize=8]\n");
eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, unused, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -277,11 +277,11 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
} }
static bool static bool
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
int eflag; int eflag;
eflag = pkgconf_pkg_traverse(client, world, print_modversion, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_modversion, unused, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -290,11 +290,11 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, i
} }
static bool static bool
apply_variables(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_variables(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
int eflag; int eflag;
eflag = pkgconf_pkg_traverse(client, world, print_variables, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_variables, unused, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -313,11 +313,11 @@ print_path(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsigned in
} }
static bool static bool
apply_path(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_path(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
int eflag; int eflag;
eflag = pkgconf_pkg_traverse(client, world, print_path, unused, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_path, unused, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -352,7 +352,7 @@ print_variable(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsigne
} }
static bool static bool
apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, int maxdepth, unsigned int flags) apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, int maxdepth)
{ {
int eflag; int eflag;
@ -362,7 +362,7 @@ apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, i
*req.buf = '\0'; *req.buf = '\0';
eflag = pkgconf_pkg_traverse(client, world, print_variable, &req, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_variable, &req, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -371,7 +371,7 @@ apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, i
} }
static bool static bool
apply_cflags(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_cflags(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER; pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER;
pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER; pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER;
@ -379,11 +379,12 @@ apply_cflags(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int m
char *render_buf; char *render_buf;
(void) unused; (void) unused;
eflag = pkgconf_pkg_cflags(client, world, &unfiltered_list, maxdepth, flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE); /* XXX: why is this PKGCONF_PKG_PKGF_SEARCH_PRIVATE here? */
eflag = pkgconf_pkg_cflags(client, world, &unfiltered_list, maxdepth, client->flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_cflags, NULL, flags); pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_cflags, NULL, client->flags);
if (filtered_list.head == NULL) if (filtered_list.head == NULL)
return true; return true;
@ -399,7 +400,7 @@ apply_cflags(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int m
} }
static bool static bool
apply_libs(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_libs(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER; pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER;
pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER; pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER;
@ -407,11 +408,11 @@ apply_libs(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int max
char *render_buf; char *render_buf;
(void) unused; (void) unused;
eflag = pkgconf_pkg_libs(client, world, &unfiltered_list, maxdepth, flags); eflag = pkgconf_pkg_libs(client, world, &unfiltered_list, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_libs, NULL, flags); pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_libs, NULL, client->flags);
if (filtered_list.head == NULL) if (filtered_list.head == NULL)
return true; return true;
@ -427,7 +428,7 @@ apply_libs(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int max
} }
static bool static bool
apply_requires(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_requires(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
(void) unused; (void) unused;
@ -438,7 +439,7 @@ apply_requires(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_dependency_t *dep = iter->data; pkgconf_dependency_t *dep = iter->data;
pkg = pkgconf_pkg_verify_dependency(client, dep, flags, NULL); pkg = pkgconf_pkg_verify_dependency(client, dep, client->flags, NULL);
print_requires(pkg); print_requires(pkg);
pkgconf_pkg_free(&pkg_client, pkg); pkgconf_pkg_free(&pkg_client, pkg);
@ -448,7 +449,7 @@ apply_requires(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
} }
static bool static bool
apply_requires_private(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int flags) apply_requires_private(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{ {
pkgconf_node_t *iter; pkgconf_node_t *iter;
(void) unused; (void) unused;
@ -459,7 +460,7 @@ apply_requires_private(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unu
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg;
pkgconf_dependency_t *dep = iter->data; pkgconf_dependency_t *dep = iter->data;
pkg = pkgconf_pkg_verify_dependency(client, dep, flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE, NULL); pkg = pkgconf_pkg_verify_dependency(client, dep, client->flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE, NULL);
print_requires_private(pkg); print_requires_private(pkg);
pkgconf_pkg_free(&pkg_client, pkg); pkgconf_pkg_free(&pkg_client, pkg);
@ -479,11 +480,11 @@ check_uninstalled(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsi
} }
static bool static bool
apply_uninstalled(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags) apply_uninstalled(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
{ {
int eflag; int eflag;
eflag = pkgconf_pkg_traverse(client, world, check_uninstalled, data, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, check_uninstalled, data, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -524,11 +525,11 @@ print_graph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsig
} }
static bool static bool
apply_simulate(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth, unsigned int flags) apply_simulate(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
{ {
int eflag; int eflag;
eflag = pkgconf_pkg_traverse(client, world, print_graph_node, data, maxdepth, flags); eflag = pkgconf_pkg_traverse(client, world, print_graph_node, data, maxdepth, client->flags);
if (eflag != PKGCONF_PKG_ERRF_OK) if (eflag != PKGCONF_PKG_ERRF_OK)
return false; return false;
@ -808,6 +809,9 @@ main(int argc, char *argv[])
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL) if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
pkgconf_client_set_sysroot_dir(&pkg_client, sysroot_dir); pkgconf_client_set_sysroot_dir(&pkg_client, sysroot_dir);
/* we have determined what features we want most likely. in some cases, we override later. */
pkgconf_client_set_flags(&pkg_client, want_client_flags);
/* at this point, want_client_flags should be set, so build the dir list */ /* at this point, want_client_flags should be set, so build the dir list */
pkgconf_pkg_dir_list_build(&pkg_client, want_client_flags); pkgconf_pkg_dir_list_build(&pkg_client, want_client_flags);
@ -965,14 +969,15 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_simulate, -1, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS, NULL)) pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_simulate, -1, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
} }
} }
if (!pkgconf_queue_validate(&pkg_client, &pkgq, maximum_traverse_depth, want_client_flags)) if (!pkgconf_queue_validate(&pkg_client, &pkgq, maximum_traverse_depth))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -984,7 +989,7 @@ main(int argc, char *argv[])
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED) if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
pkgconf_queue_apply(&pkg_client, &pkgq, apply_uninstalled, maximum_traverse_depth, want_client_flags, &ret); pkgconf_queue_apply(&pkg_client, &pkgq, apply_uninstalled, maximum_traverse_depth, &ret);
goto out; goto out;
} }
@ -992,7 +997,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_provides, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_provides, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1003,7 +1008,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_digraph, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_digraph, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1014,7 +1019,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_modversion, 2, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_modversion, 2, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1025,7 +1030,8 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_path, 2, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL, NULL)) pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_path, 2, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1036,7 +1042,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variables, 2, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variables, 2, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1047,7 +1053,8 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variable, 2, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL, want_variable)) pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variable, 2, want_variable))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1058,7 +1065,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1069,7 +1076,7 @@ main(int argc, char *argv[])
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires_private, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires_private, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto out;
@ -1078,7 +1085,7 @@ main(int argc, char *argv[])
if ((want_flags & PKG_CFLAGS)) if ((want_flags & PKG_CFLAGS))
{ {
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_cflags, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_cflags, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out_println; goto out_println;
@ -1087,7 +1094,7 @@ main(int argc, char *argv[])
if ((want_flags & PKG_LIBS)) if ((want_flags & PKG_LIBS))
{ {
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_libs, maximum_traverse_depth, want_client_flags, NULL)) if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_libs, maximum_traverse_depth, NULL))
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out_println; goto out_println;