diff --git a/php-gettext-gettext-bigendian.patch b/php-gettext-gettext-bigendian.patch new file mode 100644 index 0000000..be698cb --- /dev/null +++ b/php-gettext-gettext-bigendian.patch @@ -0,0 +1,35 @@ +From 063cf0e74c8bce8785a8d7cc90a5af2bac345fe3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 31 Oct 2017 09:54:52 +0100 +Subject: [PATCH] don't check Po file content on bigendian + +--- + tests/AbstractTest.php | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/tests/AbstractTest.php b/tests/AbstractTest.php +index 42f54b6..42f419f 100644 +--- a/tests/AbstractTest.php ++++ b/tests/AbstractTest.php +@@ -51,7 +51,10 @@ protected function assertContent(Translations $translations, $file, $format = nu + $method = "to{$format}String"; + $content = file_get_contents(static::asset($file.'.'.static::$ext[$format])); + +- $this->assertSame($content, $translations->$method(), $file); ++ // Po reference files are LittleEndian ++ if ($format !== 'Mo' || self::isLittleEndian()) { ++ $this->assertSame($content, $translations->$method(), $file); ++ } + } + + protected static function saveContent(Translations $translations, $file, $format = null) +@@ -78,4 +81,9 @@ protected function runTestFormat($file, $countTranslations, $countTranslated = 0 + $this->assertSame($countTranslated, $translations->countTranslated()); + $this->assertContent($translations, $file); + } ++ ++ protected function isLittleEndian() ++ { ++ return pack("s", 0x3031) === "10"; ++ } + } diff --git a/php-gettext-gettext-php72.patch b/php-gettext-gettext-php72.patch new file mode 100644 index 0000000..78a832c --- /dev/null +++ b/php-gettext-gettext-php72.patch @@ -0,0 +1,22 @@ +Adapted for 3.5.9 from + +From 0134262c82747d9905598d3a0a07ed70049c1040 Mon Sep 17 00:00:00 2001 +From: oscarotero +Date: Sat, 20 May 2017 13:37:44 +0200 +Subject: [PATCH] removed create_function + + +diff --git a/src/Translator.php b/src/Translator.php +index 21fb67b..147f0c2 100644 +--- a/src/Translator.php ++++ b/src/Translator.php +@@ -204,7 +204,8 @@ class Translator extends BaseTranslator + } + + if (!isset($this->plurals[$domain]['function'])) { +- $this->plurals[$domain]['function'] = create_function('$n', self::fixTerseIfs($this->plurals[$domain]['code'])); ++ $code = self::fixTerseIfs($this->plurals[$domain]['code']); ++ $this->plurals[$domain]['function'] = eval("return function (\$n) { $code };"); + } + + if ($this->plurals[$domain]['count'] <= 2) { diff --git a/php-gettext-gettext.spec b/php-gettext-gettext.spec index 398720e..ffcc540 100644 --- a/php-gettext-gettext.spec +++ b/php-gettext-gettext.spec @@ -6,7 +6,7 @@ Name: php-gettext-gettext Version: 3.5.9 -Release: 6%{?dist} +Release: 7%{?dist} BuildArch: noarch License: MIT @@ -14,6 +14,11 @@ Summary: PHP gettext manager URL: https://github.com/%{gh_owner}/%{gh_project} Source0: %{name}-%{version}-%{gh_short}.tgz +# Upstream patch +Patch0: %{name}-php72.patch +# Skip some tests on bigendian as reference file are littleendian +Patch1: %{name}-bigendian.patch + BuildRequires: dos2unix BuildRequires: php-composer(gettext/languages) >= 2.0.0 BuildRequires: php-composer(gettext/languages) < 3.0.0 @@ -43,7 +48,7 @@ Autoloader: %{_datadir}/php/Gettext/autoload.php %prep -%autosetup -n Gettext-%{gh_commit} +%autosetup -n Gettext-%{gh_commit} -p1 # The documentation has the wrong newline codes dos2unix *.md @@ -94,6 +99,11 @@ phpunit --bootstrap tests/bootstrap.php --filter ^\(\(?!\(testBlade\|testTwig\)\ %changelog +* Tue Oct 31 2017 Remi Collet - 3.5.9-7 +- fix FTBFS from Koschei +- add upstream patch for PHP 7.2 +- add patch for bigendian from https://github.com/oscarotero/Gettext/pull/159 + * Thu Jul 27 2017 Fedora Release Engineering - 3.5.9-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild