diff options
| author | Eelco Dolstra <edolstra@gmail.com> | 2020-11-11 11:14:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-11 11:14:12 +0100 |
| commit | f9dd8f04a02568b202df0c37fc34b95fec0721c6 (patch) | |
| tree | d43dde37e63269e92f48590648157f26e65d5753 /lib/strings.nix | |
| parent | Merge pull request #102918 from omasanori/opencv/update-2.4.13.7 (diff) | |
| parent | lib/strings: guard against an easy mistake (diff) | |
| download | nixpkgs-f9dd8f04a02568b202df0c37fc34b95fec0721c6.tar.gz | |
Merge pull request #44928 from vcunat/p/configure-assert
lib/strings: guard against an easy mistake
Diffstat (limited to 'lib/strings.nix')
| -rw-r--r-- | lib/strings.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index f62ff6679ef5..fbb48dec92af 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -561,7 +561,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. @@ -583,7 +585,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. |
