diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-02-27 00:02:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-27 00:02:36 +0000 |
commit | ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4 (patch) | |
tree | 244e0ea5b4243b8fc947773bd72a4d3225fa73b9 /pkgs/build-support | |
parent | d6b3e91345f5bf8c9371e1e8967a40764d252117 (diff) | |
parent | 6daf4de0662e1d895d220a4a4ddb356eb000abe9 (diff) | |
download | nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar.gz nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar.bz2 nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar.lz nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar.xz nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.tar.zst nixlib-ac95e31c0ca6fe6115ed63effd46d6a1a9beb5b4.zip |
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/php/hooks/composer-install-hook.sh | 12 | ||||
-rw-r--r-- | pkgs/build-support/php/hooks/composer-repository-hook.sh | 7 | ||||
-rw-r--r-- | pkgs/build-support/php/hooks/default.nix | 13 | ||||
-rw-r--r-- | pkgs/build-support/php/hooks/php-script-utils.bash | 12 |
4 files changed, 38 insertions, 6 deletions
diff --git a/pkgs/build-support/php/hooks/composer-install-hook.sh b/pkgs/build-support/php/hooks/composer-install-hook.sh index 6e7fb5d7503b..a84a9e3aa862 100644 --- a/pkgs/build-support/php/hooks/composer-install-hook.sh +++ b/pkgs/build-support/php/hooks/composer-install-hook.sh @@ -9,6 +9,8 @@ preBuildHooks+=(composerInstallBuildHook) preCheckHooks+=(composerInstallCheckHook) preInstallHooks+=(composerInstallInstallHook) +source @phpScriptUtils@ + composerInstallConfigureHook() { echo "Executing composerInstallConfigureHook" @@ -22,6 +24,8 @@ composerInstallConfigureHook() { fi if [[ ! -f "composer.lock" ]]; then + setComposeRootVersion + composer \ --no-ansi \ --no-install \ @@ -75,6 +79,8 @@ composerInstallConfigureHook() { composerInstallBuildHook() { echo "Executing composerInstallBuildHook" + setComposeRootVersion + # Since this file cannot be generated in the composer-repository-hook.sh # because the file contains hardcoded nix store paths, we generate it here. composer-local-repo-plugin --no-ansi build-local-repo -m "${composerRepository}" . @@ -90,7 +96,6 @@ composerInstallBuildHook() { # Since the composer.json file has been modified in the previous step, the # composer.lock file needs to be updated. - COMPOSER_ROOT_VERSION="${version}" \ composer \ --lock \ --no-ansi \ @@ -134,11 +139,10 @@ composerInstallCheckHook() { composerInstallInstallHook() { echo "Executing composerInstallInstallHook" + setComposeRootVersion + # Finally, run `composer install` to install the dependencies and generate # the autoloader. - # The COMPOSER_ROOT_VERSION environment variable is needed only for - # vimeo/psalm. - COMPOSER_ROOT_VERSION="${version}" \ composer \ --no-ansi \ --no-interaction \ diff --git a/pkgs/build-support/php/hooks/composer-repository-hook.sh b/pkgs/build-support/php/hooks/composer-repository-hook.sh index 03783d9d639c..bb3017bd98c9 100644 --- a/pkgs/build-support/php/hooks/composer-repository-hook.sh +++ b/pkgs/build-support/php/hooks/composer-repository-hook.sh @@ -10,6 +10,8 @@ preBuildHooks+=(composerRepositoryBuildHook) preCheckHooks+=(composerRepositoryCheckHook) preInstallHooks+=(composerRepositoryInstallHook) +source @phpScriptUtils@ + composerRepositoryConfigureHook() { echo "Executing composerRepositoryConfigureHook" @@ -18,7 +20,8 @@ composerRepositoryConfigureHook() { fi if [[ ! -f "composer.lock" ]]; then - COMPOSER_ROOT_VERSION="${version}" \ + setComposeRootVersion + composer \ --no-ansi \ --no-install \ @@ -55,6 +58,8 @@ composerRepositoryBuildHook() { mkdir -p repository + setComposeRootVersion + # Build the local composer repository # The command 'build-local-repo' is provided by the Composer plugin # nix-community/composer-local-repo-plugin. diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix index 240ec640723a..98e81c88f9e9 100644 --- a/pkgs/build-support/php/hooks/default.nix +++ b/pkgs/build-support/php/hooks/default.nix @@ -2,18 +2,28 @@ , makeSetupHook , diffutils , jq +, writeShellApplication , moreutils , makeBinaryWrapper , cacert , buildPackages }: +let + php-script-utils = writeShellApplication { + name = "php-script-utils"; + runtimeInputs = [ jq ]; + text = builtins.readFile ./php-script-utils.bash; + }; +in { composerRepositoryHook = makeSetupHook { name = "composer-repository-hook.sh"; propagatedBuildInputs = [ jq moreutils cacert ]; - substitutions = { }; + substitutions = { + phpScriptUtils = lib.getExe php-script-utils; + }; } ./composer-repository-hook.sh; composerInstallHook = makeSetupHook @@ -24,6 +34,7 @@ # Specify the stdenv's `diff` by abspath to ensure that the user's build # inputs do not cause us to find the wrong `diff`. cmp = "${lib.getBin buildPackages.diffutils}/bin/cmp"; + phpScriptUtils = lib.getExe php-script-utils; }; } ./composer-install-hook.sh; } diff --git a/pkgs/build-support/php/hooks/php-script-utils.bash b/pkgs/build-support/php/hooks/php-script-utils.bash new file mode 100644 index 000000000000..163d9306f5f4 --- /dev/null +++ b/pkgs/build-support/php/hooks/php-script-utils.bash @@ -0,0 +1,12 @@ +declare version + +setComposeRootVersion() { + set +e # Disable exit on error + + if [[ -v version ]]; then + echo -e "\e[32mSetting COMPOSER_ROOT_VERSION to $version\e[0m" + export COMPOSER_ROOT_VERSION=$version + fi + + set -e +} |