From 7f75d072064a939099c6576e259afba1e343c951 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 2 May 2024 22:05:19 +0200 Subject: [PATCH 1/4] php.packages.psysh: 0.11.21 -> 0.12.3 --- pkgs/development/php-packages/psysh/default.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/development/php-packages/psysh/default.nix b/pkgs/development/php-packages/psysh/default.nix index 1f443f136578d..63618d5c25742 100644 --- a/pkgs/development/php-packages/psysh/default.nix +++ b/pkgs/development/php-packages/psysh/default.nix @@ -1,18 +1,22 @@ -{ fetchFromGitHub, lib, php }: +{ fetchFromGitHub, fetchurl, lib, php }: php.buildComposerProject (finalAttrs: { pname = "psysh"; - version = "0.11.21"; + version = "0.12.3"; src = fetchFromGitHub { owner = "bobthecow"; repo = "psysh"; rev = "v${finalAttrs.version}"; - hash = "sha256-YuBn4mrgOzGeMGfGcyZySAISmQdv3WRGn91PRozyxdI="; + hash = "sha256-v2UAhxnfnVwA05sxcqMU5vmQcwlBcc901PYJqYf+pCw="; }; - composerLock = ./composer.lock; - vendorHash = "sha256-FZFeO7UiVssxTf0JX6wdjrAE+jucYnfQJA1eOng39lQ="; + composerLock = fetchurl { + name = "composer.lock"; + url = "https://github.com/bobthecow/psysh/releases/download/v${finalAttrs.version}/composer-v${finalAttrs.version}.lock"; + hash = "sha256-ur6mzla3uXeFL6aEHAPdpxGdvcgzOgTLW/CKPbNqeCg="; + }; + vendorHash = ""; meta = { changelog = "https://github.com/bobthecow/psysh/releases/tag/v${finalAttrs.version}"; From 880bbde3078513674f5635139f34b779b9d711a3 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 2 May 2024 22:14:33 +0200 Subject: [PATCH 2/4] build-support/php: let the `mkComposerRepository` be overridable TODO: Is it the best way to do that? --- pkgs/build-support/php/build-composer-project.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/php/build-composer-project.nix b/pkgs/build-support/php/build-composer-project.nix index 80c63bcde71b9..671c059dcf398 100644 --- a/pkgs/build-support/php/build-composer-project.nix +++ b/pkgs/build-support/php/build-composer-project.nix @@ -62,7 +62,7 @@ let runHook postInstallCheck ''; - composerRepository = phpDrv.mkComposerRepository { + composerRepository = phpDrv.mkComposerRepository ({ inherit composer composer-local-repo-plugin; inherit (finalAttrs) patches pname src vendorHash version; @@ -71,7 +71,7 @@ let composerNoPlugins = previousAttrs.composerNoPlugins or true; composerNoScripts = previousAttrs.composerNoScripts or true; composerStrictValidation = previousAttrs.composerStrictValidation or true; - }; + } // (previousAttrs.composerRepository or {})); COMPOSER_CACHE_DIR="/dev/null"; COMPOSER_DISABLE_NETWORK="1"; From 7a3eb2e56f659def2d5695c742808dd9b2a65934 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 2 May 2024 22:16:18 +0200 Subject: [PATCH 3/4] build-support/php: ship `composer.json` in composer repository Also update the `composer` derivation --- pkgs/build-support/php/hooks/composer-install-hook.sh | 6 ++++-- pkgs/build-support/php/hooks/composer-repository-hook.sh | 4 +++- pkgs/development/php-packages/composer/default.nix | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/php/hooks/composer-install-hook.sh b/pkgs/build-support/php/hooks/composer-install-hook.sh index a91263422bc84..d66f8f433e18e 100644 --- a/pkgs/build-support/php/hooks/composer-install-hook.sh +++ b/pkgs/build-support/php/hooks/composer-install-hook.sh @@ -23,6 +23,10 @@ composerInstallConfigureHook() { cp "$composerLock" composer.lock fi + chmod +w composer.{json,lock} + cp ${composerRepository}/composer.{json,lock} . + chmod +w composer.{json,lock} + if [[ ! -f "composer.lock" ]]; then setComposeRootVersion @@ -71,8 +75,6 @@ composerInstallConfigureHook() { exit 1 fi - chmod +w composer.json composer.lock - echo "Finished composerInstallConfigureHook" } diff --git a/pkgs/build-support/php/hooks/composer-repository-hook.sh b/pkgs/build-support/php/hooks/composer-repository-hook.sh index c4fa0d52126c1..4ac4ef2d27a96 100644 --- a/pkgs/build-support/php/hooks/composer-repository-hook.sh +++ b/pkgs/build-support/php/hooks/composer-repository-hook.sh @@ -19,6 +19,8 @@ composerRepositoryConfigureHook() { cp $composerLock composer.lock fi + chmod +w composer.{json,lock} + if [[ ! -f "composer.lock" ]]; then setComposeRootVersion @@ -85,7 +87,7 @@ composerRepositoryInstallHook() { # Copy the composer.lock files to the output directory, to be able to validate consistency with # the src composer.lock file where this fixed-output derivation is used - cp composer.lock $out/ + cp composer.{json,lock} $out/ echo "Finished composerRepositoryInstallHook" } diff --git a/pkgs/development/php-packages/composer/default.nix b/pkgs/development/php-packages/composer/default.nix index 28606fdfa2e27..655a91ec2c85e 100644 --- a/pkgs/development/php-packages/composer/default.nix +++ b/pkgs/development/php-packages/composer/default.nix @@ -40,7 +40,7 @@ php.buildComposerProject (finalAttrs: { --prefix PATH : ${lib.makeBinPath [ _7zz cacert curl git unzip xz ]} ''; - vendorHash = "sha256-dNNV9fTyGyRoGeDV/vBjn0aMgkaUMsrKQv5AOoiYokQ="; + vendorHash = "sha256-4s912b04PTPbK9+suni9uJ2Cx4qDb8CkMLy6y25a1eQ="; meta = { changelog = "https://github.com/composer/composer/releases/tag/${finalAttrs.version}"; From 47bfa0e5ece304bef0c9f8fc6e6eefde2e726ca3 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 2 May 2024 22:17:24 +0200 Subject: [PATCH 4/4] psysh: fix 0.12.3 using a `preBuild` hook This is based on https://github.com/bobthecow/psysh/blob/052322d0480fd975335ac08f6bd8bf7eb0500940/Makefile#L80 --- pkgs/development/php-packages/psysh/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/php-packages/psysh/default.nix b/pkgs/development/php-packages/psysh/default.nix index 63618d5c25742..b3fc7c209b87f 100644 --- a/pkgs/development/php-packages/psysh/default.nix +++ b/pkgs/development/php-packages/psysh/default.nix @@ -16,7 +16,18 @@ php.buildComposerProject (finalAttrs: { url = "https://github.com/bobthecow/psysh/releases/download/v${finalAttrs.version}/composer-v${finalAttrs.version}.lock"; hash = "sha256-ur6mzla3uXeFL6aEHAPdpxGdvcgzOgTLW/CKPbNqeCg="; }; - vendorHash = ""; + + composerRepository = { + preBuild = '' + setComposeRootVersion + composer config platform.php 7.4 + composer require --no-update symfony/polyfill-iconv symfony/polyfill-mbstring + composer require --no-update --dev roave/security-advisories:dev-latest + composer update --no-interaction --no-progress --prefer-stable --no-dev --classmap-authoritative --prefer-dist --lock + ''; + }; + + vendorHash = "sha256-vlEbehxy6xi2qLKG32fV0OJVSphWjqKUVHbWOhoWjoI="; meta = { changelog = "https://github.com/bobthecow/psysh/releases/tag/v${finalAttrs.version}";