From 1503ffd09c65d6b21bf9b800119f71e18f955680 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Dec 2017 12:16:26 +0100 Subject: Fix FTBFS from Koschei, add upstream patch for PHP 7.2 --- .gitignore | 8 +++++ a8777ae113732dd18f9cf04d825322f596fedac7.patch | 33 +++++++++++++++++++ php-horde-Horde-Util.spec | 44 ++++++++++---------------- 3 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 .gitignore create mode 100644 a8777ae113732dd18f9cf04d825322f596fedac7.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/a8777ae113732dd18f9cf04d825322f596fedac7.patch b/a8777ae113732dd18f9cf04d825322f596fedac7.patch new file mode 100644 index 0000000..4f2f028 --- /dev/null +++ b/a8777ae113732dd18f9cf04d825322f596fedac7.patch @@ -0,0 +1,33 @@ +From a8777ae113732dd18f9cf04d825322f596fedac7 Mon Sep 17 00:00:00 2001 +From: Jan Schneider +Date: Mon, 13 Feb 2017 14:57:35 +0100 +Subject: [PATCH] Don't use each(). + +For modern PHP versions there is no improved performance or memory usage compared to foreach() anymore. Beside that it's deprecated in PHP 7.2. +--- + lib/Horde/String.php | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/lib/Horde/String.php b/lib/Horde/String.php +index 26dfcbc..aa8f990 100644 +--- a/lib/Horde/String.php ++++ b/lib/Horde/String.php +@@ -66,8 +66,7 @@ public static function convertCharset($input, $from, $to, $force = false) + + if (is_array($input)) { + $tmp = array(); +- reset($input); +- while (list($key, $val) = each($input)) { ++ foreach ($input as $key => $val) { + $tmp[self::_convertCharset($key, $from, $to)] = self::convertCharset($val, $from, $to, $force); + } + return $tmp; +@@ -84,7 +83,7 @@ public static function convertCharset($input, $from, $to, $force = false) + + $input = clone $input; + $vars = get_object_vars($input); +- while (list($key, $val) = each($vars)) { ++ foreach ($vars as $key => $val) { + $input->$key = self::convertCharset($val, $from, $to, $force); + } + return $input; diff --git a/php-horde-Horde-Util.spec b/php-horde-Horde-Util.spec index c3dd71f..8f4706e 100644 --- a/php-horde-Horde-Util.spec +++ b/php-horde-Horde-Util.spec @@ -19,7 +19,7 @@ Name: php-horde-Horde-Util Version: 2.5.8 -Release: 1%{?dist} +Release: 4%{?dist} Summary: Horde Utility Libraries Group: Development/Libraries @@ -27,7 +27,8 @@ License: LGPLv2 URL: http://%{pear_channel} Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Patch0: https://github.com/horde/Util/commit/a8777ae113732dd18f9cf04d825322f596fedac7.patch + BuildArch: noarch BuildRequires: php(language) >= 5.3.0 BuildRequires: php-pear(PEAR) >= 1.7.0 @@ -76,7 +77,9 @@ These classes provide functionality useful for all kind of applications. %setup -q -c cd %{pear_name}-%{version} -mv ../package.xml %{name}.xml +%patch0 -p1 -b .upstream + +sed -e 's/md5sum="[^"]*"//' ../package.xml >%{name}.xml %build @@ -100,30 +103,13 @@ install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} %if %{with_tests} export LANG=fr_FR.utf8 cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g) -# remirepo:18 -%if 0%{?rhel} == 5 -phpunit . || : Test suite result ignored -%else -run=0 + ret=0 -if which php56; then - php56 %{_bindir}/phpunit . || ret=1 - run=1 -fi -if which php70; then - php70 %{_bindir}/phpunit . || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit . || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose . -# remirepo:3 -fi -exit $ret -%endif +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose . || ret=1 + fi +done %else : Test disabled, bootstrap build %endif @@ -141,7 +127,6 @@ fi %files -%defattr(-,root,root,-) %doc %{pear_docdir}/%{pear_name} %{pear_xmldir}/%{name}.xml %{pear_phpdir}/Horde/Array @@ -151,10 +136,13 @@ fi %{pear_phpdir}/Horde/String %{pear_phpdir}/Horde/Util.php %{pear_phpdir}/Horde/Variables.php -%{pear_testdir}/%{pear_name} +%doc %{pear_testdir}/%{pear_name} %changelog +* Tue Dec 19 2017 Remi Collet - 2.5.8-4 +- Fix Horde_Mime FTBFS from Koschei, add upstream patch for PHP 7.2 + * Sat Jul 02 2016 Remi Collet - 2.5.8-1 - Update to 2.5.8 -- cgit