summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-01-16 14:41:14 +0100
committerRemi Collet <remi@remirepo.net>2018-01-16 14:41:14 +0100
commit482ec23c2f5af6590ada07501258e02bd488bca0 (patch)
treecebd2fe2397e45c9e65bf82ecf089535c83a8c8e
import from Fedora
-rw-r--r--0000-don-t-check-Po-file-content-on-bigendian.patch42
-rw-r--r--php-gettext-gettext.spec133
2 files changed, 175 insertions, 0 deletions
diff --git a/0000-don-t-check-Po-file-content-on-bigendian.patch b/0000-don-t-check-Po-file-content-on-bigendian.patch
new file mode 100644
index 0000000..cae787f
--- /dev/null
+++ b/0000-don-t-check-Po-file-content-on-bigendian.patch
@@ -0,0 +1,42 @@
+From 73c0f65dad03f1beff820b415af12eba3f1f6601 Mon Sep 17 00:00:00 2001
+From: Randy Barlow <randy@electronsweatshop.com>
+Date: Mon, 15 Jan 2018 15:59:10 -0500
+Subject: [PATCH] don't check Po file content on bigendian
+
+Patch originally written by Remi Collet[0], and adapted for
+Gettext 4.4.3 by Randy Barlow.
+
+Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
+---
+ 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 @@ abstract class AbstractTest extends PHPUnit_Framework_TestCase
+ $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 @@ abstract class AbstractTest extends PHPUnit_Framework_TestCase
+ $this->assertSame($countTranslated, $translations->countTranslated());
+ $this->assertContent($translations, $file);
+ }
++
++ protected function isLittleEndian()
++ {
++ return pack("s", 0x3031) === "10";
++ }
+ }
+--
+2.15.1
+
diff --git a/php-gettext-gettext.spec b/php-gettext-gettext.spec
new file mode 100644
index 0000000..be193a5
--- /dev/null
+++ b/php-gettext-gettext.spec
@@ -0,0 +1,133 @@
+%global gh_commit 4f57f004635cc6311a20815ebfdc0757cb337113
+%global gh_short %(c=%{gh_commit}; echo ${c:0:8})
+%global gh_owner oscarotero
+%global gh_project Gettext
+
+
+Name: php-gettext-gettext
+Version: 4.4.3
+Release: 1%{?dist}
+BuildArch: noarch
+
+License: MIT
+Summary: PHP gettext manager
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# Upstream strips the tests from the tarball, so we have to generate it manually.
+Source0: %{gh_project}-%{version}.tar.gz
+
+# Skip some tests on bigendian as reference file are littleendian
+# https://github.com/oscarotero/Gettext/pull/159
+Patch0: 0000-don-t-check-Po-file-content-on-bigendian.patch
+
+BuildRequires: dos2unix
+BuildRequires: php-composer(gettext/languages) >= 2.3.0
+BuildRequires: php-composer(gettext/languages) < 3.0.0
+BuildRequires: phpunit
+
+Requires: php(language) >= 5.4.0
+Requires: php-date
+Requires: php-dom
+Requires: php-gettext
+Requires: php-json
+Requires: php-pcre
+Requires: php-simplexml
+Requires: php-spl
+Requires: php-tokenizer
+
+Requires: php-composer(gettext/languages) >= 2.3.0
+Requires: php-composer(gettext/languages) < 3.0.0
+
+Provides: php-composer(gettext/gettext) = %{version}
+
+
+%description
+Gettext is a PHP (5.3) library to import/export/edit gettext from PO,
+MO, PHP, JS files, etc.
+
+Autoloader: %{_datadir}/php/Gettext/autoload.php
+
+
+%prep
+%autosetup -p1 -n Gettext-%{version}
+
+# The documentation has the wrong newline codes
+dos2unix *.md
+
+sed -i "s:include_once.*:\ninclude_once '%{buildroot}/%{_datadir}/php/Gettext/autoload.php';:" tests/bootstrap.php
+
+
+%build
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/autoload.php
+<?php
+/**
+ * Autoloader for %{name} and its' dependencies
+ * (created by %{name}-%{version}-%{release}).
+ */
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('Gettext\\', __DIR__);
+
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/Gettext/Languages/autoloader.php'
+));
+
+AUTOLOAD
+
+
+%install
+install -d -p -m 0755 %{buildroot}/%{_datadir}/php
+install -d -p -m 0755 %{buildroot}/%{_datadir}/php/Gettext
+
+cp -ar src/* %{buildroot}/%{_datadir}/php/Gettext/
+
+
+%check
+# gettext has some optional dependencies that we are not integrating with at this time (we can later
+# if desired). Thus, we need to skip the tests on these integration points since they will fail
+# without the dependencies. There is an upstream issue about compatibility issues with Twig:
+# https://github.com/oscarotero/Gettext/issues/137
+phpunit --bootstrap tests/bootstrap.php --filter ^\(\(?!\(testBlade\|testTwig\)\).\)*$
+
+
+%files
+%license LICENSE
+%doc CHANGELOG.md
+%doc composer.json
+%doc CONTRIBUTING.md
+%doc README.md
+%{_datadir}/php/Gettext/*
+
+
+%changelog
+* Sun Dec 17 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 4.4.3-1
+- Update to 4.4.3 (#1450031).
+- https://github.com/oscarotero/Gettext/blob/v4.4.3/CHANGELOG.md
+
+* 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
+
+* Sun Apr 02 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-5
+- Depend on php-dom and php-simplexml.
+- Don't provide /usr/share/php/Gettext.
+
+* Wed Feb 01 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-4
+- Remove dependency on twig/twig.
+
+* Wed Feb 01 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-3
+- Create a Fedora autoloader.
+- Depend on twig/twig.
+- Install to /usr/share/php/Gettext instead of the Gettext subdir of that path.
+
+* Sun Jan 22 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-2
+- Use a git snapshot instead of a GitHub URL so that we can run the
+ tests (except for two that need optional dependencies).
+- require_once Gettext/Languages inside the autoloader.
+
+* Tue Jan 17 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-1
+- Initial release.