summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2014-02-10 08:04:31 -0800
committerDan Nicholson <nicholson@endlessm.com>2014-12-09 05:24:43 -0800
commit9294307b213c157db991d838654e7fef6842b1de (patch)
treeb555cb72322127f821cad2264c1bbeaca18a5acf
parent30437b47c81590bf8b9efffd19f9a42e6112b9cb (diff)
Handle pcfiledir variable like normal variable
Rather than responding to the pcfiledir variable specially, store it in the hash table with all the other package specific variables. This does result in pcfiledir showing up in the --print-variables output.
-rwxr-xr-xcheck/check-print-options5
-rw-r--r--parse.c11
-rw-r--r--pkg.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/check/check-print-options b/check/check-print-options
index fcd94d6..bf18eac 100755
--- a/check/check-print-options
+++ b/check/check-print-options
@@ -12,13 +12,14 @@ RESULT=1.0.0
run_test --modversion simple
# --print-variables, make sure having no variables doesn't crash
-RESULT=""
+RESULT="pcfiledir"
run_test --print-variables no-variables
RESULT="exec_prefix
prefix
libdir
-includedir"
+includedir
+pcfiledir"
run_test --print-variables simple
# --print-provides
diff --git a/parse.c b/parse.c
index 60785ea..b69f9fc 100644
--- a/parse.c
+++ b/parse.c
@@ -990,9 +990,6 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
++p;
while (*p && isspace ((guchar)*p))
++p;
-
- if (pkg->vars == NULL)
- pkg->vars = g_hash_table_new (g_str_hash, g_str_equal);
if (define_prefix && strcmp (tag, prefix_variable) == 0)
{
@@ -1114,7 +1111,13 @@ parse_package_file (const char *path, gboolean ignore_requires,
debug_spew ("No pcfiledir determined for package\n");
pkg->pcfiledir = g_strdup ("???????");
}
-
+
+ if (pkg->vars == NULL)
+ pkg->vars = g_hash_table_new (g_str_hash, g_str_equal);
+
+ /* Variable storing directory of pc file */
+ g_hash_table_insert (pkg->vars, "pcfiledir", pkg->pcfiledir);
+
str = g_string_new ("");
while (read_one_line (f, str))
diff --git a/pkg.c b/pkg.c
index 825c38a..a4733d6 100644
--- a/pkg.c
+++ b/pkg.c
@@ -1028,10 +1028,6 @@ package_get_var (Package *pkg,
if (varval == NULL && pkg->vars)
varval = g_strdup (g_hash_table_lookup (pkg->vars, var));
- /* Magic "pcfiledir" variable */
- if (varval == NULL && pkg->pcfiledir && strcmp (var, "pcfiledir") == 0)
- varval = g_strdup (pkg->pcfiledir);
-
return varval;
}