From db1f442de5fc36ec7e77023664c3f9d38264a6f9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 5 Jun 2018 15:44:57 +0200 Subject: use range dependencies on F27+ ignore 1 test failing with sabre/http 4.2.4 fix project URL --- .gitignore | 8 ++++ 1006.patch | 68 +++++++++++++++++++++++++++++++++ php-sabre-dav.spec | 108 +++++++++++++++++++++++++++++++---------------------- 3 files changed, 140 insertions(+), 44 deletions(-) create mode 100644 .gitignore create mode 100644 1006.patch 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/1006.patch b/1006.patch new file mode 100644 index 0000000..b20ebb0 --- /dev/null +++ b/1006.patch @@ -0,0 +1,68 @@ +From 89914212677c23e680a9de57b56801062aed0f3f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 6 Oct 2017 15:51:42 +0200 +Subject: [PATCH] fix "count(): Parameter must be an array or an object that + implements Countable" (7.2) + +--- + lib/DAVACL/Plugin.php | 2 +- + tests/Sabre/CalDAV/ICSExportPluginTest.php | 12 ++++++------ + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php +index a2aa118d70..a5c8ac5c20 100644 +--- a/lib/DAVACL/Plugin.php ++++ b/lib/DAVACL/Plugin.php +@@ -1400,7 +1400,7 @@ protected function expandProperties($path, array $requestedProperties, $depth) { + foreach ($requestedProperties as $propertyName => $childRequestedProperties) { + + // We're only traversing if sub-properties were requested +- if (count($childRequestedProperties) === 0) continue; ++ if (!is_array($childRequestedProperties) || count($childRequestedProperties) === 0) continue; + + // We only have to do the expansion if the property was found + // and it contains an href element. +diff --git a/tests/Sabre/CalDAV/ICSExportPluginTest.php b/tests/Sabre/CalDAV/ICSExportPluginTest.php +index 75412577e9..1df0dfac58 100644 +--- a/tests/Sabre/CalDAV/ICSExportPluginTest.php ++++ b/tests/Sabre/CalDAV/ICSExportPluginTest.php +@@ -212,8 +212,8 @@ function testFilterStartEnd() { + + $obj = VObject\Reader::read($response->getBody()); + +- $this->assertEquals(0, count($obj->VTIMEZONE)); +- $this->assertEquals(0, count($obj->VEVENT)); ++ $this->assertNull($obj->VTIMEZONE); ++ $this->assertNull($obj->VEVENT); + + } + +@@ -237,7 +237,7 @@ function testExpand() { + + $obj = VObject\Reader::read($response->getBody()); + +- $this->assertEquals(0, count($obj->VTIMEZONE)); ++ $this->assertNull($obj->VTIMEZONE); + $this->assertEquals(1, count($obj->VEVENT)); + + } +@@ -292,7 +292,7 @@ function testFilterComponentVEVENT() { + $obj = VObject\Reader::read($response->body); + $this->assertEquals(1, count($obj->VTIMEZONE)); + $this->assertEquals(1, count($obj->VEVENT)); +- $this->assertEquals(0, count($obj->VTODO)); ++ $this->assertNull($obj->VTODO); + + } + +@@ -307,8 +307,8 @@ function testFilterComponentVTODO() { + + $obj = VObject\Reader::read($response->body); + +- $this->assertEquals(0, count($obj->VTIMEZONE)); +- $this->assertEquals(0, count($obj->VEVENT)); ++ $this->assertNull($obj->VTIMEZONE); ++ $this->assertNull($obj->VEVENT); + $this->assertEquals(1, count($obj->VTODO)); + + } diff --git a/php-sabre-dav.spec b/php-sabre-dav.spec index 47d24fa..00bcc1d 100644 --- a/php-sabre-dav.spec +++ b/php-sabre-dav.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-sabre-dav # -# Copyright (c) 2013-2017 Remi Collet +# Copyright (c) 2013-2018 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -8,37 +8,54 @@ # %global gh_commit e987775e619728f12205606c9cc3ee565ffb1516 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner fruux -%global gh_project sabre-dav +%global gh_owner sabre-io +%global gh_project dav %if 0%{?rhel} == 5 %global with_tests 0%{?_with_tests:1} %else %global with_tests 0%{!?_without_tests:1} %endif -Name: php-%{gh_project} +Name: php-sabre-%{gh_project} Summary: WebDAV Framework for PHP Version: 3.2.2 -Release: 1%{?dist} +Release: 5%{?dist} URL: https://github.com/%{gh_owner}/%{gh_project} License: BSD -Group: Development/Libraries -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz Source1: %{name}-autoload.php # replace composer autoloader Patch0: %{name}-autoload.patch +# For PHP 7.2 +Patch1: https://patch-diff.githubusercontent.com/raw/fruux/sabre-dav/pull/1006.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch %if %{with_tests} BuildRequires: php(language) >= 5.5 -BuildRequires: php-composer(sabre/vobject) >= 4.1.0 -BuildRequires: php-composer(sabre/event) >= 2.0 -BuildRequires: php-composer(sabre/xml) >= 1.4.0 -BuildRequires: php-composer(sabre/http) >= 4.2.1 -BuildRequires: php-composer(sabre/uri) >= 1.0.1 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(sabre/vobject) >= 4.1.0 with php-composer(sabre/vobject) < 5) +BuildRequires: (php-composer(sabre/event) >= 2.0 with php-composer(sabre/event) < 3) +BuildRequires: (php-composer(sabre/xml) >= 1.4.0 with php-composer(sabre/xml) < 2) +BuildRequires: (php-composer(sabre/http) >= 4.2.1 with php-composer(sabre/http) < 5) +BuildRequires: (php-composer(sabre/uri) >= 1.0.1 with php-composer(sabre/uri) < 2) +BuildRequires: (php-composer(psr/log) >= 1.0.1 with php-composer(psr/log) < 2) +BuildRequires: (php-composer(psr/log) >= 1.0.1 with php-composer(psr/log) < 2) +BuildRequires: (php-composer(phpunit/phpunit) >= 4.8 with php-composer(phpunit/phpunit) < 6) +BuildRequires: (php-composer(monolog/monolog) >= 1.18 with php-composer(monolog/monolog) < 2) +# remirepo:10 +%else +BuildRequires: php-sabre-vobject4 >= 4.1.0 +BuildRequires: php-sabre-event >= 2.0 +BuildRequires: php-sabre-xml >= 1.4.0 +BuildRequires: php-sabre-http >= 4.2.1 +BuildRequires: php-sabre-uri >= 1.0.1 +BuildRequires: php-PsrLog >= 1.0.1 +BuildRequires: php-phpunit-PHPUnit >= 4.8 +BuildRequires: php-Monolog >= 1.18 +%endif BuildRequires: php-dom BuildRequires: php-pcre BuildRequires: php-spl @@ -48,7 +65,6 @@ BuildRequires: php-ctype BuildRequires: php-date BuildRequires: php-iconv BuildRequires: php-libxml -BuildRequires: php-composer(psr/log) >= 1.0.1 BuildRequires: php-curl BuildRequires: php-pdo # From composer.json, "require-dev" : { @@ -57,8 +73,6 @@ BuildRequires: php-pdo # "squizlabs/php_codesniffer": "~1.5.3" # "sabre/cs" : "^1.0.0", # "monolog/monolog": "^1.18" -BuildRequires: php-composer(phpunit/phpunit) >= 4.8 -BuildRequires: php-composer(monolog/monolog) >= 1.18 # Autoloader BuildRequires: php-composer(fedora/autoloader) @@ -82,17 +96,24 @@ BuildRequires: php-pdo_sqlite # "ext-iconv" : "*", # "lib-libxml" : ">=2.7.0", # "psr/log": "^1.0" -Requires: php(language) >= 5.4.1 -Requires: php-composer(sabre/vobject) >= 4.1.0 -Requires: php-composer(sabre/vobject) < 5 -Requires: php-composer(sabre/event) >= 2.0 -Requires: php-composer(sabre/event) < 3 -Requires: php-composer(sabre/xml) >= 1.4.0 -Requires: php-composer(sabre/xml) < 2 -Requires: php-composer(sabre/http) >= 4.2.1 -Requires: php-composer(sabre/http) < 5 -Requires: php-composer(sabre/uri) >= 1.0.1 -Requires: php-composer(sabre/uri) < 2 +Requires: php(language) >= 5.5 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(sabre/vobject) >= 4.1.0 with php-composer(sabre/vobject) < 5) +Requires: (php-composer(sabre/event) >= 2.0 with php-composer(sabre/event) < 3) +Requires: (php-composer(sabre/xml) >= 1.4.0 with php-composer(sabre/xml) < 2) +Requires: (php-composer(sabre/http) >= 4.2.1 with php-composer(sabre/http) < 5) +Requires: (php-composer(sabre/uri) >= 1.0.1 with php-composer(sabre/uri) < 2) +Requires: (php-composer(psr/log) >= 1.0.1 with php-composer(psr/log) < 2) +# remirepo:8 +%else +Requires: php-sabre-vobject4 >= 4.1.0 +Requires: php-sabre-event >= 2.0 +Requires: php-sabre-xml >= 1.4.0 +Requires: php-sabre-http >= 4.2.1 +Requires: php-sabre-uri >= 1.0.1 +Requires: php-PsrLog >= 1.0.1 +%endif Requires: php-dom Requires: php-pcre Requires: php-spl @@ -102,8 +123,6 @@ Requires: php-ctype Requires: php-date Requires: php-iconv Requires: php-libxml -Requires: php-composer(psr/log) >= 1.0.1 -Requires: php-composer(psr/log) < 2 # From composer.json, "suggest" : { # "ext-curl" : "*", # "ext-pdo" : "*" @@ -141,6 +160,7 @@ Autoloader: %{_datadir}/php/Sabre/DAV/autoload.php %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 -b .rpm +%patch1 -p1 cp %{SOURCE1} lib/DAV/autoload.php @@ -170,21 +190,14 @@ cd tests sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php : Run upstream test suite against installed library -# remirepo:11 -run=0 ret=0 -if which php56; then - php56 %{_bindir}/phpunit || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose -# remirepo:2 -fi +for cmd in php php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit \ + --filter '^((?!(testRequireAuth)).)*$' \ + || ret=1 + fi +done exit $ret %else : Skip upstream test suite @@ -192,7 +205,6 @@ exit $ret %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *md @@ -205,6 +217,14 @@ exit $ret %changelog +* Tue Jun 5 2018 Remi Collet - 3.2.2-5 +- use range dependencies on F27+ +- ignore 1 test failing with sabre/http 4.2.4 +- fix project URL + +* Fri Oct 6 2017 Remi Collet - 3.2.2-3 +- add patch for PHP 7.2 from https://github.com/fruux/sabre-dav/pull/1006 + * Wed Feb 15 2017 Remi Collet - 3.2.2-1 - update to 3.2.2 -- cgit