From 2811b032d639684d3983282e9d10d89f37d161d5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 31 Oct 2019 16:50:15 +0000 Subject: [PATCH] treewide: Make still dont* Variables are optional in most cases Go beyond the obvious setup hooks now, with a bit of sed, with a skipped case: - cc-wrapper's `dontlink`, because it already is handled. Also, in nix files escaping was manually added. EMP --- pkgs/build-support/build-dotnet-package/default.nix | 8 ++++---- pkgs/build-support/setup-hooks/auto-patchelf.sh | 2 +- pkgs/build-support/setup-hooks/patch-shebangs.sh | 2 +- .../setup-hooks/update-autotools-gnu-config-scripts.sh | 2 +- pkgs/build-support/setup-hooks/wrap-gapps-hook.sh | 2 +- .../interpreters/python/hooks/flit-build-hook.sh | 2 +- .../interpreters/python/hooks/pip-build-hook.sh | 2 +- .../interpreters/python/hooks/pip-install-hook.sh | 2 +- .../interpreters/python/hooks/pytest-check-hook.sh | 2 +- .../python/hooks/python-catch-conflicts-hook.sh | 2 +- .../python/hooks/python-imports-check-hook.sh | 2 +- .../python/hooks/python-remove-bin-bytecode-hook.sh | 2 +- .../interpreters/python/hooks/setuptools-build-hook.sh | 4 ++-- .../interpreters/python/hooks/setuptools-check-hook.sh | 2 +- .../interpreters/python/hooks/wheel-unpack-hook.sh | 2 +- pkgs/development/libraries/qt-5/hooks/qmake-hook.sh | 2 +- .../development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh | 4 ++-- pkgs/development/node-packages/node-env.nix | 2 +- pkgs/development/python-modules/pythonnet/default.nix | 4 ++-- pkgs/development/ruby-modules/gem/default.nix | 2 +- pkgs/development/tools/ocaml/opam/opam-shebangs.patch | 2 +- pkgs/os-specific/linux/kernel/manual-config.nix | 2 +- pkgs/stdenv/cygwin/rebase-i686.sh | 2 +- pkgs/stdenv/cygwin/rebase-x86_64.sh | 2 +- 24 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pkgs/build-support/build-dotnet-package/default.nix b/pkgs/build-support/build-dotnet-package/default.nix index f36c69e4339..dae9ed888c7 100644 --- a/pkgs/build-support/build-dotnet-package/default.nix +++ b/pkgs/build-support/build-dotnet-package/default.nix @@ -29,9 +29,9 @@ attrsOrig @ configurePhase = '' runHook preConfigure - [ -z "$dontPlacateNuget" ] && placate-nuget.sh - [ -z "$dontPlacatePaket" ] && placate-paket.sh - [ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh + [ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh + [ -z "''${dontPlacatePaket-}" ] && placate-paket.sh + [ -z "''${dontPatchFSharpTargets-}" ] && patch-fsharp-targets.sh runHook postConfigure ''; @@ -69,7 +69,7 @@ attrsOrig @ cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target" - if [ -z "$dontRemoveDuplicatedDlls" ] + if [ -z "''${dontRemoveDuplicatedDlls-}" ] then pushd "$out" remove-duplicated-dlls.sh diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh index 6af8eb1aed9..52c50091d08 100644 --- a/pkgs/build-support/setup-hooks/auto-patchelf.sh +++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh @@ -228,7 +228,7 @@ autoPatchelf() { # behaviour as fixupOutputHooks because the setup hook for patchelf is run in # fixupOutput and the postFixup hook runs later. postFixupHooks+=(' - if [ -z "$dontAutoPatchelf" ]; then + if [ -z "${dontAutoPatchelf-}" ]; then autoPatchelf -- $(for output in $outputs; do [ -e "${!output}" ] || continue echo "${!output}" diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 3e900d0704c..29fed7ad794 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -105,7 +105,7 @@ patchShebangs() { } patchShebangsAuto () { - if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then + if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then # Dev output will end up being run on the build platform. An # example case of this is sdl2-config. Otherwise, we can just diff --git a/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh b/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh index 66f4e91c7bb..ebd3afa05d9 100644 --- a/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh +++ b/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh @@ -1,7 +1,7 @@ preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase" updateAutotoolsGnuConfigScriptsPhase() { - if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi for script in config.sub config.guess; do for f in $(find . -type f -name "$script"); do diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh index 717740f1f20..a05d4f689db 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh @@ -15,7 +15,7 @@ wrapGApp() { wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@" } -# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set. +# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set. wrapGAppsHook() { # guard against running multiple times (e.g. due to propagation) [ -z "$wrapGAppsHookHasRun" ] || return 0 diff --git a/pkgs/development/interpreters/python/hooks/flit-build-hook.sh b/pkgs/development/interpreters/python/hooks/flit-build-hook.sh index 48295dc3643..23198bd711b 100644 --- a/pkgs/development/interpreters/python/hooks/flit-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/flit-build-hook.sh @@ -9,7 +9,7 @@ flitBuildPhase () { echo "Finished executing flitBuildPhase" } -if [ -z "$dontUseFlitBuild" ] && [ -z "$buildPhase" ]; then +if [ -z "${dontUseFlitBuild-}" ] && [ -z "$buildPhase" ]; then echo "Using flitBuildPhase" buildPhase=flitBuildPhase fi diff --git a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh index c297bfffb1e..ac025165410 100644 --- a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh @@ -31,7 +31,7 @@ pipShellHook() { echo "Finished executing pipShellHook" } -if [ -z "$dontUsePipBuild" ] && [ -z "$buildPhase" ]; then +if [ -z "${dontUsePipBuild-}" ] && [ -z "$buildPhase" ]; then echo "Using pipBuildPhase" buildPhase=pipBuildPhase fi diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh index f528ec63cb8..ca5aa2f983b 100644 --- a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -18,7 +18,7 @@ pipInstallPhase() { echo "Finished executing pipInstallPhase" } -if [ -z "$dontUsePipInstall" ] && [ -z "$installPhase" ]; then +if [ -z "${dontUsePipInstall-}" ] && [ -z "$installPhase" ]; then echo "Using pipInstallPhase" installPhase=pipInstallPhase fi diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh index 24510b9f993..9065b69fc09 100644 --- a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -43,7 +43,7 @@ function pytestCheckPhase() { echo "Finished executing pytestCheckPhase" } -if [ -z "$dontUsePytestCheck" ] && [ -z "$installCheckPhase" ]; then +if [ -z "${dontUsePytestCheck-}" ] && [ -z "$installCheckPhase" ]; then echo "Using pytestCheckPhase" preDistPhases+=" pytestCheckPhase" fi diff --git a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh index e9065cf1793..374a2eddb40 100644 --- a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh @@ -5,6 +5,6 @@ pythonCatchConflictsPhase() { @pythonInterpreter@ @catchConflicts@ } -if [ -z "$dontUsePythonCatchConflicts" ]; then +if [ -z "${dontUsePythonCatchConflicts-}" ]; then preDistPhases+=" pythonCatchConflictsPhase" fi diff --git a/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh index 7e2b3f69d6d..0fc55145a8e 100644 --- a/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh @@ -10,7 +10,7 @@ pythonImportsCheckPhase () { fi } -if [ -z "$dontUsePythonImportsCheck" ]; then +if [ -z "${dontUsePythonImportsCheck-}" ]; then echo "Using pythonImportsCheckPhase" preDistPhases+=" pythonImportsCheckPhase" fi diff --git a/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh b/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh index 960de767be7..2add23f2316 100644 --- a/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh @@ -12,6 +12,6 @@ pythonRemoveBinBytecodePhase () { fi } -if [ -z "$dontUsePythonRemoveBinBytecode" ]; then +if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then preDistPhases+=" pythonRemoveBinBytecodePhase" fi diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh index c99ef313c10..648f19efb36 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -36,12 +36,12 @@ setuptoolsShellHook() { echo "Finished executing setuptoolsShellHook" } -if [ -z "$dontUseSetuptoolsBuild" ] && [ -z "$buildPhase" ]; then +if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "$buildPhase" ]; then echo "Using setuptoolsBuildPhase" buildPhase=setuptoolsBuildPhase fi -if [ -z "$dontUseSetuptoolsShellHook" ] && [ -z "$shellHook" ]; then +if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "$shellHook" ]; then echo "Using setuptoolsShellHook" shellHook=setuptoolsShellHook fi diff --git a/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh index 71bb036a91a..5b07155ff4d 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh @@ -12,7 +12,7 @@ setuptoolsCheckPhase() { echo "Finished executing setuptoolsCheckPhase" } -if [ -z "$dontUseSetuptoolsCheck" ] && [ -z "$installCheckPhase" ]; then +if [ -z "${dontUseSetuptoolsCheck-}" ] && [ -z "$installCheckPhase" ]; then echo "Using setuptoolsCheckPhase" preDistPhases+=" setuptoolsCheckPhase" fi diff --git a/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh b/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh index 6dd0c5be4cb..81efdb0d411 100644 --- a/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh +++ b/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh @@ -12,7 +12,7 @@ wheelUnpackPhase(){ echo "Finished executing wheelUnpackPhase" } -if [ -z "$dontUseWheelUnpack" ] && [ -z "$unpackPhase" ]; then +if [ -z "${dontUseWheelUnpack-}" ] && [ -z "$unpackPhase" ]; then echo "Using wheelUnpackPhase" unpackPhase=wheelUnpackPhase fi diff --git a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh index c3373983e32..fc4a0be6282 100644 --- a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh @@ -31,6 +31,6 @@ qmakeConfigurePhase() { runHook postConfigure } -if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then +if [ -z "${dontUseQmakeConfigure-}" -a -z "$configurePhase" ]; then configurePhase=qmakeConfigurePhase fi diff --git a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh index d2aadbd956a..d9e5880289d 100644 --- a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh @@ -64,10 +64,10 @@ qtOwnPathsHook() { preFixupPhases+=" qtOwnPathsHook" -# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set. +# Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set. wrapQtAppsHook() { # skip this hook when requested - [ -z "$dontWrapQtApps" ] || return 0 + [ -z "${dontWrapQtApps-}" ] || return 0 # guard against running multiple times (e.g. due to propagation) [ -z "$wrapQtAppsHookHasRun" ] || return 0 diff --git a/pkgs/development/node-packages/node-env.nix b/pkgs/development/node-packages/node-env.nix index 670556bf271..7cc212c41bd 100644 --- a/pkgs/development/node-packages/node-env.nix +++ b/pkgs/development/node-packages/node-env.nix @@ -363,7 +363,7 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild - if [ "$dontNpmInstall" != "1" ] + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json diff --git a/pkgs/development/python-modules/pythonnet/default.nix b/pkgs/development/python-modules/pythonnet/default.nix index 9bcbaf3e6f7..f916ec63b30 100644 --- a/pkgs/development/python-modules/pythonnet/default.nix +++ b/pkgs/development/python-modules/pythonnet/default.nix @@ -43,8 +43,8 @@ buildPythonPackage rec { ''; preConfigure = '' - [ -z "$dontPlacateNuget" ] && placate-nuget.sh - [ -z "$dontPlacatePaket" ] && placate-paket.sh + [ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh + [ -z "''${dontPlacatePaket-}" ] && placate-paket.sh ''; nativeBuildInputs = [ diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix index 7b92a586b54..af38160a5fa 100644 --- a/pkgs/development/ruby-modules/gem/default.nix +++ b/pkgs/development/ruby-modules/gem/default.nix @@ -99,7 +99,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { runHook preUnpack if [[ -f $src && $src == *.gem ]]; then - if [[ -z "$dontBuild" ]]; then + if [[ -z "''${dontBuild-}" ]]; then # we won't know the name of the directory that RubyGems creates, # so we'll just use a glob to find it and move it over. gempkg="$src" diff --git a/pkgs/development/tools/ocaml/opam/opam-shebangs.patch b/pkgs/development/tools/ocaml/opam/opam-shebangs.patch index f74ac84ca6b..13aa7a89570 100644 --- a/pkgs/development/tools/ocaml/opam/opam-shebangs.patch +++ b/pkgs/development/tools/ocaml/opam/opam-shebangs.patch @@ -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" diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 87fa9c8f08e..d206910732c 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -179,7 +179,7 @@ let '' else "") + (if isModular then '' mkdir -p $dev cp vmlinux $dev/ - if [ -z "$dontStrip" ]; then + if [ -z "''${dontStrip-}" ]; then installFlagsArray+=("INSTALL_MOD_STRIP=1") fi make modules_install $makeFlags "''${makeFlagsArray[@]}" \ diff --git a/pkgs/stdenv/cygwin/rebase-i686.sh b/pkgs/stdenv/cygwin/rebase-i686.sh index 091c9044d93..6b8ec441ca7 100644 --- a/pkgs/stdenv/cygwin/rebase-i686.sh +++ b/pkgs/stdenv/cygwin/rebase-i686.sh @@ -1,7 +1,7 @@ fixupOutputHooks+=(_cygwinFixAutoImageBase) _cygwinFixAutoImageBase() { - if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then + if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then return fi find "$prefix" -name "*.dll" -type f | while read DLL; do diff --git a/pkgs/stdenv/cygwin/rebase-x86_64.sh b/pkgs/stdenv/cygwin/rebase-x86_64.sh index 4c8f8ebd7eb..6dccdc40c72 100644 --- a/pkgs/stdenv/cygwin/rebase-x86_64.sh +++ b/pkgs/stdenv/cygwin/rebase-x86_64.sh @@ -1,7 +1,7 @@ fixupOutputHooks+=(_cygwinFixAutoImageBase) _cygwinFixAutoImageBase() { - if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then + if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then return fi find "$prefix" -name "*.dll" -type f | while read DLL; do