summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-11-23 15:55:53 +0100
committerRemi Collet <remi@remirepo.net>2017-11-23 15:55:53 +0100
commit64ff860869794d90b47912add7dece37933c4649 (patch)
treeb087dea941fd81e2f11b99212f00eb6b1527526d
parent35a24adadc73c367e3a535a284a3c372062842b4 (diff)
switch from zend-loader to fedora/autoloader
-rw-r--r--.gitignore8
-rw-r--r--33.patch69
-rw-r--r--php-zendframework-zend-json.spec69
3 files changed, 111 insertions, 35 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/33.patch b/33.patch
new file mode 100644
index 0000000..a24d9ab
--- /dev/null
+++ b/33.patch
@@ -0,0 +1,69 @@
+From a17d2a6e464247f5df5ff515d1f017404da78e8b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 23 Oct 2017 16:42:09 +0200
+Subject: [PATCH] fix for PHP 7.2, 'Object' is a reserved keyword
+
+---
+ test/JsonTest.php | 12 ++++++------
+ test/TestAsset/{Object.php => TestObject.php} | 2 +-
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+ rename test/TestAsset/{Object.php => TestObject.php} (97%)
+
+diff --git a/test/JsonTest.php b/test/JsonTest.php
+index e0c7d45d9..700271ea9 100644
+--- a/test/JsonTest.php
++++ b/test/JsonTest.php
+@@ -483,11 +483,11 @@ public function testZf4053()
+
+ public function testEncodeObject()
+ {
+- $actual = new TestAsset\Object();
++ $actual = new TestAsset\TestObject();
+ $encoded = Json\Encoder::encode($actual);
+ $decoded = Json\Decoder::decode($encoded, Json\Json::TYPE_OBJECT);
+
+- $this->assertAttributeEquals(TestAsset\Object::class, '__className', $decoded);
++ $this->assertAttributeEquals(TestAsset\TestObject::class, '__className', $decoded);
+ $this->assertAttributeEquals('bar', 'foo', $decoded);
+ $this->assertAttributeEquals('baz', 'bar', $decoded);
+ $this->assertFalse(isset($decoded->_foo));
+@@ -495,9 +495,9 @@ public function testEncodeObject()
+
+ public function testEncodeClass()
+ {
+- $encoded = Json\Encoder::encodeClass(TestAsset\Object::class);
++ $encoded = Json\Encoder::encodeClass(TestAsset\TestObject::class);
+
+- $this->assertContains("Class.create('ZendTest\\Json\\TestAsset\\Object'", $encoded);
++ $this->assertContains("Class.create('ZendTest\\Json\\TestAsset\\TestObject'", $encoded);
+ $this->assertContains("ZAjaxEngine.invokeRemoteMethod(this, 'foo'", $encoded);
+ $this->assertContains("ZAjaxEngine.invokeRemoteMethod(this, 'bar'", $encoded);
+ $this->assertNotContains("ZAjaxEngine.invokeRemoteMethod(this, 'baz'", $encoded);
+@@ -508,9 +508,9 @@ public function testEncodeClass()
+
+ public function testEncodeClasses()
+ {
+- $encoded = Json\Encoder::encodeClasses(['ZendTest\Json\TestAsset\Object', 'Zend\Json\Json']);
++ $encoded = Json\Encoder::encodeClasses(['ZendTest\Json\TestAsset\TestObject', 'Zend\Json\Json']);
+
+- $this->assertContains("Class.create('ZendTest\\Json\\TestAsset\\Object'", $encoded);
++ $this->assertContains("Class.create('ZendTest\\Json\\TestAsset\\TestObject'", $encoded);
+ $this->assertContains("Class.create('Zend\\Json\\Json'", $encoded);
+ }
+
+diff --git a/test/TestAsset/Object.php b/test/TestAsset/TestObject.php
+similarity index 97%
+rename from test/TestAsset/Object.php
+rename to test/TestAsset/TestObject.php
+index 5ee251254..22cad55b9 100644
+--- a/test/TestAsset/Object.php
++++ b/test/TestAsset/TestObject.php
+@@ -10,7 +10,7 @@
+ /**
+ * Test class for encoding classes.
+ */
+-class Object
++class TestObject
+ {
+ const FOO = 'bar';
+
diff --git a/php-zendframework-zend-json.spec b/php-zendframework-zend-json.spec
index 9e35946..5cc9d8b 100644
--- a/php-zendframework-zend-json.spec
+++ b/php-zendframework-zend-json.spec
@@ -21,7 +21,7 @@
Name: php-%{gh_owner}-%{gh_project}
Version: 3.0.0
-Release: 1%{?dist}
+Release: 5%{?dist}
Summary: Zend Framework %{library} component
Group: Development/Libraries
@@ -30,7 +30,8 @@ URL: https://zendframework.github.io/%{gh_project}/
Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+Patch0: https://patch-diff.githubusercontent.com/raw/zendframework/zend-json/pull/33.patch
+
BuildArch: noarch
# Tests
%if %{with_tests}
@@ -44,10 +45,10 @@ BuildRequires: php-spl
# "zendframework/zend-stdlib": "^2.7 || ^3.0",
# "squizlabs/php_codesniffer": "^2.3",
# "phpunit/PHPUnit": "~4.0"
-BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7
+BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7
BuildRequires: php-composer(phpunit/phpunit) >= 4.0
# Autoloader
-BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5
+BuildRequires: php-fedora-autoloader-devel
%endif
# From composer, "require": {
@@ -62,16 +63,19 @@ Suggests: php-composer(%{gh_owner}/zend-json-server)
Suggests: php-composer(%{gh_owner}/zend-xml2json)
%endif
%endif
-# From phpcompatinfo report for version 2.6.0
+# From phpcompatinfo report for version 3.0.0
Requires: php-json
Requires: php-mbstring
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
+# Autoloader
+Requires: php-composer(fedora/autoloader)
Obsoletes: php-ZendFramework2-%{library} < 2.5
Provides: php-ZendFramework2-%{library} = %{version}
Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
%description
@@ -83,17 +87,22 @@ Documentation: https://zendframework.github.io/%{gh_project}/
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1
mv LICENSE.md LICENSE
%build
-# Empty build section, nothing required
+phpab --template fedora --output src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+\Fedora\Autoloader\Dependencies::optional([
+ '%{php_home}/Zend/Json/Server/autoload.php',
+ '%{php_home}/Zend/Xml2Json/autoload.php',
+]);
+EOF
%install
-rm -rf %{buildroot}
-
mkdir -p %{buildroot}%{php_home}/Zend/
cp -pr src %{buildroot}%{php_home}/Zend/%{library}
@@ -103,43 +112,26 @@ cp -pr src %{buildroot}%{php_home}/Zend/%{library}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-require_once '%{php_home}/Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- 'ZendTest\\%{library}' => dirname(__DIR__).'/test/',
- 'Zend\\%{library}' => '%{buildroot}%{php_home}/Zend/%{library}'
-))));
-require_once '%{php_home}/Zend/autoload.php';
+require_once '%{buildroot}%{php_home}/Zend/%{library}/autoload.php';
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/Zend/Stdlib/autoload.php',
+]);
+\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\Json\\', dirname(__DIR__) . '/test');
EOF
-# remirepo:11
-run=0
ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1
- run=1
-fi
-if which php71; then
- php70 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} --verbose
-# remirepo:2
-fi
+for cmd in php php56 php70 php71 php72; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose || ret=1
+ fi
+done
exit $ret
%else
: Test suite disabled
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
@@ -148,6 +140,13 @@ rm -rf %{buildroot}
%changelog
+* Thu Nov 23 2017 Remi Collet <remi@remirepo.net> - 3.1.0-5
+- switch from zend-loader to fedora/autoloader
+
+* Mon Oct 23 2017 Remi Collet <remi@remirepo.net> - 3.0.0-4
+- fix FTBFS from Koschei, add patch for PHP 7.2 from
+ https://github.com/zendframework/zend-json/pull/33
+
* Wed Jun 29 2016 Remi Collet <remi@fedoraproject.org> - 3.0.0-1
- update to 3.0.0 for ZendFramework 3
- add optional dependencies on zend-json-server and zend-xml2json