diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-06-15 09:20:58 +0200 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2016-01-29 14:25:21 -0800 |
commit | 9ef2d3475df0eba199427e9c47d9e502bd45b116 (patch) | |
tree | e757642283c11c4ac7dd7e6c27c4522512fff91f | |
parent | 52baea8489d1670f924a2904a1cd866402ef273f (diff) |
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
-rw-r--r-- | parse.c | 8 | ||||
-rw-r--r-- | parse.h | 7 | ||||
-rw-r--r-- | pkg.c | 34 |
3 files changed, 27 insertions, 22 deletions
@@ -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) { @@ -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); @@ -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)); |