The iteration order of GHashTable changed in GLib 2.59, which broke the
check-print-options test, as it relied on a fixed output order from the
--list-all argument to pkg-config.
Fix that by making print_package_list() output in alphabetical order by
Package.key; and update the test to match. This should work with older
and newer versions of GLib.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
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.
Normally, the parser will exit immediately when it encounters errors in
.pc files. This is good most of the time, but for --list-all, the
purpose is to just get a quick list of packages and not to validate .pc
files. This is especially the case for pkg-config wrappers such as the
Ruby or Bash completion modules that scrape the output from --list-all
and don't expect to encounter errors there.
Freedesktop #26615 (https://bugs.freedesktop.org/show_bug.cgi?id=26615)
The --atleast/exact/max-version help description implied that it would
return as --exists does. However, this would only occur if no other
output options were set.
Freedesktop #54389 (https://bugs.freedesktop.org/show_bug.cgi?id=54389)
Currently, any output option (e.g., --version or --libs) will be set as
valid and what's output is at the mercy of the order of the output
handling code in main(). However, most combinations of output would make
no sense to be used together. For example, mixing --modversion and
--print-provides provides no way to differentiate between the output
from the options. Further, mixing --variable and --cflags currently
causes an error because there's no space separating the option outputs.
Instead, keep track of when an output option has been set and ignore
subsequent output options. There are currently two exceptions:
1. Any combination of --cflags* and --libs* are allowed.
2. Both --print-requires and --print-requires-private can be used
together as the user may just not care which is private.
Freedesktop #54391 (https://bugs.freedesktop.org/show_bug.cgi?id=54391)
Apparently g_hash_table_foreach doesn't check for NULL input, so make
sure we don't call it to print the variables if the variable list is
empty.
Freedesktop #54721
Add tests for checking the output of various options that print
information. For --list-all, a subdirectory with only two packages has
been added so that its output doesn't change when more test packages are
added to the check directory.