diff options
-rw-r--r-- | composer.json | 9 | ||||
l--------- | makesrc.sh | 1 | ||||
-rw-r--r-- | php-jms-serializer-php8.patch | 30 | ||||
-rw-r--r-- | php-jms-serializer.spec | 142 |
4 files changed, 154 insertions, 28 deletions
diff --git a/composer.json b/composer.json index 13251ad..62caf3d 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", "keywords": ["serialization", "deserialization", "json", "jaxb", "xml"], "homepage": "http://jmsyst.com/libs/serializer", - "license": "Apache-2.0", + "license": "MIT", "authors": [ { "name": "Johannes M. Schmitt", @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.5.0", - "jms/metadata": "~1.1", + "php": "^5.5|^7.0", + "jms/metadata": "^1.3", "jms/parser-lib": "1.*", "phpoption/phpoption": "^1.1", "phpcollection/phpcollection": "~0.1", @@ -25,7 +25,6 @@ "doctrine/instantiator": "^1.0.3" }, "conflict": { - "jms/serializer-bundle": "<1.2.1", "twig/twig": "<1.12" }, "suggest": { @@ -62,7 +61,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-1.x": "1.14-dev" } } } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..7f5a70b --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-jms-serializer-get-source.sh
\ No newline at end of file diff --git a/php-jms-serializer-php8.patch b/php-jms-serializer-php8.patch new file mode 100644 index 0000000..cfe41ab --- /dev/null +++ b/php-jms-serializer-php8.patch @@ -0,0 +1,30 @@ +diff -up ./src/JMS/Serializer/XmlDeserializationVisitor.php.php8 ./src/JMS/Serializer/XmlDeserializationVisitor.php +--- ./src/JMS/Serializer/XmlDeserializationVisitor.php.php8 2021-03-31 13:54:50.261719313 +0200 ++++ ./src/JMS/Serializer/XmlDeserializationVisitor.php 2021-03-31 13:54:57.315695261 +0200 +@@ -48,7 +48,7 @@ class XmlDeserializationVisitor extends + $previous = libxml_use_internal_errors(true); + libxml_clear_errors(); + +- $previousEntityLoaderState = libxml_disable_entity_loader($this->disableExternalEntities); ++ $previousEntityLoaderState = @libxml_disable_entity_loader($this->disableExternalEntities); + + if (false !== stripos($data, '<!doctype')) { + $internalSubset = $this->getDomDocumentTypeEntitySubset($data); +@@ -63,7 +63,7 @@ class XmlDeserializationVisitor extends + $doc = simplexml_load_string($data); + + libxml_use_internal_errors($previous); +- libxml_disable_entity_loader($previousEntityLoaderState); ++ @libxml_disable_entity_loader($previousEntityLoaderState); + + if (false === $doc) { + throw new XmlErrorException(libxml_get_last_error()); +@@ -176,7 +176,7 @@ class XmlDeserializationVisitor extends + $nodes = $data->xpath($entryName); + } + +- if (!\count($nodes)) { ++ if (!($nodes && \count($nodes))) { + if (null === $this->result) { + return $this->result = array(); + } diff --git a/php-jms-serializer.spec b/php-jms-serializer.spec index 82e07d0..d8eac31 100644 --- a/php-jms-serializer.spec +++ b/php-jms-serializer.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-jms-serializer # -# Copyright (c) 2017 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,13 +12,20 @@ %global github_owner schmittjoh %global github_name serializer -%global github_version 1.10.0 -%global github_commit 62c7ff6d61f8692eac8be024c542b3d9d0ab8c8a +%global github_version 1.14.1 +%global github_commit ba908d278fff27ec01fb4349f372634ffcd697c0 %global composer_vendor jms %global composer_project serializer -# "php": ">=5.5.0" +# Deprecate Symfony 2 on Fedora 32+ and EPEL 8+ +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 +%global with_symfony2 0 +%else +%global with_symfony2 1 +%endif + +# "php": "^5.5|^7.0" %global php_min_ver 5.5.0 # "doctrine/annotations": "^1.0" # NOTE: Min version not 1.0 because autoloader required @@ -31,8 +38,8 @@ # NOTE: Min version not 2.1 because autoloader required %global doctrine_orm_min_ver 2.4.8 %global doctrine_orm_max_ver 3.0 -# "jms/metadata": "~1.1" -# NOTE: Min version not 1.1 because autoloader required +# "jms/metadata": "^1.3" +# NOTE: Min version not 1.3 because autoloader required %global jms_metadata_min_ver 1.6.0 %global jms_metadata_max_ver 2.0 # "jms/parser-lib": "1.*" @@ -57,13 +64,18 @@ # "symfony/translation": "^2.1|^3.0" # "symfony/validator": "^2.2|^3.0" # "symfony/yaml": "^2.1|^3.0" +%if %{with_symfony2} # NOTE: Min version not 2.6 because autoloader required %global symfony_min_ver 2.7.1 +%else +%global symfony_min_ver 3.3 +%endif %global symfony_max_ver 4.0 + # "twig/twig": "~1.12|~2.0" # NOTE: Min version not 1.12 because autoloader required %global twig_min_ver 1.18.2 -%if 0%{?fedora} >= 25 +%if 0%{?fedora} >= 25 || 0%{?rhel} >= 8 %global twig_max_ver 3.0 %else %global twig_max_ver 2.0 @@ -72,15 +84,28 @@ # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} +# Range dependencies supported? +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +%global with_range_dependencies 1 +%else +%global with_range_dependencies 0 +%endif + +# Weak dependencies supported? +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 +%global with_weak_dependencies 1 +%else +%global with_weak_dependencies 0 +%endif + %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 5%{?github_release}%{?dist} Summary: Library for (de-)serializing data of any complexity -Group: Development/Libraries -License: ASL 2.0 +License: MIT URL: http://jmsyst.com/libs/serializer # GitHub export contains non-allowable licened documentation. @@ -88,12 +113,34 @@ URL: http://jmsyst.com/libs/serializer Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh +# Minimal patch for PHP 8 +Patch0: %{name}-php8.patch + BuildArch: noarch # Tests %if %{with_tests} BuildRequires: php-cli ## composer.json BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) +%if %{with_range_dependencies} +BuildRequires: (php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver} with php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver}) +BuildRequires: (php-composer(doctrine/instantiator) >= %{doctrine_instantiator_min_ver} with php-composer(doctrine/instantiator) < %{doctrine_instantiator_max_ver}) +BuildRequires: (php-composer(doctrine/orm) >= %{doctrine_orm_min_ver} with php-composer(doctrine/orm) < %{doctrine_orm_max_ver}) +BuildRequires: (php-composer(jms/metadata) >= %{jms_metadata_min_ver} with php-composer(jms/metadata) < %{jms_metadata_max_ver}) +BuildRequires: (php-JMSParser >= %{jms_parser_lib_min_ver} with php-composer(jms/parser-lib) < %{jms_parser_lib_max_ver}) +BuildRequires: (php-composer(phpcollection/phpcollection) >= %{phpcollection_min_ver} with php-composer(phpcollection/phpcollection) < %{phpcollection_max_ver}) +BuildRequires: (php-composer(phpoption/phpoption) >= %{phpoption_min_ver} with php-composer(phpoption/phpoption) < %{phpoption_max_ver}) +BuildRequires: (php-composer(psr/container) >= %{psr_container_min_ver} with php-composer(psr/container) < %{psr_container_max_ver}) +BuildRequires: (php-composer(symfony/dependency-injection) >= %{symfony_min_ver} with php-composer(symfony/dependency-injection) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/expression-language) >= %{symfony_min_ver} with php-composer(symfony/expression-language) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/filesystem) >= %{symfony_min_ver} with php-composer(symfony/filesystem) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/form) >= %{symfony_min_ver} with php-composer(symfony/form) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/translation) >= %{symfony_min_ver} with php-composer(symfony/translation) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/validator) >= %{symfony_min_ver} with php-composer(symfony/validator) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/yaml) >= %{symfony_min_ver} with php-composer(symfony/yaml) < %{symfony_max_ver}) +BuildRequires: (php-composer(twig/twig) >= %{twig_min_ver} with php-composer(twig/twig) < %{twig_max_ver}) +%else BuildRequires: php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver} BuildRequires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver} BuildRequires: php-composer(doctrine/instantiator) < %{doctrine_instantiator_max_ver} @@ -109,19 +156,28 @@ BuildRequires: php-composer(phpcollection/phpcollection) < %{phpcollection_max_ BuildRequires: php-composer(phpcollection/phpcollection) >= %{phpcollection_min_ver} BuildRequires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} BuildRequires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} -BuildRequires: php-composer(phpunit/phpunit) BuildRequires: php-composer(psr/container) < %{psr_container_max_ver} BuildRequires: php-composer(psr/container) >= %{psr_container_min_ver} BuildRequires: php-composer(symfony/dependency-injection) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/dependency-injection) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/expression-language) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/expression-language) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/filesystem) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/filesystem) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/form) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/form) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/translation) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/translation) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/validator) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/validator) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/yaml) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/yaml) >= %{symfony_min_ver} BuildRequires: php-composer(twig/twig) < %{twig_max_ver} BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} -## phpcompatinfo (computed from version 1.7.1) +%endif +## phpcompatinfo (computed from version 1.14.1) +BuildRequires: php-composer(doctrine/cache) < 2 +BuildRequires: php-composer(doctrine/common) < 3 BuildRequires: php-date BuildRequires: php-dom BuildRequires: php-json @@ -136,6 +192,14 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} +%if %{with_range_dependencies} +Requires: (php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver} with php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver}) +Requires: (php-composer(doctrine/instantiator) >= %{doctrine_instantiator_min_ver} with php-composer(doctrine/instantiator) < %{doctrine_instantiator_max_ver}) +Requires: (php-composer(jms/metadata) >= %{jms_metadata_min_ver} with php-composer(jms/metadata) < %{jms_metadata_max_ver}) +Requires: (php-JMSParser >= %{jms_parser_lib_min_ver} with php-composer(jms/parser-lib) < %{jms_parser_lib_max_ver}) +Requires: (php-composer(phpcollection/phpcollection) >= %{phpcollection_min_ver} with php-composer(phpcollection/phpcollection) < %{phpcollection_max_ver}) +Requires: (php-composer(phpoption/phpoption) >= %{phpoption_min_ver} with php-composer(phpoption/phpoption) < %{phpoption_max_ver}) +%else Requires: php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver} Requires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver} Requires: php-composer(doctrine/instantiator) < %{doctrine_instantiator_max_ver} @@ -149,7 +213,9 @@ Requires: php-composer(phpcollection/phpcollection) < %{phpcollection_max_ Requires: php-composer(phpcollection/phpcollection) >= %{phpcollection_min_ver} Requires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} Requires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} -# phpcompatinfo (computed from version 1.7.1) +%endif +# phpcompatinfo (computed from version 1.14.1) +Requires: php-composer(doctrine/common) < 3 Requires: php-date Requires: php-dom Requires: php-json @@ -160,11 +226,11 @@ Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) -%if 0%{?fedora} +%if %{with_weak_dependencies} # Weak dependencies Suggests: php-composer(symfony/yaml) Suggests: php-composer(doctrine/collections) -Suggests: php-composer(cache) +Suggests: php-composer(doctrine/cache) %endif # Composer @@ -190,6 +256,7 @@ Autoloader: %{phpdir}/JMS/Serializer/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%patch0 -p1 : Remove Propel find . -type f -name '*Propel*' -delete -print @@ -213,6 +280,10 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Dependencies::required([ '%{phpdir}/Doctrine/Common/Annotations/autoload.php', + [ + '%{phpdir}/Doctrine/Common/Persistence/autoload.php', + '%{phpdir}/Doctrine/Common/autoload.php', + ], '%{phpdir}/Doctrine/Instantiator/autoload.php', '%{phpdir}/JMS/Parser/autoload.php', '%{phpdir}/Metadata/autoload.php', @@ -223,10 +294,14 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Dependencies::optional([ '%{phpdir}/Doctrine/Common/Cache/autoload.php', '%{phpdir}/Doctrine/Common/Collections/autoload.php', +%if %{with_symfony2} [ '%{phpdir}/Symfony3/Component/Yaml/autoload.php', '%{phpdir}/Symfony/Component/Yaml/autoload.php', ], +%else + '%{phpdir}/Symfony3/Component/Yaml/autoload.php', +%endif ]); AUTOLOAD @@ -248,6 +323,7 @@ require '%{buildroot}%{phpdir}/JMS/Serializer/autoload.php'; \Fedora\Autoloader\Dependencies::required([ '%{phpdir}/Doctrine/ORM/autoload.php', '%{phpdir}/Psr/Container/autoload.php', +%if %{with_symfony2} [ '%{phpdir}/Symfony3/Component/DependencyInjection/autoload.php', '%{phpdir}/Symfony/Component/DependencyInjection/autoload.php', @@ -272,6 +348,14 @@ require '%{buildroot}%{phpdir}/JMS/Serializer/autoload.php'; '%{phpdir}/Symfony3/Component/Validator/autoload.php', '%{phpdir}/Symfony/Component/Validator/autoload.php', ], +%else + '%{phpdir}/Symfony3/Component/DependencyInjection/autoload.php', + '%{phpdir}/Symfony3/Component/ExpressionLanguage/autoload.php', + '%{phpdir}/Symfony3/Component/Filesystem/autoload.php', + '%{phpdir}/Symfony3/Component/Form/autoload.php', + '%{phpdir}/Symfony3/Component/Translation/autoload.php', + '%{phpdir}/Symfony3/Component/Validator/autoload.php', +%endif (PHP_VERSION_ID < 70000) ? '%{phpdir}/Twig/autoload.php' : [ @@ -291,15 +375,8 @@ sed 's/function testInlineArray/function SKIP_testInlineArray/' \ : Upstream tests RETURN_CODE=0 PHPUNIT=$(which phpunit) -for PHP_EXEC in php php56 php70 php71 php72; do +for PHP_EXEC in php php73 php74 php80; do if [ "php" = "$PHP_EXEC" ] || which $PHP_EXEC; then - if [ $($PHP_EXEC -r 'echo PHP_VERSION_ID;') -lt 70200 ]; then - sed \ - -e 's/function testArrayFloats/function SKIP_testArrayFloats/' \ - -e 's/function testCurrencyAwarePrice/function SKIP_testCurrencyAwarePrice/' \ - -i tests/Serializer/BaseSerializationTest.php - fi - $PHP_EXEC $PHPUNIT --bootstrap bootstrap.php || RETURN_CODE=1 fi done @@ -318,6 +395,25 @@ exit $RETURN_CODE %changelog +* Wed Mar 31 2021 Remi Collet <remi@remirepo.net> - 1.14.1-5 +- add minimal fix for PHP 8 + +* Tue Aug 18 2020 Shawn Iwinski <shawn@iwin.ski> - 1.14.1-3 +- Bumping release to ensure all changes are built + +* Tue Aug 18 2020 Remi Collet <remi@remirepo.net> - 1.14.1-2 +- Update to 1.14.1 (previous update failed to change commit hash so 1.10.0 was built) +- Change license from ASL 2.0 to MIT + +* Tue Aug 18 2020 Shawn Iwinski <shawn@iwin.ski> - 1.14.1-1 +- Update to 1.14.1 +- Fix FTBFS (RHBZ #1865219) +- Conditionally use range dependencies +- Conditionally drop Symfony 2 interoperability + +* Tue Feb 26 2019 Remi Collet <remi@remirepo.net> - 1.10.0-5 +- cleanup for EL-8 + * Thu Dec 14 2017 Shawn Iwinski <shawn@iwin.ski> - 1.10.0-1 - Update to 1.10.0 (RHBZ #1508429) - Allow Symfony 3 |