From 0432bbbc3be0499b86f055c3e437a72419e9d75f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 26 Jan 2021 17:19:34 +0100 Subject: add upstream patch for recent Symfony version switch to Symfony 3 (EL-7) or Symfony 4 switch to phpunit9 --- composer-sym4.patch | 41 +++++++++++++++++++++++++++++++++++++++++ composer.spec | 51 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 composer-sym4.patch diff --git a/composer-sym4.patch b/composer-sym4.patch new file mode 100644 index 0000000..f91ed86 --- /dev/null +++ b/composer-sym4.patch @@ -0,0 +1,41 @@ +Adapted for v2.0.8 from + +From 2cb9630320370109a733b214049b6c2028712307 Mon Sep 17 00:00:00 2001 +From: Jordi Boggiano +Date: Tue, 26 Jan 2021 15:54:21 +0100 +Subject: [PATCH] Fix $_SERVER var not being updated when using putenv, refs + b80038804ff791a9d4608d737ad937b6033b0bae and fixes #9372 + + +diff -up ./src/Composer/EventDispatcher/EventDispatcher.php.old ./src/Composer/EventDispatcher/EventDispatcher.php +--- ./src/Composer/EventDispatcher/EventDispatcher.php.old 2021-01-26 16:53:39.118387399 +0100 ++++ ./src/Composer/EventDispatcher/EventDispatcher.php 2021-01-26 16:54:45.679025338 +0100 +@@ -243,6 +243,8 @@ class EventDispatcher + + if (strpos($exec, '@putenv ') === 0) { + putenv(substr($exec, 8)); ++ list($var, $value) = explode('=', substr($exec, 8), 2); ++ $_SERVER[$var] = $value; + + continue; + } +diff -up ./src/Composer/Util/Git.php.old ./src/Composer/Util/Git.php +--- ./src/Composer/Util/Git.php.old 2021-01-26 16:53:11.000000000 +0100 ++++ ./src/Composer/Util/Git.php 2021-01-26 16:53:39.118387399 +0100 +@@ -354,7 +354,7 @@ class Git + // added in git 1.7.1, prevents prompting the user for username/password + if (getenv('GIT_ASKPASS') !== 'echo') { + putenv('GIT_ASKPASS=echo'); +- unset($_SERVER['GIT_ASKPASS']); ++ $_SERVER['GIT_ASKPASS'] = 'echo'; + } + + // clean up rogue git env vars in case this is running in a git hook +@@ -370,6 +370,7 @@ class Git + // Run processes with predictable LANGUAGE + if (getenv('LANGUAGE') !== 'C') { + putenv('LANGUAGE=C'); ++ $_SERVER['LANGUAGE'] = 'C'; + } + + // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940 diff --git a/composer.spec b/composer.spec index 21ad68d..035db42 100644 --- a/composer.spec +++ b/composer.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for composer # -# Copyright (c) 2015-2020 Remi Collet +# Copyright (c) 2015-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -23,21 +23,23 @@ #global upstream_prever RC2 #global upstream_lower rc2 -%global symfony_prefix php-symfony -%global symfony_path %{_datadir}/php/Symfony -%global symfony_min 2.8 - # remirepo:1 -%if 0 -%global _phpunit %{_bindir}/phpunit -# remirepo:3 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 +%global symfony_prefix php-symfony4 +%global symfony_path %{_datadir}/php/Symfony4 +%global symfony_min 4.4 +# remirepo:5 %else -%global _phpunit %{_bindir}/phpunit7 +%global symfony_prefix php-symfony3 +%global symfony_path %{_datadir}/php/Symfony3 +%global symfony_min 3.4.35 %endif +%global _phpunit %{_bindir}/phpunit9 + Name: composer Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Dependency Manager for PHP License: MIT @@ -51,6 +53,8 @@ Source5: makesrc.sh # Use our autoloader, resources path, fix for tests Patch0: %{name}-rpm.patch +# Upstream for Symfony4 +Patch1: %{name}-sym4.patch BuildArch: noarch BuildRequires: php-cli @@ -183,7 +187,8 @@ Documentation: https://getcomposer.org/doc/ %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 -b .rpm -find . -name \*.rpm -exec rm {} \; -print +find . -name \*.rpm -delete -print +%patch1 -p1 if grep -r '\.\./res'; then : Patch need to fixed @@ -254,10 +259,6 @@ if (version_compare(Composer::RUNTIME_API_VERSION, "%{run_version}")) { : Profile scripts mkdir -p %{buildroot}%{_sysconfdir}/profile.d install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d/ -# remirepo:3 -%if 0%{?rhel} == 6 -sed -e 's/euid/uid/' -i %{buildroot}%{_sysconfdir}/profile.d/composer.csh -%endif : Library mkdir -p %{buildroot}%{_datadir}/php @@ -285,15 +286,20 @@ rm -rf res : Run test suite export BUILDROOT=%{buildroot} -%if 0%{?rhel} == 6 -FILTER="--filter '^((?!(testIntegration|testArchiveCustomFileName|testArchiveTar)).)*$'" -%else FILTER="--filter '^((?!(testIntegration)).)*$'" -%endif + +# Adapt for phunit9 +find tests \ + -name \*.php \ + -exec sed -e '/function setUpBeforeClass(/s/$/:void/' \ + -e '/function tearDownAfterClass(/s/$/:void/' \ + -e '/function setUp(/s/$/:void/' \ + -e '/function tearDown(/s/$/:void/' \ + -i {} \; # testIntegration may hang on local build ret=0 -for cmd in php php72 php73 php74; do +for cmd in php php73 php74 php80; do if which $cmd; then $cmd -d memory_limit=1G %{_phpunit} \ $FILTER \ @@ -318,6 +324,11 @@ exit $ret %changelog +* Tue Jan 26 2021 Remi Collet - 2.0.8-2 +- add upstream patch for recent Symfony version +- switch to Symfony 3 (EL-7) or Symfony 4 +- switch to phpunit9 + * Fri Dec 4 2020 Remi Collet - 2.0.8-1 - update to 2.0.8 -- cgit