summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-12-19 11:40:00 +0100
committerRemi Collet <remi@remirepo.net>2017-12-19 11:40:00 +0100
commit04f36f583570ddc9a87a6d8f1d0359ad8b3ca68e (patch)
tree35891623f518075b1ecb74ee1979fd80fa7a5e6d
parent303485a88b5a37926109530feced532939585d53 (diff)
Fix FTBFS from Koschei, add upstream patch for PHP 7.2
-rw-r--r--.gitignore8
-rw-r--r--d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc.patch46
-rw-r--r--php-horde-Horde-Text-Flowed.spec26
3 files changed, 71 insertions, 9 deletions
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/d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc.patch b/d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc.patch
new file mode 100644
index 0000000..19f3730
--- /dev/null
+++ b/d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc.patch
@@ -0,0 +1,46 @@
+From d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc Mon Sep 17 00:00:00 2001
+From: Jan Schneider <jan@horde.org>
+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/Text/Flowed.php | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/lib/Horde/Text/Flowed.php b/lib/Horde/Text/Flowed.php
+index fb5befd..b5a6cfe 100644
+--- a/lib/Horde/Text/Flowed.php
++++ b/lib/Horde/Text/Flowed.php
+@@ -127,9 +127,8 @@ public function toFixed($quote = false)
+ $txt = '';
+
+ $this->_reformat(false, $quote);
+- reset($this->_output);
+ $lines = count($this->_output) - 1;
+- while (list($no, $line) = each($this->_output)) {
++ foreach ($this->_output as $no => $line) {
+ $txt .= $line['text'] . (($lines == $no) ? '' : "\n");
+ }
+
+@@ -172,8 +171,7 @@ public function toFlowed($quote = false, array $opts = array())
+ $txt = '';
+
+ $this->_reformat(true, $quote, empty($opts['nowrap']));
+- reset($this->_output);
+- while (list(,$line) = each($this->_output)) {
++ foreach ($this->_output as $line) {
+ $txt .= $line['text'] . "\n";
+ }
+
+@@ -206,9 +204,8 @@ protected function _reformat($toflowed, $quote, $wrap = true)
+ $text = preg_split("/\r?\n/", $this->_text);
+ $text_count = count($text) - 1;
+ $skip = 0;
+- reset($text);
+
+- while (list($no, $line) = each($text)) {
++ foreach ($text as $no => $line) {
+ if ($skip) {
+ --$skip;
+ continue;
diff --git a/php-horde-Horde-Text-Flowed.spec b/php-horde-Horde-Text-Flowed.spec
index ea53dac..7fc2ea6 100644
--- a/php-horde-Horde-Text-Flowed.spec
+++ b/php-horde-Horde-Text-Flowed.spec
@@ -13,7 +13,7 @@
Name: php-horde-Horde-Text-Flowed
Version: 2.0.3
-Release: 1%{?dist}
+Release: 4%{?dist}
Summary: Horde API for flowed text as per RFC 3676
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/Text_Flowed/commit/d64eb3a776eb017caa7a504ac4b4d9608bfcf1cc.patch
+
BuildArch: noarch
BuildRequires: php-pear(PEAR) >= 1.7.0
BuildRequires: php(language) >= 5.3.0
@@ -51,7 +52,9 @@ using the encoding described in RFC 3676 ('flowed' text).
%setup -q -c
cd %{pear_name}-%{version}
-cp ../package.xml %{name}.xml
+%patch0 -p1 -b .upstream
+
+sed -e 's/md5sum="[^"]*"//' ../package.xml >%{name}.xml
%build
@@ -73,11 +76,14 @@ 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
+ret=0
+for cmd in php php56 php70 php71 php72; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose . || ret=1
+ fi
+done
+exit $ret
%post
@@ -92,14 +98,16 @@ fi
%files
-%defattr(-,root,root,-)
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{name}.xml
%{pear_phpdir}/Horde/Text
-%{pear_testdir}/%{pear_name}
+%doc %{pear_testdir}/%{pear_name}
%changelog
+* Tue Dec 19 2017 Remi Collet <remi@remirepo.net> - 2.0.3-4
+- Fix FTBFS from Koschei, add upstream patch for PHP 7.2
+
* Tue Feb 02 2016 Remi Collet <remi@fedoraproject.org> - 2.0.3-1
- Update to 2.0.3
- PHP 7 compatible version