pkg: add flags argument to pkgconf_pkg_new_from_file
parent
297e18f2c8
commit
f8aefea7ec
|
@ -324,7 +324,7 @@ PKGCONF_API int pkgconf_compare_version(const char *a, const char *b);
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *path, FILE *f);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *path, FILE *f, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
PKGCONF_API void pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_parse(pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
PKGCONF_API void pkgconf_dependency_parse(pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail);
|
PKGCONF_API void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail);
|
||||||
|
|
|
@ -387,18 +387,19 @@ pkgconf_pkg_validate(const pkgconf_client_t *client, const pkgconf_pkg_t *pkg)
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. 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, unsigned int flags)
|
||||||
*
|
*
|
||||||
* Parse a .pc file into a pkgconf_pkg_t object structure.
|
* Parse a .pc file into a pkgconf_pkg_t object structure.
|
||||||
*
|
*
|
||||||
* :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 char* filename: The filename of the package file (including full path).
|
* :param char* filename: The filename of the package file (including full path).
|
||||||
* :param FILE* f: The file object to read from.
|
* :param FILE* f: The file object to read from.
|
||||||
|
* :param uint flags: The flags to use when parsing.
|
||||||
* :returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
* :returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
||||||
* :rtype: pkgconf_pkg_t *
|
* :rtype: pkgconf_pkg_t *
|
||||||
*/
|
*/
|
||||||
pkgconf_pkg_t *
|
pkgconf_pkg_t *
|
||||||
pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *f)
|
pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
pkgconf_pkg_t *pkg;
|
||||||
char *idptr;
|
char *idptr;
|
||||||
|
@ -407,6 +408,7 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||||
pkg->owner = client;
|
pkg->owner = client;
|
||||||
pkg->filename = strdup(filename);
|
pkg->filename = strdup(filename);
|
||||||
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
||||||
|
pkg->flags = flags;
|
||||||
|
|
||||||
char *pc_filedir_value = convert_path_to_value(pkg->pc_filedir);
|
char *pc_filedir_value = convert_path_to_value(pkg->pc_filedir);
|
||||||
pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true, pkg->flags);
|
pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true, pkg->flags);
|
||||||
|
@ -579,14 +581,12 @@ pkgconf_pkg_try_specific_path(pkgconf_client_t *client, const char *path, const
|
||||||
if (!(client->flags & PKGCONF_PKG_PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
|
if (!(client->flags & PKGCONF_PKG_PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "found (uninstalled): %s", uninst_locbuf);
|
PKGCONF_TRACE(client, "found (uninstalled): %s", uninst_locbuf);
|
||||||
pkg = pkgconf_pkg_new_from_file(client, uninst_locbuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, uninst_locbuf, f, PKGCONF_PKG_PROPF_UNINSTALLED);
|
||||||
if (pkg != NULL)
|
|
||||||
pkg->flags |= PKGCONF_PKG_PROPF_UNINSTALLED;
|
|
||||||
}
|
}
|
||||||
else if ((f = fopen(locbuf, "r")) != NULL)
|
else if ((f = fopen(locbuf, "r")) != NULL)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "found: %s", locbuf);
|
PKGCONF_TRACE(client, "found: %s", locbuf);
|
||||||
pkg = pkgconf_pkg_new_from_file(client, locbuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, locbuf, f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
|
@ -624,7 +624,7 @@ pkgconf_pkg_scan_dir(pkgconf_client_t *client, const char *path, void *data, pkg
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pkg = pkgconf_pkg_new_from_file(client, filebuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, filebuf, f, 0);
|
||||||
if (pkg != NULL)
|
if (pkg != NULL)
|
||||||
{
|
{
|
||||||
if (func(pkg, data))
|
if (func(pkg, data))
|
||||||
|
@ -744,7 +744,7 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name)
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "%s is a file", name);
|
PKGCONF_TRACE(client, "%s is a file", name);
|
||||||
|
|
||||||
pkg = pkgconf_pkg_new_from_file(client, name, f);
|
pkg = pkgconf_pkg_new_from_file(client, name, f, 0);
|
||||||
if (pkg != NULL)
|
if (pkg != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true);
|
pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true);
|
||||||
|
|
Loading…
Reference in New Issue