mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
build-support/php: add composerStrictValidation
attribute
Set to `true` by default
This commit is contained in:
parent
921e3c16cc
commit
46a7c4cade
@ -13,6 +13,7 @@ let
|
||||
composerNoDev = previousAttrs.composerNoDev or true;
|
||||
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||
composerStrictValidation = previousAttrs.composerStrictValidation or true;
|
||||
|
||||
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
|
||||
composer
|
||||
@ -69,6 +70,7 @@ let
|
||||
composerNoDev = previousAttrs.composerNoDev or true;
|
||||
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||
composerStrictValidation = previousAttrs.composerStrictValidation or true;
|
||||
};
|
||||
|
||||
COMPOSER_CACHE_DIR="/dev/null";
|
||||
|
@ -32,6 +32,7 @@ let
|
||||
composerNoDev = previousAttrs.composerNoDev or true;
|
||||
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||
composerStrictValidation = previousAttrs.composerStrictValidation or true;
|
||||
|
||||
name = "${previousAttrs.pname}-${previousAttrs.version}-composer-repository";
|
||||
|
||||
|
@ -107,7 +107,26 @@ composerInstallBuildHook() {
|
||||
composerInstallCheckHook() {
|
||||
echo "Executing composerInstallCheckHook"
|
||||
|
||||
composer validate --no-ansi --no-interaction
|
||||
if ! composer validate --strict --no-ansi --no-interaction --quiet; then
|
||||
if [ ! -z "${composerStrictValidation-}" ]; then
|
||||
echo
|
||||
echo -e "\e[31mERROR: composer files validation failed\e[0m"
|
||||
echo
|
||||
echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m'
|
||||
echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\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'
|
||||
echo
|
||||
echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Finished composerInstallCheckHook"
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ declare version
|
||||
declare composerNoDev
|
||||
declare composerNoPlugins
|
||||
declare composerNoScripts
|
||||
declare composerStrictValidation
|
||||
|
||||
preConfigureHooks+=(composerRepositoryConfigureHook)
|
||||
preBuildHooks+=(composerRepositoryBuildHook)
|
||||
@ -65,7 +66,26 @@ composerRepositoryBuildHook() {
|
||||
composerRepositoryCheckHook() {
|
||||
echo "Executing composerRepositoryCheckHook"
|
||||
|
||||
composer validate --no-ansi --no-interaction
|
||||
if ! composer validate --strict --no-ansi --no-interaction --quiet; then
|
||||
if [ ! -z "${composerStrictValidation-}" ]; then
|
||||
echo
|
||||
echo -e "\e[31mERROR: composer files validation failed\e[0m"
|
||||
echo
|
||||
echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m'
|
||||
echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\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'
|
||||
echo
|
||||
echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Finished composerRepositoryCheckHook"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user