fix FTBFS from Koschei
add upstream patch for PHP 7.2 add patch for bigendian from https://github.com/oscarotero/Gettext/pull/159
This commit is contained in:
parent
9e602c6626
commit
ec40649b8e
3 changed files with 69 additions and 2 deletions
35
php-gettext-gettext-bigendian.patch
Normal file
35
php-gettext-gettext-bigendian.patch
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
From 063cf0e74c8bce8785a8d7cc90a5af2bac345fe3 Mon Sep 17 00:00:00 2001
|
||||
From: Remi Collet <remi@remirepo.net>
|
||||
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";
|
||||
+ }
|
||||
}
|
||||
22
php-gettext-gettext-php72.patch
Normal file
22
php-gettext-gettext-php72.patch
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Adapted for 3.5.9 from
|
||||
|
||||
From 0134262c82747d9905598d3a0a07ed70049c1040 Mon Sep 17 00:00:00 2001
|
||||
From: oscarotero <oom@oscarotero.com>
|
||||
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) {
|
||||
|
|
@ -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 <remi@remirepo.net> - 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 <releng@fedoraproject.org> - 3.5.9-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue