libpkgconf: pkg: uncouple resolver flags from pkgconf_pkg_dir_list_build(). (ref #105)

pull/109/head
William Pitcock 2017-01-19 17:35:35 -06:00
parent 0ca6a16ce5
commit 127fd037d4
4 changed files with 8 additions and 10 deletions

View File

@ -5,14 +5,13 @@ libpkgconf `pkg` module
The `pkg` module provides dependency resolution services and the overall `.pc` file parsing The `pkg` module provides dependency resolution services and the overall `.pc` file parsing
routines. routines.
.. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client, unsigned int flags) .. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client)
Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is provided, Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used. ``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
:param pkgconf_client_t* client: The pkgconf client object to bootstrap. :param pkgconf_client_t* client: The pkgconf client object to bootstrap.
:param uint flags: A set of dependency resolver options.
:return: nothing :return: nothing
.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f) .. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f)

View File

@ -216,7 +216,7 @@ pkgconf_pkg_t *pkgconf_builtin_pkg_get(const char *name);
int pkgconf_compare_version(const char *a, const char *b); int pkgconf_compare_version(const char *a, const char *b);
pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func); pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
void pkgconf_pkg_dir_list_build(pkgconf_client_t *client, unsigned int flags); void pkgconf_pkg_dir_list_build(pkgconf_client_t *client);
/* parse.c */ /* parse.c */
pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *path, FILE *f); pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *path, FILE *f);

View File

@ -100,22 +100,21 @@ pkg_get_parent_dir(pkgconf_pkg_t *pkg)
/* /*
* !doc * !doc
* *
* .. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client, unsigned int flags) * .. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client)
* *
* Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is provided, * Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
* then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the * then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
* ``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used. * ``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
* *
* :param pkgconf_client_t* client: The pkgconf client object to bootstrap. * :param pkgconf_client_t* client: The pkgconf client object to bootstrap.
* :param uint flags: A set of dependency resolver options.
* :return: nothing * :return: nothing
*/ */
void void
pkgconf_pkg_dir_list_build(pkgconf_client_t *client, unsigned int flags) pkgconf_pkg_dir_list_build(pkgconf_client_t *client)
{ {
pkgconf_path_build_from_environ("PKG_CONFIG_PATH", NULL, &client->dir_list, true); pkgconf_path_build_from_environ("PKG_CONFIG_PATH", NULL, &client->dir_list, true);
if (!(flags & PKGCONF_PKG_PKGF_ENV_ONLY)) if (!(client->flags & PKGCONF_PKG_PKGF_ENV_ONLY))
pkgconf_path_build_from_environ("PKG_CONFIG_LIBDIR", get_default_pkgconfig_path(), &client->dir_list, true); pkgconf_path_build_from_environ("PKG_CONFIG_LIBDIR", get_default_pkgconfig_path(), &client->dir_list, true);
} }

2
main.c
View File

@ -813,7 +813,7 @@ main(int argc, char *argv[])
pkgconf_client_set_flags(&pkg_client, want_client_flags); 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);
if (required_pkgconfig_version != NULL) if (required_pkgconfig_version != NULL)
{ {