about summary refs log tree commit diff
path: root/pkgs/build-support/php/hooks
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-10-17 21:19:55 +0200
committerGitHub <noreply@github.com>2023-10-17 21:19:55 +0200
commit614182f9e0aab2c639574b2c4c2ce69817206153 (patch)
tree9a8b782115c3ce026f98ea99a6939b406d9974d4 /pkgs/build-support/php/hooks
parent92a73e8b60783977c3cc04425af830ddef080351 (diff)
parent839498d572a194efc02e811142024e10f598d33e (diff)
Merge pull request #261582 from NixOS/php/build-support/fix-diff-and-env-vars
php/build-support: fix `diff` command and env. variables
Diffstat (limited to 'pkgs/build-support/php/hooks')
-rw-r--r--pkgs/build-support/php/hooks/composer-install-hook.sh6
-rw-r--r--pkgs/build-support/php/hooks/composer-repository-hook.sh1
-rw-r--r--pkgs/build-support/php/hooks/default.nix3
3 files changed, 3 insertions, 7 deletions
diff --git a/pkgs/build-support/php/hooks/composer-install-hook.sh b/pkgs/build-support/php/hooks/composer-install-hook.sh
index 49ff0449719a4..ab7756aef4f12 100644
--- a/pkgs/build-support/php/hooks/composer-install-hook.sh
+++ b/pkgs/build-support/php/hooks/composer-install-hook.sh
@@ -49,7 +49,7 @@ composerInstallConfigureHook() {
     fi
 
     echo "Validating consistency between composer.lock and ${composerRepository}/composer.lock"
-    if [[! @diff@ composer.lock "${composerRepository}/composer.lock"]]; then
+    if ! @cmp@ -s "composer.lock" "${composerRepository}/composer.lock"; then
         echo
         echo "ERROR: vendorHash is out of date"
         echo
@@ -88,7 +88,6 @@ composerInstallBuildHook() {
 
     # Since the composer.json file has been modified in the previous step, the
     # composer.lock file needs to be updated.
-    COMPOSER_DISABLE_NETWORK=1 \
     COMPOSER_ROOT_VERSION="${version}" \
     composer \
       --lock \
@@ -118,10 +117,7 @@ composerInstallInstallHook() {
     # the autoloader.
     # The COMPOSER_ROOT_VERSION environment variable is needed only for
     # vimeo/psalm.
-    COMPOSER_CACHE_DIR=/dev/null \
-    COMPOSER_DISABLE_NETWORK=1 \
     COMPOSER_ROOT_VERSION="${version}" \
-    COMPOSER_MIRROR_PATH_REPOS="1" \
     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 3aae1f9fa85d8..2c35b11b73b4f 100644
--- a/pkgs/build-support/php/hooks/composer-repository-hook.sh
+++ b/pkgs/build-support/php/hooks/composer-repository-hook.sh
@@ -55,7 +55,6 @@ composerRepositoryBuildHook() {
     # Build the local composer repository
     # The command 'build-local-repo' is provided by the Composer plugin
     # nix-community/composer-local-repo-plugin.
-    COMPOSER_CACHE_DIR=/dev/null \
     composer-local-repo-plugin --no-ansi build-local-repo ${composerNoDev:+--no-dev} -r repository
 
     echo "Finished composerRepositoryBuildHook"
diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix
index 7b56cd6d8b80c..240ec640723ad 100644
--- a/pkgs/build-support/php/hooks/default.nix
+++ b/pkgs/build-support/php/hooks/default.nix
@@ -1,5 +1,6 @@
 { lib
 , makeSetupHook
+, diffutils
 , jq
 , moreutils
 , makeBinaryWrapper
@@ -22,7 +23,7 @@
       substitutions = {
         # Specify the stdenv's `diff` by abspath to ensure that the user's build
         # inputs do not cause us to find the wrong `diff`.
-        diff = "${lib.getBin buildPackages.diffutils}/bin/diff";
+        cmp = "${lib.getBin buildPackages.diffutils}/bin/cmp";
       };
     } ./composer-install-hook.sh;
 }