summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-01-10 15:16:53 +0100
committerRemi Collet <remi@remirepo.net>2020-01-10 15:16:53 +0100
commit4ca84fbb5e56a9063a5afcd0b4b5798fa475aaf7 (patch)
treea55f3e632f27ff5b73ae08bc31cf932927457b28
parent2f418922d4e823adbc368d7af9ec43930f82dcf6 (diff)
switch to Laminas
-rw-r--r--composer.json56
-rw-r--r--php-laminas-psr7bridge.spec144
-rw-r--r--test.patch24
3 files changed, 166 insertions, 58 deletions
diff --git a/composer.json b/composer.json
index f7ffa72..75ddb2b 100644
--- a/composer.json
+++ b/composer.json
@@ -1,42 +1,66 @@
{
- "name": "zendframework/zend-psr7bridge",
- "description": "PSR-7 <-> Zend\\Http bridge",
- "type": "library",
+ "name": "laminas/laminas-psr7bridge",
+ "description": "PSR-7 &lt;-&gt; laminas-http message conversions",
"license": "BSD-3-Clause",
"keywords": [
+ "laminas",
"http",
"psr",
"psr-7"
],
- "homepage": "https://github.com/zendframework/zend-psr7bridge",
+ "homepage": "https://laminas.dev",
"support": {
- "issues": "https://github.com/zendframework/zend-psr7bridge/issues",
- "source": "https://github.com/zendframework/zend-psr7bridge"
+ "docs": "https://docs.laminas.dev/laminas-psr7bridge/",
+ "issues": "https://github.com/laminas/laminas-psr7bridge/issues",
+ "source": "https://github.com/laminas/laminas-psr7bridge",
+ "rss": "https://github.com/laminas/laminas-psr7bridge/releases.atom",
+ "chat": "https://laminas.dev/chat",
+ "forum": "https://discourse.laminas.dev"
+ },
+ "config": {
+ "sort-packages": true
},
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev",
- "dev-develop": "1.1-dev"
+ "dev-master": "1.2.x-dev",
+ "dev-develop": "1.3.x-dev"
}
},
"require": {
- "php": ">=5.5",
- "zendframework/zend-http": "^2.5",
- "psr/http-message": "^1.0",
- "zendframework/zend-diactoros": "^1.1"
+ "php": "^5.6 || ^7.0",
+ "laminas/laminas-diactoros": "^1.7 || ^2.0",
+ "laminas/laminas-http": "^2.7",
+ "laminas/laminas-zendframework-bridge": "^1.0",
+ "psr/http-message": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.7",
- "squizlabs/php_codesniffer": "^2.3"
+ "laminas/laminas-coding-standard": "~1.0.0",
+ "phpunit/phpunit": "^5.7.15 || ^6.5.6"
+ },
+ "conflict": {
+ "laminas/laminas-stdlib": "< 3.2.1"
},
"autoload": {
"psr-4": {
- "Zend\\Psr7Bridge\\": "src/"
+ "Laminas\\Psr7Bridge\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "ZendTest\\Psr7Bridge\\": "test/"
+ "LaminasTest\\Psr7Bridge\\": "test/"
}
+ },
+ "scripts": {
+ "check": [
+ "@cs-check",
+ "@test"
+ ],
+ "cs-check": "phpcs",
+ "cs-fix": "phpcbf",
+ "test": "phpunit --colors=always",
+ "test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
+ },
+ "replace": {
+ "zendframework/zend-psr7bridge": "self.version"
}
}
diff --git a/php-laminas-psr7bridge.spec b/php-laminas-psr7bridge.spec
index 8de29c0..cc55c0b 100644
--- a/php-laminas-psr7bridge.spec
+++ b/php-laminas-psr7bridge.spec
@@ -1,17 +1,19 @@
-# remirepo/Fedora spec file for php-zendframework-zend-psr7bridge
+# remirepo/Fedora spec file for php-laminas-psr7bridge
#
-# Copyright (c) 2016-2018 Remi Collet
+# Copyright (c) 2016-2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global bootstrap 0
-%global gh_commit 86c0b53b0c6381391c4add4a93a56e51d5c74605
+%global gh_commit 61ab5a9908a968c363b9562645a8a7e7ea086c22
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
-%global gh_owner zendframework
-%global gh_project zend-psr7bridge
+%global gh_owner laminas
+%global gh_project laminas-psr7bridge
+%global zf_name zend-psr7bridge
%global php_home %{_datadir}/php
+%global namespace Laminas
%global library Psr7Bridge
%if %{bootstrap}
%global with_tests 0%{?_with_tests:1}
@@ -19,65 +21,92 @@
%global with_tests 0%{!?_without_tests:1}
%endif
-Name: php-%{gh_owner}-%{gh_project}
-Version: 0.2.2
-Release: 4%{?dist}
-Summary: Zend Framework %{library} component
+Name: php-%{gh_project}
+Version: 1.2.0
+Release: 1%{?dist}
+Summary: %{namespace} Framework %{library} component
License: BSD
-URL: https://zendframework.github.io/%{gh_project}/
+URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
+# Nedd investigation
+Patch0: test.patch
+
BuildArch: noarch
# Tests
%if %{with_tests}
-BuildRequires: php(language) >= 5.5
+BuildRequires: php(language) >= 5.6
BuildRequires: php-reflection
BuildRequires: php-intl
BuildRequires: php-pcre
BuildRequires: php-spl
-BuildRequires: php-autoloader(%{gh_owner}/zend-http) >= 2.5
-BuildRequires: php-composer(psr/http-message) >= 1.0
-BuildRequires: php-autoloader(%{gh_owner}/zend-diactoros) >= 1.1
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-autoloader(%{gh_owner}/laminas-diactoros) >= 1.7 with php-autoloader(%{gh_owner}/laminas-diactoros) < 3)
+BuildRequires: (php-autoloader(%{gh_owner}/laminas-http) >= 2.7 with php-autoloader(%{gh_owner}/laminas-http) < 3)
+BuildRequires: (php-autoloader(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-autoloader(%{gh_owner}/laminas-zendframework-bridge) < 2)
+BuildRequires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
+# remirepo:6
+%else
+BuildRequires: php-laminas-diactoros
+BuildRequires: php-laminas-http
+BuildRequires: php-laminas-zendframework-bridge
+BuildRequires: php-psr-http-message
+%endif
# From composer, "require-dev": {
-# "phpunit/phpunit": "^4.7",
-# "squizlabs/php_codesniffer": "^2.3"
-BuildRequires: php-composer(phpunit/phpunit) >= 4.7
+# "laminas/laminas-coding-standard": "~1.0.0",
+# "phpunit/phpunit": "^5.7.15 || ^6.5.6"
+BuildRequires: phpunit6 >= 6.5.6
%endif
# Autoloader
BuildRequires: php-fedora-autoloader-devel
# From composer, "require": {
-# "php": ">=5.5",
-# "zendframework/zend-http": "^2.5",
-# "psr/http-message": "^1.0",
-# "zendframework/zend-diactoros": "^1.1"
-Requires: php(language) >= 5.5
-%if ! %{bootstrap}
-Requires: php-autoloader(%{gh_owner}/zend-http) >= 2.5
-Requires: php-autoloader(%{gh_owner}/zend-http) < 3
-Requires: php-composer(psr/http-message) >= 1.0
-Requires: php-composer(psr/http-message) < 2
-Requires: php-autoloader(%{gh_owner}/zend-diactoros) >= 1.1
-Requires: php-autoloader(%{gh_owner}/zend-diactoros) < 2
+# "php": "^5.6 || ^7.0",
+# "laminas/laminas-diactoros": "^1.7 || ^2.0",
+# "laminas/laminas-http": "^2.7",
+# "laminas/laminas-zendframework-bridge": "^1.0",
+# "psr/http-message": "^1.0"
+Requires: php(language) >= 5.6
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-autoloader(%{gh_owner}/laminas-diactoros) >= 1.7 with php-autoloader(%{gh_owner}/laminas-diactoros) < 3)
+Requires: (php-autoloader(%{gh_owner}/laminas-http) >= 2.7 with php-autoloader(%{gh_owner}/laminas-http) < 3)
+Requires: (php-autoloader(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-autoloader(%{gh_owner}/laminas-zendframework-bridge) < 2)
+Requires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
+# remirepo:6
+%else
+Requires: php-laminas-diactoros
+Requires: php-laminas-http
+Requires: php-laminas-zendframework-bridge
+Requires: php-psr-http-message
%endif
# Autoloader
Requires: php-composer(fedora/autoloader)
-# From phpcompatinfo report for version 0.2.1 => Nothing
-
-Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+# From phpcompatinfo report for version 1.2.0
+Requires: php-pcre
+Requires: php-spl
+
+# Compatibily ensure by the bridge
+Obsoletes: php-zendframework-%{zf_name} < 1.2.0-99
+Provides: php-zendframework-%{zf_name} = %{version}-99
+Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+Provides: php-composer(zendframework/%{zf_name}) = %{version}
Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
+Provides: php-autoloader(zendframework/%{zf_name}) = %{version}
%description
-Code for converting PSR-7 messages to zend-http messages, and vice versa.
+Code for converting PSR-7 messages to laminas-http messages, and vice versa.
-Documentation: https://zendframework.github.io/%{gh_project}/
+Documentation: https://docs.laminas.dev/%{gh_project}/
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p0 -b .old
mv LICENSE.md LICENSE
@@ -87,16 +116,33 @@ mv LICENSE.md LICENSE
phpab --template fedora --output src/autoload.php src
cat << 'EOF' | tee -a src/autoload.php
\Fedora\Autoloader\Dependencies::required([
- '%{php_home}/Zend/Http/autoload.php',
+ '%{php_home}/%{namespace}/Http/autoload.php',
'%{php_home}/Psr/Http/Message/autoload.php',
- '%{php_home}/Zend/Diactoros/autoload.php',
+ [
+ '%{php_home}/%{namespace}/Diactoros2/autoload.php',
+ '%{php_home}/%{namespace}/Diactoros/autoload.php',
+ ],
+]);
+EOF
+
+cat << 'EOF' | tee zf.php
+<?php
+require_once '%{php_home}/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/%{namespace}/ZendFrameworkBridge/autoload.php',
+ dirname(dirname(__DIR__)) . '/%{namespace}/%{library}/autoload.php',
]);
EOF
%install
-mkdir -p %{buildroot}%{php_home}/Zend/
-cp -pr src %{buildroot}%{php_home}/Zend/%{library}
+: Laminas library
+mkdir -p %{buildroot}%{php_home}/%{namespace}/
+cp -pr src %{buildroot}%{php_home}/%{namespace}/%{library}
+
+: Zend equiv
+mkdir -p %{buildroot}%{php_home}/Zend/%{library}
+cp -pr zf.php %{buildroot}%{php_home}/Zend/%{library}/autoload.php
%check
@@ -104,14 +150,21 @@ cp -pr src %{buildroot}%{php_home}/Zend/%{library}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-require_once '%{buildroot}%{php_home}/Zend/%{library}/autoload.php';
-\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test');
+require_once '%{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{namespace}Test\\%{library}\\', dirname(__DIR__) . '/test');
EOF
+: check compat autoloader
+php -r '
+require "%{buildroot}%{php_home}/Zend/%{library}/autoload.php";
+exit (class_exists("\\Zend\\%{library}\\Psr7Response") ? 0 : 1);
+'
+
+: upstream test suite
ret=0
-for cmd in php php56 php70 php71 php72; do
+for cmd in php php72 php73 php74; do
if which $cmd; then
- $cmd %{_bindir}/phpunit || ret=1
+ $cmd %{_bindir}/phpunit6 || ret=1
fi
done
exit $ret
@@ -121,14 +174,21 @@ exit $ret
%files
+# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{php_home}/Zend/%{library}
+%{php_home}/%{namespace}/%{library}
%changelog
+* Fri Jan 10 2020 Remi Collet <remi@remirepo.net> - 1.2.0-1
+- switch to Laminas
+- update to 1.2.0
+- raise dependency on PHP 5.6
+
* Sat Dec 9 2017 Remi Collet <remi@remirepo.net> - 0.2.2-4
- switch from zend-loader to fedora/autoloader
diff --git a/test.patch b/test.patch
new file mode 100644
index 0000000..380272f
--- /dev/null
+++ b/test.patch
@@ -0,0 +1,24 @@
+diff -up test/Psr7ResponseTest.php.old test/Psr7ResponseTest.php
+--- test/Psr7ResponseTest.php.old 2020-01-10 15:11:11.847467126 +0100
++++ test/Psr7ResponseTest.php 2020-01-10 15:11:34.953344291 +0100
+@@ -30,7 +30,7 @@ class Psr7ResponseTest extends TestCase
+ 'Content-Length' => [ '5' ]
+ ]],
+ [ 'Test!', 202, [
+- 'Content-Type' => [ 'text/html; level=1', 'text/html' ],
++ 'Content-Type' => [ 'text/html', 'text/html' ],
+ 'Content-Length' => [ '5' ]
+ ]],
+ ];
+diff -up test/Psr7ServerRequestTest.php.old test/Psr7ServerRequestTest.php
+--- test/Psr7ServerRequestTest.php.old 2020-01-10 15:10:52.018572544 +0100
++++ test/Psr7ServerRequestTest.php 2020-01-10 15:10:54.721558173 +0100
+@@ -401,7 +401,7 @@ class Psr7ServerRequestTest extends Test
+ 'POST', // http method
+ [
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+- 'Cookie' => sprintf("PHPSESSID=%s;foo=bar", uniqid())
++ 'Cookie' => sprintf("PHPSESSID=%s", uniqid())
+ ], // headers
+ '', // body
+ [ 'foo' => 'bar' ], // query params