3
0
Fork 0
forked from mirrors/nixpkgs

lib/strings: guard against an easy mistake

This would catch the bad `fwknop` flags fixed in 580cab57e4,
during evaluation already.
This commit is contained in:
Vladimír Čunát 2018-08-12 10:17:08 +02:00
parent 50674becf6
commit fecb444e18
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -412,7 +412,9 @@ rec {
enableFeature false "shared"
=> "--disable-shared"
*/
enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
enableFeature = enable: feat:
assert isString feat; # e.g. passing openssl instead of "openssl"
"--${if enable then "enable" else "disable"}-${feat}";
/* Create an --{enable-<feat>=<value>,disable-<feat>} string that can be passed to
standard GNU Autoconf scripts.
@ -434,7 +436,9 @@ rec {
withFeature false "shared"
=> "--without-shared"
*/
withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}";
withFeature = with_: feat:
assert isString feat; # e.g. passing openssl instead of "openssl"
"--${if with_ then "with" else "without"}-${feat}";
/* Create an --{with-<feat>=<value>,without-<feat>} string that can be passed to
standard GNU Autoconf scripts.