From 84b6e6e755539c83d9e69d27b31c31850749206c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 15 Nov 2019 15:17:28 +0100 Subject: - add patch for PHP 7.4 from https://github.com/horde/Xml_Wbxml/pull/1 - use range dependencies --- .gitignore | 8 +++++++ Horde_Xml_Wbxml-php74.patch | 44 +++++++++++++++++++++++++++++++++++++ php-horde-Horde-Xml-Wbxml.spec | 50 ++++++++++++++++++++++++++++++------------ 3 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 .gitignore create mode 100644 Horde_Xml_Wbxml-php74.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Horde_Xml_Wbxml-php74.patch b/Horde_Xml_Wbxml-php74.patch new file mode 100644 index 0000000..be35987 --- /dev/null +++ b/Horde_Xml_Wbxml-php74.patch @@ -0,0 +1,44 @@ +diff --git a/lib/Horde/Xml/Wbxml/Decoder.php b/lib/Horde/Xml/Wbxml/Decoder.php +index 2750a34..e1f71fe 100644 +--- a/lib/Horde/Xml/Wbxml/Decoder.php ++++ b/lib/Horde/Xml/Wbxml/Decoder.php +@@ -89,7 +89,7 @@ class Horde_Xml_Wbxml_Decoder extends Horde_Xml_Wbxml_ContentHandler + */ + public function getByte($input) + { +- return ord($input{$this->_strpos++}); ++ return ord($input[$this->_strpos++]); + } + + /** +diff --git a/lib/Horde/Xml/Wbxml/Encoder.php b/lib/Horde/Xml/Wbxml/Encoder.php +index 69b14cb..dbacb86 100644 +--- a/lib/Horde/Xml/Wbxml/Encoder.php ++++ b/lib/Horde/Xml/Wbxml/Encoder.php +@@ -49,7 +49,7 @@ class Horde_Xml_Wbxml_Encoder extends Horde_Xml_Wbxml_ContentHandler + /** + * Constructor. + */ +- public function Horde_Xml_Wbxml_Encoder() ++ public function __construct() + { + $this->_dtdManager = new Horde_Xml_Wbxml_DtdManager(); + $this->_stringTable = new Horde_Xml_Wbxml_HashTable(); +@@ -213,7 +213,7 @@ class Horde_Xml_Wbxml_Encoder extends Horde_Xml_Wbxml_ContentHandler + + $bytes = array(); + for ($i = 0; $i < $nbytes; $i++) { +- $bytes[] = $string{$i}; ++ $bytes[] = $string[$i]; + } + + return $bytes; +@@ -422,7 +422,7 @@ class Horde_Xml_Wbxml_Encoder extends Horde_Xml_Wbxml_ContentHandler + $this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_SWITCH_PAGE); + $this->_output .= chr($cp); + } else { +- $this->_subParser = new Horde_Xml_Wbxml_Encoder(true); ++ $this->_subParser = new Horde_Xml_Wbxml_Encoder(); + $this->_subParserStack = 1; + } + } diff --git a/php-horde-Horde-Xml-Wbxml.spec b/php-horde-Horde-Xml-Wbxml.spec index 3628be9..7052fff 100644 --- a/php-horde-Horde-Xml-Wbxml.spec +++ b/php-horde-Horde-Xml-Wbxml.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-horde-Horde-Xml-Wbxml # -# Copyright (c) 2012-2017 Nick Bebout, Remi Collet +# Copyright (c) 2012-2019 Nick Bebout, Remi Collet # # License: MIT # https://fedoraproject.org/wiki/Licensing:MIT#Modern_Style_with_sublicense @@ -13,21 +13,28 @@ Name: php-horde-Horde-Xml-Wbxml Version: 2.0.3 -Release: 1%{?dist} +Release: 8%{?dist} Summary: Provides an API for encoding and decoding WBXML documents -Group: Development/Libraries License: LGPLv2 URL: http://%{pear_channel} Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Patch0: %{pear_name}-php74.patch + BuildArch: noarch BuildRequires: php-common >= 5.3.0 BuildRequires: php-pear(PEAR) >= 1.7.0 BuildRequires: php-channel(%{pear_channel}) # To run unit tests +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-pear(%{pear_channel}/Horde_Util) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Util) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Test) >= 2.1.0 with php-pear(%{pear_channel}/Horde_Test) < 3) +%else BuildRequires: php-pear(%{pear_channel}/Horde_Test) >= 2.1.0 +BUildRequires: php-pear(%{pear_channel}/Horde_Util) >= 2.0.0 +%endif +BuildRequires: php-xml %if 0%{?fedora} > 12 BuildRequires: libwbxml %endif @@ -39,8 +46,12 @@ Requires: php-pear(PEAR) >= 1.7.0 Requires: php-pcre Requires: php-xml Requires: php-channel(%{pear_channel}) +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-pear(%{pear_channel}/Horde_Util) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Util) < 3) +%else Requires: php-pear(%{pear_channel}/Horde_Util) >= 2.0.0 Requires: php-pear(%{pear_channel}/Horde_Util) < 3.0.0 +%endif* Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} Provides: php-composer(horde/horde-xml-wbxml) = %{version} @@ -55,7 +66,11 @@ with wireless devices. %setup -q -c cd %{pear_name}-%{version} -cp ../package.xml %{name}.xml +%patch0 -p1 + +sed -e '/.php/s/md5sum=.*name=/name=/' \ + ../package.xml >%{name}.xml +touch -r ../package.xml %{name}.xml %build @@ -64,7 +79,6 @@ cd %{pear_name}-%{version} %install -rm -rf %{buildroot} cd %{pear_name}-%{version} %{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml @@ -78,15 +92,19 @@ install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} %check cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g) -%{_bindir}/phpunit . -if which php70; then - php70 %{_bindir}/phpunit . -fi +# ignore test when wbxml2xml fails +sed -e '/assertEquals/s/^/if ($xml_ref) /' \ + -i DecodeTest.php -%clean -rm -rf %{buildroot} +ret=0 +for cmd in php php71 php72 php73 php74; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose . || ret=1 + fi +done +exit $ret %post @@ -101,16 +119,20 @@ fi %files -%defattr(-,root,root,-) %doc %{pear_docdir}/%{pear_name} %{pear_xmldir}/%{name}.xml %dir %{pear_phpdir}/Horde/Xml %{pear_phpdir}/Horde/Xml/Wbxml %{pear_phpdir}/Horde/Xml/Wbxml.php -%{pear_testdir}/%{pear_name} +%doc %{pear_testdir}/%{pear_name} %changelog +* Fri Nov 15 2019 Remi Collet - 2.0.3-8 +- add patch for PHP 7.4 + from https://github.com/horde/Xml_Wbxml/pull/1 +- use range dependencies + * Tue Feb 02 2016 Remi Collet - 2.0.3-1 - Update to 2.0.3 - PHP 7 compatible version -- cgit