mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2025-12-20 05:30:03 +01:00
Pass key into parse_package_key so it can be set early
We will need this to properly pick up environment-overridden per-package vairables. https://bugs.freedesktop.org/show_bug.cgi?id=90917
This commit is contained in:
parent
52baea8489
commit
9ef2d3475d
3 changed files with 27 additions and 22 deletions
8
parse.c
8
parse.c
|
|
@ -1079,9 +1079,10 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
|
|||
}
|
||||
|
||||
Package*
|
||||
parse_package_file (const char *path, gboolean ignore_requires,
|
||||
gboolean ignore_private_libs,
|
||||
gboolean ignore_requires_private)
|
||||
parse_package_file (const char *key, const char *path,
|
||||
gboolean ignore_requires,
|
||||
gboolean ignore_private_libs,
|
||||
gboolean ignore_requires_private)
|
||||
{
|
||||
FILE *f;
|
||||
Package *pkg;
|
||||
|
|
@ -1101,6 +1102,7 @@ parse_package_file (const char *path, gboolean ignore_requires,
|
|||
debug_spew ("Parsing package file '%s'\n", path);
|
||||
|
||||
pkg = g_new0 (Package, 1);
|
||||
pkg->key = g_strdup (key);
|
||||
|
||||
if (path)
|
||||
{
|
||||
|
|
|
|||
7
parse.h
7
parse.h
|
|
@ -22,9 +22,10 @@
|
|||
|
||||
#include "pkg.h"
|
||||
|
||||
Package *parse_package_file (const char *path, gboolean ignore_requires,
|
||||
gboolean ignore_private_libs,
|
||||
gboolean ignore_requires_private);
|
||||
Package *parse_package_file (const char *key, const char *path,
|
||||
gboolean ignore_requires,
|
||||
gboolean ignore_private_libs,
|
||||
gboolean ignore_requires_private);
|
||||
|
||||
GList *parse_module_list (Package *pkg, const char *str, const char *path);
|
||||
|
||||
|
|
|
|||
34
pkg.c
34
pkg.c
|
|
@ -267,6 +267,7 @@ static Package *
|
|||
internal_get_package (const char *name, gboolean warn)
|
||||
{
|
||||
Package *pkg = NULL;
|
||||
char *key;
|
||||
const char *location;
|
||||
GList *iter;
|
||||
|
||||
|
|
@ -318,21 +319,8 @@ internal_get_package (const char *name, gboolean warn)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
debug_spew ("Reading '%s' from file '%s'\n", name, location);
|
||||
pkg = parse_package_file (location, ignore_requires, ignore_private_libs,
|
||||
ignore_requires_private);
|
||||
|
||||
if (pkg == NULL)
|
||||
{
|
||||
debug_spew ("Failed to parse '%s'\n", location);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strstr (location, "uninstalled.pc"))
|
||||
pkg->uninstalled = TRUE;
|
||||
|
||||
if (location != name)
|
||||
pkg->key = g_strdup (name);
|
||||
key = g_strdup (name);
|
||||
else
|
||||
{
|
||||
/* need to strip package name out of the filename */
|
||||
|
|
@ -344,10 +332,24 @@ internal_get_package (const char *name, gboolean warn)
|
|||
--start;
|
||||
|
||||
g_assert (end >= start);
|
||||
|
||||
pkg->key = g_strndup (start, end - start);
|
||||
|
||||
key = g_strndup (start, end - start);
|
||||
}
|
||||
|
||||
debug_spew ("Reading '%s' from file '%s'\n", name, location);
|
||||
pkg = parse_package_file (key, location, ignore_requires,
|
||||
ignore_private_libs, ignore_requires_private);
|
||||
g_free (key);
|
||||
|
||||
if (pkg == NULL)
|
||||
{
|
||||
debug_spew ("Failed to parse '%s'\n", location);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strstr (location, "uninstalled.pc"))
|
||||
pkg->uninstalled = TRUE;
|
||||
|
||||
pkg->path_position =
|
||||
GPOINTER_TO_INT (g_hash_table_lookup (path_positions, pkg->key));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue