php.buildComposerProject: don't allow use without lockfile

This commit is contained in:
Yureka 2023-10-04 13:34:43 +02:00
parent 2bef0493d1
commit 7d2c531f28
2 changed files with 4 additions and 17 deletions

View file

@ -23,12 +23,7 @@ composerInstallConfigureHook() {
if [[ ! -f "composer.lock" ]]; then if [[ ! -f "composer.lock" ]]; then
echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds." echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds."
exit 1
if [[ -f "${composerRepository}/composer.lock" ]]; then
cp ${composerRepository}/composer.lock composer.lock
fi
echo "Using an autogenerated composer.lock file."
fi fi
chmod +w composer.json composer.lock chmod +w composer.json composer.lock

View file

@ -18,15 +18,7 @@ composerRepositoryConfigureHook() {
if [[ ! -f "composer.lock" ]]; then if [[ ! -f "composer.lock" ]]; then
echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds." echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds."
composer \ exit 1
--no-ansi \
--no-install \
--no-interaction \
${composerNoDev:+--no-dev} \
${composerNoPlugins:+--no-plugins} \
${composerNoScripts:+--no-scripts} \
update
echo "Using an autogenerated composer.lock file."
fi fi
echo "Finished composerRepositoryConfigureHook" echo "Finished composerRepositoryConfigureHook"
@ -61,8 +53,8 @@ composerRepositoryInstallHook() {
cp -ar repository/. $out/ cp -ar repository/. $out/
# Copy the composer.lock files to the output directory, in case it has been # Copy the composer.lock files to the output directory, to be able to validate consistency with
# autogenerated. # the src composer.lock file where this fixed-output derivation is used
cp composer.lock $out/ cp composer.lock $out/
echo "Finished composerRepositoryInstallHook" echo "Finished composerRepositoryInstallHook"