From 758056dac763e5368470673ae63c6fa637ba93d1 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Tue, 3 Sep 2024 04:14:28 +0800 Subject: [PATCH] treewide: handle postPhases __structuredAttrs-agnostically Always specify the postPhases attribute as a list instead of a string. Append elements to the postPhases Bash variable using appendToVar instead of string or Bash array concatenation. --- pkgs/build-support/release/binary-tarball.nix | 2 +- pkgs/build-support/release/source-tarball.nix | 2 +- .../setup-hooks/enable-coverage-instrumentation.sh | 2 +- pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh | 2 +- pkgs/build-support/setup-hooks/move-build-tree.sh | 2 +- .../interpreters/python/hooks/python-recompile-bytecode-hook.sh | 2 +- pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh | 2 +- pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/release/binary-tarball.nix b/pkgs/build-support/release/binary-tarball.nix index 37c5f8c7ee86..aeaa8edb52be 100644 --- a/pkgs/build-support/release/binary-tarball.nix +++ b/pkgs/build-support/release/binary-tarball.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation ( prefix = "/usr/local"; - postPhases = "finalPhase"; + postPhases = [ "finalPhase" ]; } // args // diff --git a/pkgs/build-support/release/source-tarball.nix b/pkgs/build-support/release/source-tarball.nix index 3c88ca980ba0..4effd63f740b 100644 --- a/pkgs/build-support/release/source-tarball.nix +++ b/pkgs/build-support/release/source-tarball.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation ( showBuildStats = true; preConfigurePhases = [ "autoconfPhase" ]; - postPhases = "finalPhase"; + postPhases = [ "finalPhase" ]; # Autoconfiscate the sources. autoconfPhase = '' diff --git a/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh b/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh index 2b48fea4ff0b..61e9ed5705f4 100644 --- a/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh +++ b/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh @@ -1,4 +1,4 @@ -postPhases+=" cleanupBuildDir" +appendToVar postPhases cleanupBuildDir # Force GCC to build with coverage instrumentation. Also disable # optimisation, since it may confuse things. diff --git a/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh b/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh index 9108b4c50355..d6a03019dc51 100644 --- a/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh +++ b/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh @@ -1,4 +1,4 @@ -postPhases+=" coverageReportPhase" +appendToVar postPhases coverageReportPhase coverageReportPhase() { lcov --directory . --capture --output-file app.info diff --git a/pkgs/build-support/setup-hooks/move-build-tree.sh b/pkgs/build-support/setup-hooks/move-build-tree.sh index 625f87965f39..29495e1d9f29 100644 --- a/pkgs/build-support/setup-hooks/move-build-tree.sh +++ b/pkgs/build-support/setup-hooks/move-build-tree.sh @@ -5,7 +5,7 @@ moveBuildDir() { cd $out/.build } -postPhases+=" removeBuildDir" +appendToVar postPhases removeBuildDir removeBuildDir() { rm -rf $out/.build diff --git a/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh b/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh index 649d0c17ea0c..7ac8c2d5cc72 100644 --- a/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh @@ -20,5 +20,5 @@ pythonRecompileBytecodePhase () { } if [ -z "${dontUsePythonRecompileBytecode-}" ]; then - postPhases+=" pythonRecompileBytecodePhase" + appendToVar postPhases pythonRecompileBytecodePhase fi 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 8f1fe0e6c6ff..1b189d24d9ee 100644 --- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh @@ -97,7 +97,7 @@ postPatchMkspecs() { fi } if [ -z "${dontPatchMkspecs-}" ]; then - postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs" + appendToVar postPhases postPatchMkspecs fi qtPreHook() { 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 15a824f1cb45..1ccfbd0cba38 100644 --- a/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh @@ -71,7 +71,7 @@ else # Only set up Qt once. fi } if [ -z "${dontPatchMkspecs-}" ]; then - postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs" + appendToVar postPhases postPatchMkspecs fi qtPreHook() {