From d1b7dd42d19c688bbb743cd83ccf2c518b75614c Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Tue, 11 Dec 2012 09:35:21 -0800 Subject: Enforce exclusive output options 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) --- check/check-print-options | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'check') diff --git a/check/check-print-options b/check/check-print-options index f9ce636..17aec1d 100755 --- a/check/check-print-options +++ b/check/check-print-options @@ -37,3 +37,18 @@ run_test --print-requires-private requires-test RESULT="sub1 Subdirectory package 1 - Test package 1 for subdirectory sub2 Subdirectory package 2 - Test package 2 for subdirectory" PKG_CONFIG_LIBDIR="$srcdir/sub" run_test --list-all + +# Check handling when multiple incompatible options are set +RESULT="Ignoring incompatible output option \"--modversion\" +$PACKAGE_VERSION" +run_test --version --modversion simple + +RESULT="Ignoring incompatible output option \"--version\" +1.0.0" +run_test --modversion --version simple + +# --print-requires/--print-requires-private allowed together +RESULT="public-dep >= 1 +private-dep >= 1" +run_test --print-requires --print-requires-private requires-test +run_test --print-requires-private --print-requires requires-test -- cgit v1.2.1