build-support/php: DRY improvements

+26 -38
+26 -38
pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash
··· 18 checkComposerValidate() { 19 command="composer validate --strict --quiet --no-interaction --no-check-all --no-check-lock" 20 if ! $command; then 21 if [[ "${composerStrictValidation}" == "1" ]]; then 22 echo 23 - echo -e "\e[31mERROR: composer files validation failed\e[0m" 24 - echo 25 - echo -e '\e[31mThe validation of the composer.json failed.\e[0m' 26 - echo -e '\e[31mMake sure that the file composer.json is valid.\e[0m' 27 - echo 28 - echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m' 29 - echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution '\('with fetchpatch'\)'.\e[0m' 30 - echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 31 echo 32 exit 1 33 else 34 echo 35 - echo -e "\e[33mWARNING: composer files validation failed\e[0m" 36 - echo 37 - echo -e '\e[33mThe validation of the composer.json failed.\e[0m' 38 - echo -e '\e[33mMake sure that the file composer.json is valid.\e[0m' 39 - echo 40 - echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m' 41 - echo -e '\e[33m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m' 42 - echo -e '\e[33m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 43 - echo 44 echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m' 45 echo 46 fi ··· 48 49 command="composer validate --strict --no-ansi --no-interaction --quiet --no-check-all --check-lock" 50 if ! $command; then 51 if [[ "${composerStrictValidation}" == "1" ]]; then 52 echo 53 - echo -e "\e[31mERROR: composer files validation failed\e[0m" 54 - echo 55 - echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m' 56 - echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\e[0m' 57 - echo 58 - echo -e '\e[31mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m' 59 - echo 60 - echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m' 61 - echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m' 62 - echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 63 echo 64 exit 1 65 else 66 - echo 67 - echo -e "\e[33mWARNING: composer files validation failed\e[0m" 68 - echo 69 - echo -e '\e[33mThe validation of the composer.json and composer.lock failed.\e[0m' 70 - echo -e '\e[33mMake sure that the file composer.lock is consistent with composer.json.\e[0m' 71 - echo 72 - echo -e '\e[33mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m' 73 - echo 74 - echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m' 75 - echo -e '\e[33m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m' 76 - echo -e '\e[33m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 77 echo 78 echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m' 79 echo
··· 18 checkComposerValidate() { 19 command="composer validate --strict --quiet --no-interaction --no-check-all --no-check-lock" 20 if ! $command; then 21 + echo 22 + echo -e "\e[31mERROR: composer files validation failed\e[0m" 23 + echo 24 + echo -e '\e[31mThe validation of the composer.json failed.\e[0m' 25 + echo -e '\e[31mMake sure that the file composer.json is valid.\e[0m' 26 + echo 27 + echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m' 28 + echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution '\('with fetchpatch'\)'.\e[0m' 29 + echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 30 + echo 31 + 32 if [[ "${composerStrictValidation}" == "1" ]]; then 33 echo 34 + echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m' 35 echo 36 exit 1 37 else 38 echo 39 echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m' 40 echo 41 fi ··· 43 44 command="composer validate --strict --no-ansi --no-interaction --quiet --no-check-all --check-lock" 45 if ! $command; then 46 + echo 47 + echo -e "\e[31mERROR: composer files validation failed\e[0m" 48 + echo 49 + echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m' 50 + echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\e[0m' 51 + echo 52 + echo -e '\e[31mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m' 53 + echo 54 + echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m' 55 + echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m' 56 + echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m' 57 + echo 58 + 59 if [[ "${composerStrictValidation}" == "1" ]]; then 60 echo 61 + echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m' 62 echo 63 exit 1 64 else 65 echo 66 echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m' 67 echo