Merge pull request #72347 from NixOS/bash-no-undef-vars

treewide: `set -u` everywhere
This commit is contained in:
John Ericson
2019-11-04 19:52:33 -05:00
committed by GitHub
65 changed files with 95 additions and 134 deletions
@@ -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
@@ -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
@@ -20,17 +20,17 @@ cmakeConfigurePhase() {
export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES
fi
if [ -z "$dontFixCmake" ]; then
if [ -z "${dontFixCmake-}" ]; then
fixCmakeFiles .
fi
if [ -z "$dontUseCmakeBuildDir" ]; then
if [ -z "${dontUseCmakeBuildDir-}" ]; then
mkdir -p build
cd build
cmakeDir=${cmakeDir:-..}
fi
if [ -z "$dontAddPrefix" ]; then
if [ -z "${dontAddPrefix-}" ]; then
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
fi
@@ -84,7 +84,7 @@ cmakeConfigurePhase() {
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
# Dont build tests when doCheck = false
if [ -z "$doCheck" ]; then
if [ -z "${doCheck-}" ]; then
cmakeFlags="-DBUILD_TESTING=OFF $cmakeFlags"
fi
@@ -99,7 +99,7 @@ cmakeConfigurePhase() {
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON $cmakeFlags"
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON $cmakeFlags"
if [ "$buildPhase" = ninjaBuildPhase ]; then
if [ "${buildPhase-}" = ninjaBuildPhase ]; then
cmakeFlags="-GNinja $cmakeFlags"
fi
@@ -115,7 +115,7 @@ cmakeConfigurePhase() {
runHook postConfigure
}
if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then
if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
setOutputFlags=
configurePhase=cmakeConfigurePhase
fi
@@ -9,6 +9,6 @@ gnConfigurePhase() {
runHook postConfigure
}
if [ -z "$dontUseGnConfigure" -a -z "$configurePhase" ]; then
if [ -z "${dontUseGnConfigure-}" -a -z "${configurePhase-}" ]; then
configurePhase=gnConfigurePhase
fi
@@ -1,7 +1,7 @@
mesonConfigurePhase() {
runHook preConfigure
if [ -z "$dontAddPrefix" ]; then
if [ -z "${dontAddPrefix-}" ]; then
mesonFlags="--prefix=$prefix $mesonFlags"
fi
@@ -36,7 +36,7 @@ mesonConfigurePhase() {
runHook postConfigure
}
if [ -z "$dontUseMesonConfigure" -a -z "$configurePhase" ]; then
if [ -z "${dontUseMesonConfigure-}" -a -z "${configurePhase-}" ]; then
setOutputFlags=
configurePhase=mesonConfigurePhase
fi
@@ -19,7 +19,7 @@ ninjaBuildPhase() {
runHook postBuild
}
if [ -z "$dontUseNinjaBuild" -a -z "$buildPhase" ]; then
if [ -z "${dontUseNinjaBuild-}" -a -z "${buildPhase-}" ]; then
buildPhase=ninjaBuildPhase
fi
@@ -38,7 +38,7 @@ ninjaInstallPhase() {
runHook postInstall
}
if [ -z "$dontUseNinjaInstall" -a -z "$installPhase" ]; then
if [ -z "${dontUseNinjaInstall-}" -a -z "${installPhase-}" ]; then
installPhase=ninjaInstallPhase
fi
@@ -73,6 +73,6 @@ ninjaCheckPhase() {
runHook postCheck
}
if [ -z "$dontUseNinjaCheck" -a -z "$checkPhase" ]; then
if [ -z "${dontUseNinjaCheck-}" -a -z "${checkPhase-}" ]; then
checkPhase=ninjaCheckPhase
fi
@@ -71,14 +71,14 @@ sconsCheckPhase() {
runHook postCheck
}
if [ -z "$buildPhase" ]; then
if [ -z "${buildPhase-}" ]; then
buildPhase=sconsBuildPhase
fi
if [ -z "$dontUseSconsInstall" -a -z "$installPhase" ]; then
if [ -z "${dontUseSconsInstall-}" -a -z "${installPhase-}" ]; then
installPhase=sconsInstallPhase
fi
if [ -z "$checkPhase" ]; then
if [ -z "${checkPhase-}" ]; then
checkPhase=sconsCheckPhase
fi
@@ -2,7 +2,7 @@
# directories from the RPATH of every library or executable in every
# output.
fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
fixupOutputHooks+=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi')
patchELF() {
local dir="$1"
@@ -14,6 +14,6 @@ premakeConfigurePhase() {
runHook postConfigure
}
if [ -z "$configurePhase" ]; then
if [ -z "${configurePhase-}" ]; then
configurePhase=premakeConfigurePhase
fi
@@ -64,7 +64,7 @@ index 00000000..3ea84e2d
+header() { echo "$1"; }
+stopNest() { true; }
+
+fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
+fixupOutputHooks+=('if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
+
+patchShebangs() {
+ local dir="$1"
+1 -1
View File
@@ -20,7 +20,7 @@ xcbuildInstallPhase () {
}
buildPhase=xcbuildBuildPhase
if [ -z "$installPhase" ]; then
if [ -z "${installPhase-}" ]; then
installPhase=xcbuildInstallPhase
fi