diff options
author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-10-20 23:37:28 +0200 |
---|---|---|
committer | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-10-20 23:39:53 +0200 |
commit | 921e3c16cc3bf5d67dcd47a6615b322c98123f33 (patch) | |
tree | 2f3b2c53744a5b5a043196c5a6c76c940b7ccb83 | |
parent | 56720599ce446fddaa63cfd3f2ca0824646de8d2 (diff) |
build-support/php: add colors in case of errors
-rw-r--r-- | pkgs/build-support/php/hooks/composer-install-hook.sh | 30 | ||||
-rw-r--r-- | pkgs/build-support/php/hooks/composer-repository-hook.sh | 16 |
2 files changed, 25 insertions, 21 deletions
diff --git a/pkgs/build-support/php/hooks/composer-install-hook.sh b/pkgs/build-support/php/hooks/composer-install-hook.sh index ab7756aef4f12..3326f99b6dd4b 100644 --- a/pkgs/build-support/php/hooks/composer-install-hook.sh +++ b/pkgs/build-support/php/hooks/composer-install-hook.sh @@ -35,14 +35,16 @@ composerInstallConfigureHook() { cp composer.lock $out/ echo - echo 'No composer.lock file found, consider adding one to your repository to ensure reproducible builds.' - echo "In the meantime, a composer.lock file has been generated for you in $out/composer.lock" + echo -e "\e[31mERROR: No composer.lock found\e[0m" echo - echo 'To fix the issue:' - echo "1. Copy the composer.lock file from $out/composer.lock to the project's source:" - echo " cp $out/composer.lock <path>" - echo '2. Add the composerLock attribute, pointing to the copied composer.lock file:' - echo ' composerLock = ./composer.lock;' + echo -e '\e[31mNo composer.lock file found, consider adding one to your repository to ensure reproducible builds.\e[0m' + echo -e "\e[31mIn the meantime, a composer.lock file has been generated for you in $out/composer.lock\e[0m" + echo + echo -e '\e[31mTo fix the issue:\e[0m' + echo -e "\e[31m1. Copy the composer.lock file from $out/composer.lock to the project's source:\e[0m" + echo -e "\e[31m cp $out/composer.lock <path>\e[0m" + echo -e '\e[31m2. Add the composerLock attribute, pointing to the copied composer.lock file:\e[0m' + echo -e '\e[31m composerLock = ./composer.lock;\e[0m' echo exit 1 @@ -51,15 +53,15 @@ composerInstallConfigureHook() { echo "Validating consistency between composer.lock and ${composerRepository}/composer.lock" if ! @cmp@ -s "composer.lock" "${composerRepository}/composer.lock"; then echo - echo "ERROR: vendorHash is out of date" + echo -e "\e[31mERROR: vendorHash is out of date\e[0m" echo - echo "composer.lock is not the same in $composerRepository" + echo -e "\e[31mcomposer.lock is not the same in $composerRepository\e[0m" echo - echo "To fix the issue:" - echo '1. Set vendorHash to an empty string: `vendorHash = "";`' - echo '2. Build the derivation and wait for it to fail with a hash mismatch' - echo '3. Copy the "got: sha256-..." value back into the vendorHash field' - echo ' You should have: vendorHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";' + echo -e "\e[31mTo fix the issue:\e[0m" + echo -e '\e[31m1. Set vendorHash to an empty string: `vendorHash = "";`\e[0m' + echo -e '\e[31m2. Build the derivation and wait for it to fail with a hash mismatch\e[0m' + echo -e '\e[31m3. Copy the "got: sha256-..." value back into the vendorHash field\e[0m' + echo -e '\e[31m You should have: vendorHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";\e[0m' echo exit 1 diff --git a/pkgs/build-support/php/hooks/composer-repository-hook.sh b/pkgs/build-support/php/hooks/composer-repository-hook.sh index 2c35b11b73b4f..d8f204e5df2fc 100644 --- a/pkgs/build-support/php/hooks/composer-repository-hook.sh +++ b/pkgs/build-support/php/hooks/composer-repository-hook.sh @@ -31,14 +31,16 @@ composerRepositoryConfigureHook() { cp composer.lock $out/ echo - echo 'No composer.lock file found, consider adding one to your repository to ensure reproducible builds.' - echo "In the meantime, a composer.lock file has been generated for you in $out/composer.lock" + echo -e "\e[31mERROR: No composer.lock found\e[0m" echo - echo 'To fix the issue:' - echo "1. Copy the composer.lock file from $out/composer.lock to the project's source:" - echo " cp $out/composer.lock <path>" - echo '2. Add the composerLock attribute, pointing to the copied composer.lock file:' - echo ' composerLock = ./composer.lock;' + echo -e '\e[31mNo composer.lock file found, consider adding one to your repository to ensure reproducible builds.\e[0m' + echo -e "\e[31mIn the meantime, a composer.lock file has been generated for you in $out/composer.lock\e[0m" + echo + echo -e '\e[31mTo fix the issue:\e[0m' + echo -e "\e[31m1. Copy the composer.lock file from $out/composer.lock to the project's source:\e[0m" + echo -e "\e[31m cp $out/composer.lock <path>\e[0m" + echo -e '\e[31m2. Add the composerLock attribute, pointing to the copied composer.lock file:\e[0m' + echo -e '\e[31m composerLock = ./composer.lock;\e[0m' echo exit 1 |