From 9fed0ef2b47d82401558bb6ce54b39b977549412 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 5 Jul 2019 15:13:48 +0200 Subject: - update to 4.0.0 - rename to php-sabre-dav4 - move to /usr/share/php/Sabre/DAV4 - raise dependency on PHP 7 - raise dependency on sabre/vobject 4.2.0 - raise dependency on sabre/event 5.0 - raise dependency on sabre/xml 2.0.1 - raise dependency on sabre/http 5.0 - raise dependency on sabre/uri 2.0 - switch to classmap autoloader --- composer.json | 26 +++---- php-sabre-dav4-autoload.patch | 33 ++++++++ php-sabre-dav4.spec | 172 ++++++++++++++++++++++++------------------ 3 files changed, 144 insertions(+), 87 deletions(-) create mode 100644 php-sabre-dav4-autoload.patch diff --git a/composer.json b/composer.json index fca0e07..226b2cb 100644 --- a/composer.json +++ b/composer.json @@ -14,12 +14,12 @@ } ], "require": { - "php": ">=5.5.0", - "sabre/vobject": "^4.1.0", - "sabre/event" : ">=2.0.0, <4.0.0", - "sabre/xml" : "^1.4.0", - "sabre/http" : "^4.2.1", - "sabre/uri" : "^1.0.1", + "php": ">=7.0.0", + "sabre/vobject": "^4.2.0-alpha1", + "sabre/event" : "^5.0", + "sabre/xml" : "^2.0.1", + "sabre/http" : "^5.0", + "sabre/uri" : "^2.0", "ext-dom": "*", "ext-pcre": "*", "ext-spl": "*", @@ -29,17 +29,18 @@ "ext-date" : "*", "ext-iconv" : "*", "lib-libxml" : ">=2.7.0", - "psr/log": "^1.0" + "psr/log": "^1.0", + "ext-json": "*" }, "require-dev" : { - "phpunit/phpunit" : "> 4.8, <6.0.0", + "phpunit/phpunit" : "^6", "evert/phpdoc-md" : "~0.1.0", - "sabre/cs" : "^1.0.0", "monolog/monolog": "^1.18" }, "suggest" : { "ext-curl" : "*", - "ext-pdo" : "*" + "ext-pdo" : "*", + "ext-imap": "*" }, "autoload": { "psr-4" : { @@ -59,10 +60,5 @@ ], "config" : { "bin-dir" : "./bin" - }, - "extra" : { - "branch-alias": { - "dev-master": "3.1.0-dev" - } } } diff --git a/php-sabre-dav4-autoload.patch b/php-sabre-dav4-autoload.patch new file mode 100644 index 0000000..9cdafef --- /dev/null +++ b/php-sabre-dav4-autoload.patch @@ -0,0 +1,33 @@ +diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php +--- ./tests/bootstrap.php.rpm 2019-07-05 14:29:48.486775637 +0200 ++++ ./tests/bootstrap.php 2019-07-05 14:32:02.171555393 +0200 +@@ -2,15 +2,11 @@ + + declare(strict_types=1); + +-set_include_path(__DIR__.'/../lib/'.PATH_SEPARATOR.__DIR__.PATH_SEPARATOR.get_include_path()); +- +-$autoLoader = include __DIR__.'/../vendor/autoload.php'; ++require '@BUILDROOT@/usr/share/php/Sabre/DAV4/autoload.php'; ++require '/usr/share/php/Monolog/autoload.php'; + + // SabreDAV tests auto loading +-$autoLoader->add('Sabre\\', __DIR__); +-// VObject tests auto loading +-$autoLoader->addPsr4('Sabre\\VObject\\', __DIR__.'/../vendor/sabre/vobject/tests/VObject'); +-$autoLoader->addPsr4('Sabre\\Xml\\', __DIR__.'/../vendor/sabre/xml/tests/Sabre/Xml'); ++\Fedora\Autoloader\Autoload::addPsr0('Sabre\\', __DIR__); + + date_default_timezone_set('UTC'); + +@@ -30,8 +26,8 @@ foreach ($environmentVars as $var) { + $config = [ + 'SABRE_TEMPDIR' => dirname(__FILE__).'/temp/', + 'SABRE_HASSQLITE' => in_array('sqlite', PDO::getAvailableDrivers()), +- 'SABRE_HASMYSQL' => in_array('mysql', PDO::getAvailableDrivers()), +- 'SABRE_HASPGSQL' => in_array('pgsql', PDO::getAvailableDrivers()), ++ 'SABRE_HASMYSQL' => false, ++ 'SABRE_HASPGSQL' => false, + 'SABRE_MYSQLDSN' => 'mysql:host=127.0.0.1;dbname=sabredav_test', + 'SABRE_MYSQLUSER' => 'sabredav', + 'SABRE_MYSQLPASS' => '', diff --git a/php-sabre-dav4.spec b/php-sabre-dav4.spec index 220592b..85e1bfd 100644 --- a/php-sabre-dav4.spec +++ b/php-sabre-dav4.spec @@ -1,4 +1,4 @@ -# remirepo/fedora spec file for php-sabre-dav +# remirepo/fedora spec file for php-sabre-dav4 # # Copyright (c) 2013-2019 Remi Collet # License: CC-BY-SA @@ -6,56 +6,53 @@ # # Please, preserve the changelog entries # -%global gh_commit a9780ce4f35560ecbd0af524ad32d9d2c8954b80 +# Github +%global gh_commit a4959bf2b9b175aef6fd91c9006b1ca7a56f9bb0 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner sabre-io %global gh_project dav -%if 0%{?rhel} == 5 -%global with_tests 0%{?_with_tests:1} -%else +# Packagist +%global pk_vendor sabre +%global pk_project %{gh_project} +# Namespace +%global ns_vendor Sabre +%global ns_project DAV +%global major 4 %global with_tests 0%{!?_without_tests:1} -%endif -Name: php-sabre-%{gh_project} +Name: php-%{pk_vendor}-%{pk_project}%{major} Summary: WebDAV Framework for PHP -Version: 3.2.3 -Release: 3%{?dist} +Version: 4.0.0 +Release: 1%{?dist} URL: https://github.com/%{gh_owner}/%{gh_project} License: BSD 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 -# For PHP 7.3 -Patch2: https://github.com/sabre-io/dav/commit/5eb5d74514230b11c80b67c7e147242757ccc660.patch BuildArch: noarch %if %{with_tests} -BuildRequires: php(language) >= 5.5 +BuildRequires: php(language) >= 7.0 # 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(sabre/vobject) >= 4.2 with php-composer(sabre/vobject) < 5) +BuildRequires: (php-composer(sabre/event) >= 5.0 with php-composer(sabre/event) < 6) +BuildRequires: (php-composer(sabre/xml) >= 2.0.1 with php-composer(sabre/xml) < 3) +BuildRequires: (php-composer(sabre/http) >= 5.0 with php-composer(sabre/http) < 6) +BuildRequires: (php-composer(sabre/uri) >= 2.0 with php-composer(sabre/uri) < 3) 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 +# remirepo:9 %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-sabre-vobject4 >= 4.2 +BuildRequires: php-sabre-event5 >= 5.0 +BuildRequires: php-sabre-xml2 >= 2.0.1 +BuildRequires: php-sabre-http5 >= 5.0 +BuildRequires: php-sabre-uri2 >= 2.0 BuildRequires: php-PsrLog >= 1.0.1 -BuildRequires: php-phpunit-PHPUnit >= 4.8 BuildRequires: php-Monolog >= 1.18 %endif BuildRequires: php-dom @@ -69,25 +66,25 @@ BuildRequires: php-iconv BuildRequires: php-libxml BuildRequires: php-curl BuildRequires: php-pdo +BuildRequires: php-json # From composer.json, "require-dev" : { -# "phpunit/phpunit" : "> 4.8, <6.0.0", +# "phpunit/phpunit" : "^6", # "evert/phpdoc-md" : "~0.1.0", # "squizlabs/php_codesniffer": "~1.5.3" -# "sabre/cs" : "^1.0.0", # "monolog/monolog": "^1.18" - +BuildRequires: phpunit6 +%endif # Autoloader -BuildRequires: php-composer(fedora/autoloader) +BuildRequires: php-fedora-autoloader-devel BuildRequires: php-pdo_sqlite -%endif # From composer.json, "require": { -# "php": ">=5.5.0", -# "sabre/vobject": "^4.1.0", -# "sabre/event" : ">=2.0.0, <4.0.0", -# "sabre/xml" : "^1.4.0", -# "sabre/http" : "^4.2.1", -# "sabre/uri" : "^1.0.1", +# "php": ">=7.0.0", +# "sabre/vobject": "^4.2.0-alpha1", +# "sabre/event" : "^5.0", +# "sabre/xml" : "^2.0.1", +# "sabre/http" : "^5.0", +# "sabre/uri" : "^2.0", # "ext-dom": "*", # "ext-pcre": "*", # "ext-spl": "*", @@ -97,23 +94,24 @@ BuildRequires: php-pdo_sqlite # "ext-date" : "*", # "ext-iconv" : "*", # "lib-libxml" : ">=2.7.0", -# "psr/log": "^1.0" -Requires: php(language) >= 5.5 +# "psr/log": "^1.0", +# "ext-json": "*" +Requires: php(language) >= 7.0 # 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(sabre/vobject) >= 4.2 with php-composer(sabre/vobject) < 5) +Requires: (php-composer(sabre/event) >= 5.0 with php-composer(sabre/event) < 6) +Requires: (php-composer(sabre/xml) >= 2.0.1 with php-composer(sabre/xml) < 3) +Requires: (php-composer(sabre/http) >= 5.0.0 with php-composer(sabre/http) < 6) +Requires: (php-composer(sabre/uri) >= 2.0 with php-composer(sabre/uri) < 3) 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-sabre-vobject4 >= 4.2 +Requires: php-sabre-event5 >= 5.0 +Requires: php-sabre-xml2 >= 2.0.1 +Requires: php-sabre-http5 >= 5.0 +Requires: php-sabre-uri2 >= 2.0 Requires: php-PsrLog >= 1.0.1 %endif Requires: php-dom @@ -125,15 +123,20 @@ Requires: php-ctype Requires: php-date Requires: php-iconv Requires: php-libxml +Requires: php-json # From composer.json, "suggest" : { # "ext-curl" : "*", -# "ext-pdo" : "*" -Requires: php-curl -Requires: php-pdo +# "ext-pdo" : "*", +# "ext-imap": "*" +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 +Recommends: php-curl +Recommends: php-pdo +Recommends: php-imap +%endif # Autoloader Requires: php-composer(fedora/autoloader) -Provides: php-composer(sabre/dav) = %{version} +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} %description @@ -155,17 +158,33 @@ Feature list: * CardDAV (tested with OS/X addressbook, the iOS addressbook and Evolution). * Over 97% unittest code coverage. -Autoloader: %{_datadir}/php/Sabre/DAV/autoload.php +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 -b .rpm -%patch1 -p1 -%patch2 -p1 -cp %{SOURCE1} lib/DAV/autoload.php +: relocate +for dir in CalDAV CardDAV DAV DAVACL; do + mv lib/${dir} lib/${dir}%{major} +done + +: autoloader +phpab -t fedora -o lib/%{ns_project}%{major}/autoload.php lib +cat << 'EOF' | tee -a lib/%{ns_project}%{major}/autoload.php + +// Dependencies +\Fedora\Autoloader\Dependencies::required([ + '%{_datadir}/php/%{ns_vendor}/Event5/autoload.php', + '%{_datadir}/php/%{ns_vendor}/Xml2/autoload.php', + '%{_datadir}/php/%{ns_vendor}/Uri2/autoload.php', + '%{_datadir}/php/%{ns_vendor}/HTTP5/autoload.php', + '%{_datadir}/php/%{ns_vendor}/VObject4/autoload.php', + '%{_datadir}/php/Psr/Log/autoload.php', +]); +EOF # drop executable as only provided as doc chmod -x bin/* @@ -177,27 +196,24 @@ chmod -x bin/* %install # Install as a PSR-0 library -mkdir -p %{buildroot}%{_datadir}/php -cp -pr lib %{buildroot}%{_datadir}/php/Sabre +mkdir -p %{buildroot}%{_datadir}/php/ +cp -pr lib %{buildroot}%{_datadir}/php/%{ns_vendor} %check %if %{with_tests} -%if 0%{?rhel} == 5 -sed -e 's/testMove/SKIP_testMove/' \ - -i tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php -%endif - : Fix bootstrap cd tests sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php +# TODO testDeliverInsignificantRequest fails locally, not in mock + : Run upstream test suite against installed library ret=0 for cmd in php php71 php72 php73 php74; do if which $cmd; then - $cmd %{_bindir}/phpunit \ - --filter '^((?!(testRequireAuth)).)*$' \ + $cmd %{_bindir}/phpunit6 \ + --filter '^((?!(testDeliverInsignificantRequest)).)*$' \ || ret=1 fi done @@ -214,13 +230,25 @@ exit $ret %doc *md %doc composer.json %doc examples bin -%{_datadir}/php/Sabre/DAV -%{_datadir}/php/Sabre/DAVACL -%{_datadir}/php/Sabre/CalDAV -%{_datadir}/php/Sabre/CardDAV +%{_datadir}/php/%{ns_vendor}/DAV%{major} +%{_datadir}/php/%{ns_vendor}/DAVACL%{major} +%{_datadir}/php/%{ns_vendor}/CalDAV%{major} +%{_datadir}/php/%{ns_vendor}/CardDAV%{major} %changelog +* Fri Jul 5 2019 Remi Collet - 4.0.0-1 +- update to 4.0.0 +- rename to php-sabre-dav4 +- move to /usr/share/php/Sabre/DAV4 +- raise dependency on PHP 7 +- raise dependency on sabre/vobject 4.2.0 +- raise dependency on sabre/event 5.0 +- raise dependency on sabre/xml 2.0.1 +- raise dependency on sabre/http 5.0 +- raise dependency on sabre/uri 2.0 +- switch to classmap autoloader + * Mon Jul 1 2019 Remi Collet - 3.2.3-3 - change autoloader order to ensure same versions are used -- cgit