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
This commit is contained in:
John Ericson 2019-10-31 16:50:15 +00:00
parent 1290e532ea
commit 2811b032d6
24 changed files with 30 additions and 30 deletions

View File

@ -29,9 +29,9 @@ attrsOrig @
configurePhase = '' configurePhase = ''
runHook preConfigure runHook preConfigure
[ -z "$dontPlacateNuget" ] && placate-nuget.sh [ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
[ -z "$dontPlacatePaket" ] && placate-paket.sh [ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
[ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh [ -z "''${dontPatchFSharpTargets-}" ] && patch-fsharp-targets.sh
runHook postConfigure runHook postConfigure
''; '';
@ -69,7 +69,7 @@ attrsOrig @
cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target" cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"
if [ -z "$dontRemoveDuplicatedDlls" ] if [ -z "''${dontRemoveDuplicatedDlls-}" ]
then then
pushd "$out" pushd "$out"
remove-duplicated-dlls.sh remove-duplicated-dlls.sh

View File

@ -228,7 +228,7 @@ autoPatchelf() {
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in # behaviour as fixupOutputHooks because the setup hook for patchelf is run in
# fixupOutput and the postFixup hook runs later. # fixupOutput and the postFixup hook runs later.
postFixupHooks+=(' postFixupHooks+=('
if [ -z "$dontAutoPatchelf" ]; then if [ -z "${dontAutoPatchelf-}" ]; then
autoPatchelf -- $(for output in $outputs; do autoPatchelf -- $(for output in $outputs; do
[ -e "${!output}" ] || continue [ -e "${!output}" ] || continue
echo "${!output}" echo "${!output}"

View File

@ -105,7 +105,7 @@ patchShebangs() {
} }
patchShebangsAuto () { 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 # Dev output will end up being run on the build platform. An
# example case of this is sdl2-config. Otherwise, we can just # example case of this is sdl2-config. Otherwise, we can just

View File

@ -1,7 +1,7 @@
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase" preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
updateAutotoolsGnuConfigScriptsPhase() { updateAutotoolsGnuConfigScriptsPhase() {
if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi
for script in config.sub config.guess; do for script in config.sub config.guess; do
for f in $(find . -type f -name "$script"); do for f in $(find . -type f -name "$script"); do

View File

@ -15,7 +15,7 @@ wrapGApp() {
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@" wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
} }
# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set. # Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
wrapGAppsHook() { wrapGAppsHook() {
# guard against running multiple times (e.g. due to propagation) # guard against running multiple times (e.g. due to propagation)
[ -z "$wrapGAppsHookHasRun" ] || return 0 [ -z "$wrapGAppsHookHasRun" ] || return 0

View File

@ -9,7 +9,7 @@ flitBuildPhase () {
echo "Finished executing flitBuildPhase" echo "Finished executing flitBuildPhase"
} }
if [ -z "$dontUseFlitBuild" ] && [ -z "$buildPhase" ]; then if [ -z "${dontUseFlitBuild-}" ] && [ -z "$buildPhase" ]; then
echo "Using flitBuildPhase" echo "Using flitBuildPhase"
buildPhase=flitBuildPhase buildPhase=flitBuildPhase
fi fi

View File

@ -31,7 +31,7 @@ pipShellHook() {
echo "Finished executing pipShellHook" echo "Finished executing pipShellHook"
} }
if [ -z "$dontUsePipBuild" ] && [ -z "$buildPhase" ]; then if [ -z "${dontUsePipBuild-}" ] && [ -z "$buildPhase" ]; then
echo "Using pipBuildPhase" echo "Using pipBuildPhase"
buildPhase=pipBuildPhase buildPhase=pipBuildPhase
fi fi

View File

@ -18,7 +18,7 @@ pipInstallPhase() {
echo "Finished executing pipInstallPhase" echo "Finished executing pipInstallPhase"
} }
if [ -z "$dontUsePipInstall" ] && [ -z "$installPhase" ]; then if [ -z "${dontUsePipInstall-}" ] && [ -z "$installPhase" ]; then
echo "Using pipInstallPhase" echo "Using pipInstallPhase"
installPhase=pipInstallPhase installPhase=pipInstallPhase
fi fi

View File

@ -43,7 +43,7 @@ function pytestCheckPhase() {
echo "Finished executing pytestCheckPhase" echo "Finished executing pytestCheckPhase"
} }
if [ -z "$dontUsePytestCheck" ] && [ -z "$installCheckPhase" ]; then if [ -z "${dontUsePytestCheck-}" ] && [ -z "$installCheckPhase" ]; then
echo "Using pytestCheckPhase" echo "Using pytestCheckPhase"
preDistPhases+=" pytestCheckPhase" preDistPhases+=" pytestCheckPhase"
fi fi

View File

@ -5,6 +5,6 @@ pythonCatchConflictsPhase() {
@pythonInterpreter@ @catchConflicts@ @pythonInterpreter@ @catchConflicts@
} }
if [ -z "$dontUsePythonCatchConflicts" ]; then if [ -z "${dontUsePythonCatchConflicts-}" ]; then
preDistPhases+=" pythonCatchConflictsPhase" preDistPhases+=" pythonCatchConflictsPhase"
fi fi

View File

@ -10,7 +10,7 @@ pythonImportsCheckPhase () {
fi fi
} }
if [ -z "$dontUsePythonImportsCheck" ]; then if [ -z "${dontUsePythonImportsCheck-}" ]; then
echo "Using pythonImportsCheckPhase" echo "Using pythonImportsCheckPhase"
preDistPhases+=" pythonImportsCheckPhase" preDistPhases+=" pythonImportsCheckPhase"
fi fi

View File

@ -12,6 +12,6 @@ pythonRemoveBinBytecodePhase () {
fi fi
} }
if [ -z "$dontUsePythonRemoveBinBytecode" ]; then if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
preDistPhases+=" pythonRemoveBinBytecodePhase" preDistPhases+=" pythonRemoveBinBytecodePhase"
fi fi

View File

@ -36,12 +36,12 @@ setuptoolsShellHook() {
echo "Finished executing setuptoolsShellHook" echo "Finished executing setuptoolsShellHook"
} }
if [ -z "$dontUseSetuptoolsBuild" ] && [ -z "$buildPhase" ]; then if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "$buildPhase" ]; then
echo "Using setuptoolsBuildPhase" echo "Using setuptoolsBuildPhase"
buildPhase=setuptoolsBuildPhase buildPhase=setuptoolsBuildPhase
fi fi
if [ -z "$dontUseSetuptoolsShellHook" ] && [ -z "$shellHook" ]; then if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "$shellHook" ]; then
echo "Using setuptoolsShellHook" echo "Using setuptoolsShellHook"
shellHook=setuptoolsShellHook shellHook=setuptoolsShellHook
fi fi

View File

@ -12,7 +12,7 @@ setuptoolsCheckPhase() {
echo "Finished executing setuptoolsCheckPhase" echo "Finished executing setuptoolsCheckPhase"
} }
if [ -z "$dontUseSetuptoolsCheck" ] && [ -z "$installCheckPhase" ]; then if [ -z "${dontUseSetuptoolsCheck-}" ] && [ -z "$installCheckPhase" ]; then
echo "Using setuptoolsCheckPhase" echo "Using setuptoolsCheckPhase"
preDistPhases+=" setuptoolsCheckPhase" preDistPhases+=" setuptoolsCheckPhase"
fi fi

View File

@ -12,7 +12,7 @@ wheelUnpackPhase(){
echo "Finished executing wheelUnpackPhase" echo "Finished executing wheelUnpackPhase"
} }
if [ -z "$dontUseWheelUnpack" ] && [ -z "$unpackPhase" ]; then if [ -z "${dontUseWheelUnpack-}" ] && [ -z "$unpackPhase" ]; then
echo "Using wheelUnpackPhase" echo "Using wheelUnpackPhase"
unpackPhase=wheelUnpackPhase unpackPhase=wheelUnpackPhase
fi fi

View File

@ -31,6 +31,6 @@ qmakeConfigurePhase() {
runHook postConfigure runHook postConfigure
} }
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then if [ -z "${dontUseQmakeConfigure-}" -a -z "$configurePhase" ]; then
configurePhase=qmakeConfigurePhase configurePhase=qmakeConfigurePhase
fi fi

View File

@ -64,10 +64,10 @@ qtOwnPathsHook() {
preFixupPhases+=" qtOwnPathsHook" preFixupPhases+=" qtOwnPathsHook"
# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set. # Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set.
wrapQtAppsHook() { wrapQtAppsHook() {
# skip this hook when requested # skip this hook when requested
[ -z "$dontWrapQtApps" ] || return 0 [ -z "${dontWrapQtApps-}" ] || return 0
# guard against running multiple times (e.g. due to propagation) # guard against running multiple times (e.g. due to propagation)
[ -z "$wrapQtAppsHookHasRun" ] || return 0 [ -z "$wrapQtAppsHookHasRun" ] || return 0

View File

@ -363,7 +363,7 @@ let
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
if [ "$dontNpmInstall" != "1" ] if [ "''${dontNpmInstall-}" != "1" ]
then then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used. # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json rm -f npm-shrinkwrap.json

View File

@ -43,8 +43,8 @@ buildPythonPackage rec {
''; '';
preConfigure = '' preConfigure = ''
[ -z "$dontPlacateNuget" ] && placate-nuget.sh [ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
[ -z "$dontPlacatePaket" ] && placate-paket.sh [ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
''; '';
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -99,7 +99,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
runHook preUnpack runHook preUnpack
if [[ -f $src && $src == *.gem ]]; then 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, # 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. # so we'll just use a glob to find it and move it over.
gempkg="$src" gempkg="$src"

View File

@ -64,7 +64,7 @@ index 00000000..3ea84e2d
+header() { echo "$1"; } +header() { echo "$1"; }
+stopNest() { true; } +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() { +patchShebangs() {
+ local dir="$1" + local dir="$1"

View File

@ -179,7 +179,7 @@ let
'' else "") + (if isModular then '' '' else "") + (if isModular then ''
mkdir -p $dev mkdir -p $dev
cp vmlinux $dev/ cp vmlinux $dev/
if [ -z "$dontStrip" ]; then if [ -z "''${dontStrip-}" ]; then
installFlagsArray+=("INSTALL_MOD_STRIP=1") installFlagsArray+=("INSTALL_MOD_STRIP=1")
fi fi
make modules_install $makeFlags "''${makeFlagsArray[@]}" \ make modules_install $makeFlags "''${makeFlagsArray[@]}" \

View File

@ -1,7 +1,7 @@
fixupOutputHooks+=(_cygwinFixAutoImageBase) fixupOutputHooks+=(_cygwinFixAutoImageBase)
_cygwinFixAutoImageBase() { _cygwinFixAutoImageBase() {
if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then
return return
fi fi
find "$prefix" -name "*.dll" -type f | while read DLL; do find "$prefix" -name "*.dll" -type f | while read DLL; do

View File

@ -1,7 +1,7 @@
fixupOutputHooks+=(_cygwinFixAutoImageBase) fixupOutputHooks+=(_cygwinFixAutoImageBase)
_cygwinFixAutoImageBase() { _cygwinFixAutoImageBase() {
if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then
return return
fi fi
find "$prefix" -name "*.dll" -type f | while read DLL; do find "$prefix" -name "*.dll" -type f | while read DLL; do