From 373236ccfffe7053b1503a8992ddff7ebae3ed6f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 1 Nov 2019 15:30:09 -0400 Subject: [PATCH] treewide: JAVA_HOME may not always be defined --- .../compilers/adoptopenjdk-bin/jdk-darwin-base.nix | 2 +- .../development/compilers/adoptopenjdk-bin/jdk-linux-base.nix | 2 +- pkgs/development/compilers/graalvm/default.nix | 2 +- pkgs/development/compilers/graalvm/enterprise-edition.nix | 2 +- pkgs/development/compilers/openjdk/11.nix | 2 +- pkgs/development/compilers/openjdk/8.nix | 2 +- pkgs/development/compilers/openjdk/darwin/11.nix | 2 +- pkgs/development/compilers/openjdk/darwin/8.nix | 2 +- pkgs/development/compilers/openjdk/darwin/default.nix | 2 +- pkgs/development/compilers/openjdk/default.nix | 2 +- pkgs/development/compilers/oraclejdk/jdk-linux-base.nix | 2 +- pkgs/development/compilers/zulu/8.nix | 2 +- pkgs/development/compilers/zulu/default.nix | 2 +- pkgs/development/tools/build-managers/apache-ant/1.9.nix | 4 ++-- pkgs/development/tools/build-managers/apache-ant/default.nix | 4 ++-- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix index 03857627952d..3b9cb752b9b8 100644 --- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix @@ -37,7 +37,7 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name; # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix index 509050209fb2..fe38f2b21633 100644 --- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix @@ -54,7 +54,7 @@ let result = stdenv.mkDerivation rec { # Set JAVA_HOME automatically. cat <> "$out/nix-support/setup-hook" - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/graalvm/default.nix b/pkgs/development/compilers/graalvm/default.nix index 61e3b6c16aee..5108ce185449 100644 --- a/pkgs/development/compilers/graalvm/default.nix +++ b/pkgs/development/compilers/graalvm/default.nix @@ -270,7 +270,7 @@ in rec { # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; postFixup = openjdk.postFixup or null; diff --git a/pkgs/development/compilers/graalvm/enterprise-edition.nix b/pkgs/development/compilers/graalvm/enterprise-edition.nix index 84cb38aa8d11..e180455cb7cd 100644 --- a/pkgs/development/compilers/graalvm/enterprise-edition.nix +++ b/pkgs/development/compilers/graalvm/enterprise-edition.nix @@ -72,7 +72,7 @@ let # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/11.nix b/pkgs/development/compilers/openjdk/11.nix index 57911f2d58e6..e365b9b28b35 100644 --- a/pkgs/development/compilers/openjdk/11.nix +++ b/pkgs/development/compilers/openjdk/11.nix @@ -106,7 +106,7 @@ let # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix index 1a5848cd1a68..ff3d03321e21 100644 --- a/pkgs/development/compilers/openjdk/8.nix +++ b/pkgs/development/compilers/openjdk/8.nix @@ -231,7 +231,7 @@ let # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/darwin/11.nix b/pkgs/development/compilers/openjdk/darwin/11.nix index 4c808302b4fa..0b659b95aa8b 100644 --- a/pkgs/development/compilers/openjdk/darwin/11.nix +++ b/pkgs/development/compilers/openjdk/darwin/11.nix @@ -44,7 +44,7 @@ let # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/darwin/8.nix b/pkgs/development/compilers/openjdk/darwin/8.nix index 045901b1bae6..f804046b83dd 100644 --- a/pkgs/development/compilers/openjdk/darwin/8.nix +++ b/pkgs/development/compilers/openjdk/darwin/8.nix @@ -44,7 +44,7 @@ let # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/darwin/default.nix b/pkgs/development/compilers/openjdk/darwin/default.nix index 58e4ba990149..c954a8e2cf85 100644 --- a/pkgs/development/compilers/openjdk/darwin/default.nix +++ b/pkgs/development/compilers/openjdk/darwin/default.nix @@ -44,7 +44,7 @@ let # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/openjdk/default.nix b/pkgs/development/compilers/openjdk/default.nix index 094bd57e6e98..03121daf961f 100644 --- a/pkgs/development/compilers/openjdk/default.nix +++ b/pkgs/development/compilers/openjdk/default.nix @@ -114,7 +114,7 @@ let # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi EOF ''; diff --git a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix index e80d81dc5a00..2f1e827a26a5 100644 --- a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix +++ b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix @@ -156,7 +156,7 @@ let result = stdenv.mkDerivation rec { # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/zulu/8.nix b/pkgs/development/compilers/zulu/8.nix index d4caabc6cb83..d05ec1a682aa 100644 --- a/pkgs/development/compilers/zulu/8.nix +++ b/pkgs/development/compilers/zulu/8.nix @@ -58,7 +58,7 @@ in stdenv.mkDerivation { # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/compilers/zulu/default.nix b/pkgs/development/compilers/zulu/default.nix index 5f345c87355f..5fe2473bac6d 100644 --- a/pkgs/development/compilers/zulu/default.nix +++ b/pkgs/development/compilers/zulu/default.nix @@ -55,7 +55,7 @@ in stdenv.mkDerivation { # Set JAVA_HOME automatically. cat <> $out/nix-support/setup-hook - if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi EOF ''; diff --git a/pkgs/development/tools/build-managers/apache-ant/1.9.nix b/pkgs/development/tools/build-managers/apache-ant/1.9.nix index 0a86aaeb6ca0..661e16d83e82 100644 --- a/pkgs/development/tools/build-managers/apache-ant/1.9.nix +++ b/pkgs/development/tools/build-managers/apache-ant/1.9.nix @@ -46,14 +46,14 @@ stdenv.mkDerivation { # JRE by looking for java. The latter allows just the JRE to be # used with (say) ECJ as the compiler. Finally, allow the GNU # JVM. - if [ -z "\$JAVA_HOME" ]; then + if [ -z "\''${JAVA_HOME-}" ]; then for i in javac java gij; do if p="\$(type -p \$i)"; then export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))" break fi done - if [ -z "\$JAVA_HOME" ]; then + if [ -z "\''${JAVA_HOME-}" ]; then echo "\$0: cannot find the JDK or JRE" >&2 exit 1 fi diff --git a/pkgs/development/tools/build-managers/apache-ant/default.nix b/pkgs/development/tools/build-managers/apache-ant/default.nix index 8d1e09eeb338..28e86e291755 100644 --- a/pkgs/development/tools/build-managers/apache-ant/default.nix +++ b/pkgs/development/tools/build-managers/apache-ant/default.nix @@ -46,14 +46,14 @@ stdenv.mkDerivation { # JRE by looking for java. The latter allows just the JRE to be # used with (say) ECJ as the compiler. Finally, allow the GNU # JVM. - if [ -z "\$JAVA_HOME" ]; then + if [ -z "\''${JAVA_HOME-}" ]; then for i in javac java gij; do if p="\$(type -p \$i)"; then export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))" break fi done - if [ -z "\$JAVA_HOME" ]; then + if [ -z "\''${JAVA_HOME-}" ]; then echo "\$0: cannot find the JDK or JRE" >&2 exit 1 fi