From 21c0129841005c2887037d3e2468944cd92b977e Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Tue, 3 Sep 2024 04:14:28 +0800 Subject: [PATCH] treewide: handle prePhases __structuredAttrs-agnostically Always specify the prePhases attribute as a list instead of a string. Append elements to the prePhases Bash variable using appendToVar instead of string or Bash array concatenation. --- pkgs/applications/graphics/gimp/plugins/default.nix | 4 ++-- pkgs/build-support/release/debian-build.nix | 2 +- pkgs/build-support/setup-hooks/keep-build-tree.sh | 2 +- pkgs/build-support/setup-hooks/move-build-tree.sh | 2 +- pkgs/by-name/ha/hare/setup-hook.sh | 2 +- pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh | 2 +- pkgs/development/libraries/qt-5/hooks/qmake-hook.sh | 2 +- pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh | 2 +- pkgs/development/libraries/qt-6/hooks/qmake-hook.sh | 2 +- pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index 667a1d505751..5280a1ae719e 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -17,7 +17,7 @@ let pluginDerivation = attrs: let name = attrs.name or "${attrs.pname}-${attrs.version}"; in stdenv.mkDerivation ({ - prePhases = "extraLib"; + prePhases = [ "extraLib" ]; extraLib = '' installScripts(){ mkdir -p $out/${gimp.targetScriptDir}/${name}; @@ -54,7 +54,7 @@ let }); scriptDerivation = {src, ...}@attrs : pluginDerivation ({ - prePhases = "extraLib"; + prePhases = [ "extraLib" ]; dontUnpack = true; installPhase = '' runHook preInstall diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix index ab84a504b54c..e73b39c4e6b6 100644 --- a/pkgs/build-support/release/debian-build.nix +++ b/pkgs/build-support/release/debian-build.nix @@ -18,7 +18,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation ( prefix = "/usr"; - prePhases = "installExtraDebsPhase sysInfoPhase"; + prePhases = [ "installExtraDebsPhase" "sysInfoPhase" ]; } // removeAttrs args ["vmTools" "lib"] // diff --git a/pkgs/build-support/setup-hooks/keep-build-tree.sh b/pkgs/build-support/setup-hooks/keep-build-tree.sh index 754900bfc337..653149bdf26f 100644 --- a/pkgs/build-support/setup-hooks/keep-build-tree.sh +++ b/pkgs/build-support/setup-hooks/keep-build-tree.sh @@ -1,4 +1,4 @@ -prePhases+=" moveBuildDir" +appendToVar prePhases moveBuildDir moveBuildDir() { mkdir -p $out/.build diff --git a/pkgs/build-support/setup-hooks/move-build-tree.sh b/pkgs/build-support/setup-hooks/move-build-tree.sh index 2718070f3933..625f87965f39 100644 --- a/pkgs/build-support/setup-hooks/move-build-tree.sh +++ b/pkgs/build-support/setup-hooks/move-build-tree.sh @@ -1,4 +1,4 @@ -prePhases+=" moveBuildDir" +appendToVar prePhases moveBuildDir moveBuildDir() { mkdir -p $out/.build diff --git a/pkgs/by-name/ha/hare/setup-hook.sh b/pkgs/by-name/ha/hare/setup-hook.sh index 3a427fd70328..388ed9bcf25f 100644 --- a/pkgs/by-name/ha/hare/setup-hook.sh +++ b/pkgs/by-name/ha/hare/setup-hook.sh @@ -18,7 +18,7 @@ echoCmd "HAREPATH" "$HAREPATH" echoCmd "hare" "$(command -v hare)" echoCmd "hare-native" "$(command -v hare-native)" ' -prePhases+=("hareSetStdlibPhase" "hareInfoPhase") +appendToVar prePhases hareSetStdlibPhase hareInfoPhase readonly hare_unconditional_flags="@hare_unconditional_flags@" case "${hareBuildType:-"release"}" in diff --git a/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh b/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh index cac55cb56017..512070df83fa 100644 --- a/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh +++ b/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh @@ -73,6 +73,6 @@ configureNuget() { } if [[ -z ${dontConfigureNuget-} ]]; then - prePhases+=(createNugetDirs) + appendToVar prePhases createNugetDirs preConfigurePhases+=(configureNuget) fi diff --git a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh index f52de4e51df2..855efb5e6c0f 100644 --- a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh @@ -20,7 +20,7 @@ qmakePrePhase() { # do the stripping ourselves (needed for separateDebugInfo) prependToVar qmakeFlags "CONFIG+=nostrip" } -prePhases+=" qmakePrePhase" +appendToVar prePhases qmakePrePhase qmakeConfigurePhase() { runHook preConfigure diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh index 1b57d676e1fc..8f1fe0e6c6ff 100644 --- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh @@ -107,6 +107,6 @@ qtPreHook() { exit 1 fi } -prePhases+=" qtPreHook" +appendToVar prePhases qtPreHook fi diff --git a/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh index 84b2fb153d9f..1f696be3e738 100644 --- a/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh +++ b/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh @@ -13,7 +13,7 @@ qmakePrePhase() { "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \ "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" } -prePhases+=" qmakePrePhase" +appendToVar prePhases qmakePrePhase qmakeConfigurePhase() { runHook preConfigure diff --git a/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh index 5006d6b65530..15a824f1cb45 100644 --- a/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh @@ -81,7 +81,7 @@ else # Only set up Qt once. exit 1 fi } - prePhases+=" qtPreHook" + appendToVar prePhases qtPreHook addQtModulePrefix() { addToSearchPath QT_ADDITIONAL_PACKAGES_PREFIX_PATH $1