about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-10-17 08:48:12 +0200
committerPol Dellaiera <pol.dellaiera@protonmail.com>2023-10-17 08:48:12 +0200
commit207d5b4910b17b08b47a85d417bdbae00c6febf2 (patch)
tree274ab6a5e4bb0bf6a000f5a4795e80de6c66a78b
parent22e61b14022b261a83fbb7e38c4b3c6760e840af (diff)
php/build-support: fix usage of diff condition
Remove double brackets and replace `diff` with `cmp`
-rw-r--r--pkgs/build-support/php/hooks/composer-install-hook.sh2
-rw-r--r--pkgs/build-support/php/hooks/default.nix3
2 files changed, 3 insertions, 2 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..09bd19e69b27e 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
diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix
index c19bc757581f2..4bd95f856d98c 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
@@ -23,7 +24,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;
 }