summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-06-15 09:20:58 +0200
committerDan Nicholson <dbn.lists@gmail.com>2016-01-29 14:25:21 -0800
commit9ef2d3475df0eba199427e9c47d9e502bd45b116 (patch)
treee757642283c11c4ac7dd7e6c27c4522512fff91f
parent52baea8489d1670f924a2904a1cd866402ef273f (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.c8
-rw-r--r--parse.h7
-rw-r--r--pkg.c34
3 files changed, 27 insertions, 22 deletions
diff --git a/parse.c b/parse.c
index b69f9fc..700eed9 100644
--- a/parse.c
+++ b/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)
{
diff --git a/parse.h b/parse.h
index 3169090..4ec84aa 100644
--- a/parse.h
+++ b/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);
diff --git a/pkg.c b/pkg.c
index 7f583e7..c8bac4d 100644
--- a/pkg.c
+++ b/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));