From 9bef2ce604f0b7c5d84cff6929d8a2e83bdf72fc Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Dec 2017 11:55:20 +0100 Subject: Fix FTBFS from Koschei, add upstream patch for PHP 7.2 --- .gitignore | 8 ++++++ dc2e8561c551644ae6ccd07739994d905de206c2.patch | 34 ++++++++++++++++++++++++++ php-horde-Horde-LoginTasks.spec | 24 ++++++++++++------ 3 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 dc2e8561c551644ae6ccd07739994d905de206c2.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/dc2e8561c551644ae6ccd07739994d905de206c2.patch b/dc2e8561c551644ae6ccd07739994d905de206c2.patch new file mode 100644 index 0000000..d875b0f --- /dev/null +++ b/dc2e8561c551644ae6ccd07739994d905de206c2.patch @@ -0,0 +1,34 @@ +From dc2e8561c551644ae6ccd07739994d905de206c2 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/LoginTasks/Tasklist.php | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/lib/Horde/LoginTasks/Tasklist.php b/lib/Horde/LoginTasks/Tasklist.php +index 0812630..6346ede 100644 +--- a/lib/Horde/LoginTasks/Tasklist.php ++++ b/lib/Horde/LoginTasks/Tasklist.php +@@ -99,8 +99,7 @@ public function ready($advance = false) + } + } + +- reset($this->_tasks); +- while (list($k, $v) = each($this->_tasks)) { ++ foreach ($this->_tasks as $k => $v) { + if ($v->needsDisplay() && ($k >= $this->_ptr)) { + break; + } +@@ -127,8 +126,7 @@ public function needDisplay($advance = false) + $tmp = array(); + $previous = null; + +- reset($this->_tasks); +- while (list(, $v) = each($this->_tasks)) { ++ foreach ($this->_tasks as $v) { + if (!$v->needsDisplay() || + (!is_null($previous) && !$v->joinDisplayWith($previous))) { + break; diff --git a/php-horde-Horde-LoginTasks.spec b/php-horde-Horde-LoginTasks.spec index 0159575..25bdb7f 100644 --- a/php-horde-Horde-LoginTasks.spec +++ b/php-horde-Horde-LoginTasks.spec @@ -13,7 +13,7 @@ Name: php-horde-Horde-LoginTasks Version: 2.0.7 -Release: 1%{?dist} +Release: 4%{?dist} Summary: Horde Login Tasks System Group: Development/Libraries @@ -21,7 +21,8 @@ License: LGPLv2 URL: http://pear.horde.org Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Patch0: https://github.com/horde/LoginTasks/commit/dc2e8561c551644ae6ccd07739994d905de206c2.patch + BuildArch: noarch BuildRequires: php-pear(PEAR) >= 1.7.0 BuildRequires: php-channel(%{pear_channel}) @@ -52,13 +53,16 @@ tasks run upon login to Horde applications. %prep %setup -q -c + cd %{pear_name}-%{version} +%patch0 -p1 -b .upstream # Don't install .po and .pot files # Remove checksum for .mo, as we regenerate them sed -e '/%{pear_name}.po/d' \ -e '/Horde_Other.po/d' \ -e '/%{pear_name}.mo/s/md5sum=.*name=/name=/' \ + -e 's/md5sum="[^"]*"//' \ ../package.xml >%{name}.xml touch -r ../package.xml %{name}.xml @@ -94,11 +98,13 @@ done | tee ../%{pear_name}.lang %check cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g) -%{_bindir}/phpunit . -if which php70; then - php70 %{_bindir}/phpunit . -fi +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose . || ret=1 + fi +done %post @@ -113,17 +119,19 @@ fi %files -f %{pear_name}.lang -%defattr(-,root,root,-) %doc %{pear_docdir}/%{pear_name} %{pear_xmldir}/%{name}.xml %{pear_phpdir}/Horde/LoginTasks %{pear_phpdir}/Horde/LoginTasks.php -%{pear_testdir}/%{pear_name} +%doc %{pear_testdir}/%{pear_name} %dir %{pear_datadir}/%{pear_name} %dir %{pear_datadir}/%{pear_name}/locale %changelog +* Tue Dec 19 2017 Remi Collet - 2.0.7-4 +- Fix FTBFS from Koschei, add upstream patch for PHP 7.2 + * Mon Mar 21 2016 Remi Collet - 2.0.7-1 - Update to 2.0.7 -- cgit