diff options
author | Remi Collet <remi@remirepo.net> | 2020-01-07 09:48:18 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-01-07 09:48:18 +0100 |
commit | c5ca909ec24da3fd2c2e4102dad92f33656f3a3a (patch) | |
tree | d9fbb1176779a038bf0e4e64d652228a086eb756 /php-laminas-json.spec | |
parent | cf35b329c6de17866d29ad67ba3b241735b562d9 (diff) |
switch to Laminas
Diffstat (limited to 'php-laminas-json.spec')
-rw-r--r-- | php-laminas-json.spec | 114 |
1 files changed, 82 insertions, 32 deletions
diff --git a/php-laminas-json.spec b/php-laminas-json.spec index c11cced..ec2ec18 100644 --- a/php-laminas-json.spec +++ b/php-laminas-json.spec @@ -1,4 +1,4 @@ -# remirepo/Fedora spec file for php-zendframework-zend-json +# remirepo/Fedora spec file for php-laminas-json # # Copyright (c) 2015-2020 Remi Collet # License: CC-BY-SA @@ -7,11 +7,13 @@ # Please, preserve the changelog entries # %global bootstrap 0 -%global gh_commit e9ddb1192d93fe7fff846ac895249c39db75132b +%global gh_commit 00dc0da7b5e5018904c5c4a8e80a5faa16c2c1c6 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner zendframework -%global gh_project zend-json +%global gh_owner laminas +%global gh_project laminas-json +%global zf_name zend-json %global php_home %{_datadir}/php +%global namespace Laminas %global library Json %if %{bootstrap} %global with_tests 0%{?_with_tests:1} @@ -19,13 +21,13 @@ %global with_tests 0%{!?_without_tests:1} %endif -Name: php-%{gh_owner}-%{gh_project} +Name: php-%{gh_project} Version: 3.1.2 Release: 1%{?dist} -Summary: Zend Framework %{library} component +Summary: Laminas 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 @@ -33,34 +35,55 @@ BuildArch: noarch # Tests %if %{with_tests} BuildRequires: php(language) >= 5.6 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-composer(%{gh_owner}/laminas-zendframework-bridge) < 2) +# remirepo:3 +%else +BuildRequires: php-laminas-zendframework-bridge +%endif BuildRequires: php-json BuildRequires: php-mbstring BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl # From composer, "require-dev": { -# "phpunit/phpunit": "^5.7.23 || ^6.4.3", -# "zendframework/zend-coding-standard": "~1.0.0", -# "zendframework/zend-stdlib": "^2.7.7 || ^3.1" +# "laminas/laminas-coding-standard": "~1.0.0", +# "laminas/laminas-stdlib": "^2.7.7 || ^3.1", +# "phpunit/phpunit": "^5.7.23 || ^6.4.3" BuildRequires: phpunit6 >= 6.4.3 -BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7.7 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(%{gh_owner}/laminas-stdlib) >= 3.1 with php-composer(%{gh_owner}/laminas-stdlib) < 4) +# remirepo:3 +%else +BuildRequires: php-laminas-stdlib >= 3.1 +%endif %endif # Autoloader BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^5.6 || ^7.0", +# "laminas/laminas-zendframework-bridge": "^1.0" Requires: php(language) >= 5.6 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-composer(%{gh_owner}/laminas-zendframework-bridge) < 2) +# remirepo:3 +%else +Requires: php-laminas-zendframework-bridge +%endif %if ! %{bootstrap} # From composer, "suggest": { -# "zendframework/zend-json-server": "For implementing JSON-RPC servers", -# "zendframework/zend-xml2json": "For converting XML documents to JSON" -%if 0%{?fedora} >= 21 -Suggests: php-composer(%{gh_owner}/zend-json-server) -Suggests: php-composer(%{gh_owner}/zend-xml2json) +# "laminas/laminas-json-server": "For implementing JSON-RPC servers", +# "laminas/laminas-xml2json": "For converting XML documents to JSON" +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 +Suggests: php-composer(%{gh_owner}/laminas-json-server) +Suggests: php-composer(%{gh_owner}/laminas-xml2json) %endif %endif -# From phpcompatinfo report for version 3.1.0 +# From phpcompatinfo report for version 3.1.2 Requires: php-json Requires: php-mbstring Requires: php-pcre @@ -69,17 +92,20 @@ Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) -Obsoletes: php-ZendFramework2-%{library} < 2.5 -Provides: php-ZendFramework2-%{library} = %{version} -Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} +# Compatibily ensure by the bridge +Obsoletes: php-zendframework-%{zf_name} < 3.1.2-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 -Zend\Json provides convenience methods for serializing native PHP to JSON +%{gh_project} provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP. -Documentation: https://zendframework.github.io/%{gh_project}/ +Documentation: https://docs.laminas.dev/%{gh_project}/ %prep @@ -92,15 +118,29 @@ mv LICENSE.md LICENSE phpab --template fedora --output src/autoload.php src cat << 'EOF' | tee -a src/autoload.php \Fedora\Autoloader\Dependencies::optional([ - '%{php_home}/Zend/Json/Server/autoload.php', - '%{php_home}/Zend/Xml2Json/autoload.php', + '%{php_home}/%{namespace}/Json/Server/autoload.php', + '%{php_home}/%{namespace}/Xml2Json/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 @@ -108,19 +148,26 @@ 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'; +require_once '%{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php'; \Fedora\Autoloader\Dependencies::required([ - '%{php_home}/Zend/Stdlib/autoload.php', + '%{php_home}/%{namespace}/Stdlib/autoload.php', ]); -\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); +\Fedora\Autoloader\Autoload::addPsr4('%{namespace}Test\\%{library}\\', dirname(__DIR__) . '/test'); EOF ret=0 -for cmd in php php71 php72 php73 php74; do +for cmd in php php72 php73 php74; do if which $cmd; then $cmd %{_bindir}/phpunit6 --verbose || ret=1 fi done + +: check compat autoloader +php -r ' +require "%{buildroot}%{php_home}/Zend/%{library}/autoload.php"; +return (class_exists("\\Zend\\%{library}\\%{library}") ? 0 : 1); +' + exit $ret %else : Test suite disabled @@ -132,11 +179,14 @@ exit $ret %license LICENSE %doc *.md %doc composer.json -%dir %{php_home}/Zend - %{php_home}/Zend/%{library} +%{php_home}/Zend/%{library} +%{php_home}/%{namespace}/%{library} %changelog +* Tue Jan 7 2020 Remi Collet <remi@remirepo.net> - 3.1.2-1 +- switch to Laminas + * Wed Oct 9 2019 Remi Collet <remi@remirepo.net> - 3.1.2-1 - update to 3.1.2 |