Commit 7628af12 authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

build-support/php: DRY improvements

parent 0e6feffe
Loading
Loading
Loading
Loading
+26 −38
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ setComposerEnvVariables() {
checkComposerValidate() {
    command="composer validate --strict --quiet --no-interaction --no-check-all --no-check-lock"
    if ! $command; then
        if [[ "${composerStrictValidation}" == "1" ]]; then
        echo
        echo -e "\e[31mERROR: composer files validation failed\e[0m"
        echo
@@ -29,17 +28,13 @@ checkComposerValidate() {
        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'
        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'
        echo
            exit 1
        else
            echo
            echo -e "\e[33mWARNING: composer files validation failed\e[0m"

        if [[ "${composerStrictValidation}" == "1" ]]; then
            echo
            echo -e '\e[33mThe validation of the composer.json failed.\e[0m'
            echo -e '\e[33mMake sure that the file composer.json is valid.\e[0m'
            echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m'
            echo
            echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m'
            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'
            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'
            exit 1
        else
            echo
            echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
            echo
@@ -48,7 +43,6 @@ checkComposerValidate() {

    command="composer validate --strict --no-ansi --no-interaction --quiet --no-check-all --check-lock"
    if ! $command; then
        if [[ "${composerStrictValidation}" == "1" ]]; then
        echo
        echo -e "\e[31mERROR: composer files validation failed\e[0m"
        echo
@@ -61,19 +55,13 @@ checkComposerValidate() {
        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'
        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'
        echo
            exit 1
        else
            echo
            echo -e "\e[33mWARNING: composer files validation failed\e[0m"
            echo
            echo -e '\e[33mThe validation of the composer.json and composer.lock failed.\e[0m'
            echo -e '\e[33mMake sure that the file composer.lock is consistent with composer.json.\e[0m'

        if [[ "${composerStrictValidation}" == "1" ]]; then
            echo
            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'
            echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m'
            echo
            echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m'
            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'
            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'
            exit 1
        else
            echo
            echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
            echo