From 8cc6897ae9fc80e0c3933ff13f15c2f240c00c6e Mon Sep 17 00:00:00 2001 From: Shell Turner Date: Tue, 27 Mar 2018 20:08:48 +0100 Subject: [PATCH 1/2] buildRustCrate: fix equality testing Use string equality instead of integer equality. --- pkgs/build-support/rust/build-rust-crate.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/rust/build-rust-crate.nix b/pkgs/build-support/rust/build-rust-crate.nix index 8a9a07fd7a8..75563e34c38 100644 --- a/pkgs/build-support/rust/build-rust-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate.nix @@ -19,7 +19,7 @@ let makeDeps = dependencies: echo_build_heading() { start="" end="" - if [[ x"${colors}" -eq x"always" ]]; then + if [[ x"${colors}" = x"always" ]]; then start="$(printf '\033[0;1;32m')" #set bold, and set green. end="$(printf '\033[0m')" #returns to "normal" fi @@ -34,7 +34,7 @@ let makeDeps = dependencies: noisily() { start="" end="" - if [[ x"${colors}" -eq x"always" ]]; then + if [[ x"${colors}" = x"always" ]]; then start="$(printf '\033[0;1;32m')" #set bold, and set green. end="$(printf '\033[0m')" #returns to "normal" fi @@ -194,7 +194,7 @@ let makeDeps = dependencies: bold="" green="" boldgreen="" - if [[ "${colors}" -eq "always" ]]; then + if [[ "${colors}" = "always" ]]; then norm="$(printf '\033[0m')" #returns to "normal" bold="$(printf '\033[0;1m')" #set bold green="$(printf '\033[0;32m')" #set green @@ -230,7 +230,7 @@ let makeDeps = dependencies: ${crateFeatures} --out-dir target/bin --emit=dep-info,link -L dependency=target/deps \ $LINK ${deps}$EXTRA_LIB --cap-lints allow \ $BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors} - if [ "$crate_name_" -ne "$crate_name" ]; then + if [ "$crate_name_" != "$crate_name" ]; then mv target/bin/$crate_name_ target/bin/$crate_name fi } From d12cab3bb185ebe62b366fe36aca50ec085dbdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 28 Mar 2018 09:24:22 +0100 Subject: [PATCH 2/2] buildRustCrate: remove ancient test guards Let's leave x"" to the 1990s, where they belong --- pkgs/build-support/rust/build-rust-crate.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/rust/build-rust-crate.nix b/pkgs/build-support/rust/build-rust-crate.nix index 75563e34c38..b07a09d6355 100644 --- a/pkgs/build-support/rust/build-rust-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate.nix @@ -19,7 +19,7 @@ let makeDeps = dependencies: echo_build_heading() { start="" end="" - if [[ x"${colors}" = x"always" ]]; then + if [[ "${colors}" == "always" ]]; then start="$(printf '\033[0;1;32m')" #set bold, and set green. end="$(printf '\033[0m')" #returns to "normal" fi @@ -34,7 +34,7 @@ let makeDeps = dependencies: noisily() { start="" end="" - if [[ x"${colors}" = x"always" ]]; then + if [[ "${colors}" == "always" ]]; then start="$(printf '\033[0;1;32m')" #set bold, and set green. end="$(printf '\033[0m')" #returns to "normal" fi @@ -194,7 +194,7 @@ let makeDeps = dependencies: bold="" green="" boldgreen="" - if [[ "${colors}" = "always" ]]; then + if [[ "${colors}" == "always" ]]; then norm="$(printf '\033[0m')" #returns to "normal" bold="$(printf '\033[0;1m')" #set bold green="$(printf '\033[0;32m')" #set green