From 7a5f28f9b786d13a8016e6fe357be820d5e426e3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 10 Jan 2013 15:40:35 +0100 Subject: php-horde-Horde-Text-Filter: 2.0.4 --- Horde_Text_Filter-php55.patch | 26 ++++++++++++++++++++++++++ php-horde-Horde-Text-Filter.spec | 32 +++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 Horde_Text_Filter-php55.patch diff --git a/Horde_Text_Filter-php55.patch b/Horde_Text_Filter-php55.patch new file mode 100644 index 0000000..49eefa6 --- /dev/null +++ b/Horde_Text_Filter-php55.patch @@ -0,0 +1,26 @@ +diff -up lib/Horde/Text/Filter/Emails.php.old lib/Horde/Text/Filter/Emails.php +--- lib/Horde/Text/Filter/Emails.php.old 2013-01-10 15:19:06.000000000 +0100 ++++ lib/Horde/Text/Filter/Emails.php 2013-01-10 15:19:14.000000000 +0100 +@@ -124,7 +124,8 @@ EOR; + */ + static public function decode($text) + { +- return preg_replace('/\01\01\01([\w=+\/]*)\01\01\01/e', 'base64_decode(\'$1\')', $text); ++ $callback = function($hex) { return base64_decode($hex[1]); }; ++ return preg_replace_callback('/\01\01\01([\w=+\/]*)\01\01\01/', $callback , $text); + } + + } +diff -up lib/Horde/Text/Filter/Linkurls.php.old lib/Horde/Text/Filter/Linkurls.php +--- lib/Horde/Text/Filter/Linkurls.php.old 2013-01-10 15:10:48.000000000 +0100 ++++ lib/Horde/Text/Filter/Linkurls.php 2013-01-10 15:18:31.000000000 +0100 +@@ -174,7 +174,8 @@ END_OF_REGEX; + */ + static public function decode($text) + { +- return preg_replace('/\00\00\00([\w=+\/]*)\00\00\00/e', 'base64_decode(\'$1\')', $text); ++ $callback = function($hex) { return base64_decode($hex[1]); }; ++ return preg_replace_callback('/\00\00\00([\w=+\/]*)\00\00\00/', $callback, $text); + } + + } diff --git a/php-horde-Horde-Text-Filter.spec b/php-horde-Horde-Text-Filter.spec index 1dbe9f3..3e03a14 100644 --- a/php-horde-Horde-Text-Filter.spec +++ b/php-horde-Horde-Text-Filter.spec @@ -3,8 +3,11 @@ %global pear_name Horde_Text_Filter %global pear_channel pear.horde.org +# Need locales so only run when installed +%global with_tests %{?_with_tests:1}%{!?_with_tests:0} + Name: php-horde-Horde-Text-Filter -Version: 2.0.3 +Version: 2.0.4 Release: 1%{?dist} Summary: Horde Text Filter API @@ -13,13 +16,18 @@ License: LGPLv2+ URL: http://pear.horde.org Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz +# http://bugs.horde.org/ticket/11943 +Patch0: %{pear_name}-php55.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch BuildRequires: php-pear(PEAR) >= 1.7.0 BuildRequires: php-channel(%{pear_channel}) BuildRequires: gettext +%if %{with_tests} # To run unit tests BuildRequires: php-pear(%{pear_channel}/Horde_Test) >= 2.1.0 +%endif Requires(post): %{__pear} Requires(postun): %{__pear} @@ -49,11 +57,15 @@ Common methods for fitering and converting text. %setup -q -c cd %{pear_name}-%{version} +%patch0 -p0 -b .php55 + # 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 '/Emails.php/s/md5sum=.*name=/name=/' \ + -e '/Linkurls.php/s/md5sum=.*name=/name=/' \ ../package.xml >%{name}.xml @@ -82,18 +94,22 @@ install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} for loc in locale/{??,??_??} do lang=$(basename $loc) - test -d $loc && echo "%%lang(${lang%_*}) %{pear_datadir}/%{pear_name}/$loc" + test -d %{buildroot}%{pear_datadir}/%{pear_name}/$loc \ + && echo "%%lang(${lang%_*}) %{pear_datadir}/%{pear_name}/$loc" done | tee ../%{pear_name}.lang %check +%if %{with_tests} cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g) -# UTF8 issue on old RHEL-5 and Fedora 18 -# Need investigation +# one test fails, need Investigation phpunit\ -d include_path=%{buildroot}%{pear_phpdir}:.:%{pear_phpdir} \ -d date.timezone=UTC \ - . || exit 0 + . +%else +: Test disabled, missing '--with tests' option. +%endif %post @@ -119,6 +135,12 @@ fi %changelog +* Thu Jan 10 2013 Remi Collet - 2.0.4-1 +- Update to 2.0.4 for remi repo +- add option for test (need investigation) +- add patch php 5.5 compatibility (preg_replace with eval) + http://bugs.horde.org/ticket/11943 + * Tue Nov 27 2012 Remi Collet - 2.0.3-1 - Update to 2.0.3 for remi repo -- cgit