diff options
| -rw-r--r-- | php-sabre-vobject.spec | 23 | ||||
| -rw-r--r-- | sabre-vobject-cmd.patch | 33 | 
2 files changed, 43 insertions, 13 deletions
diff --git a/php-sabre-vobject.spec b/php-sabre-vobject.spec index 3387bbc..9a87622 100644 --- a/php-sabre-vobject.spec +++ b/php-sabre-vobject.spec @@ -6,7 +6,7 @@  #  # Please, preserve the changelog entries  # -%global gh_commit    961546d71c332ab34ad1c5bba7f372c08b388dcf +%global gh_commit    e46d6855cfef23318e7c422cd08d36e344624675  %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})  %global gh_owner     fruux  %global gh_project   sabre-vobject @@ -14,8 +14,8 @@  Name:           php-%{gh_project}  Summary:        Library to parse and manipulate iCalendar and vCard objects -Version:        3.1.3 -Release:        2%{?dist} +Version:        2.1.3 +Release:        1%{?dist}  URL:            https://github.com/%{gh_owner}/%{gh_project}  Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz @@ -23,7 +23,7 @@ License:        BSD  Group:          Development/Libraries  # replace composer autloader by PSR-O trivial one -Patch0:         %{gh_project}-bin.patch +Patch0:         %{gh_project}-cmd.patch  BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)  BuildArch:      noarch @@ -35,9 +35,8 @@ BuildRequires:  php-pear(pear.phpunit.de/PHPUnit)  # From composer.json  Requires:       php(language) >= 5.3.1  Requires:       php-mbstring -# From phpcompatinfo report for version 3.1.3 +# From phpcompatinfo report for version 2.1.3  Requires:       php-date -Requires:       php-json  Requires:       php-pcre  Requires:       php-spl  Requires:       php-xml @@ -77,7 +76,9 @@ mkdir -p %{buildroot}%{_datadir}/php  cp -pr lib/Sabre %{buildroot}%{_datadir}/php/Sabre  # Install the command -install -Dpm 0755 bin/vobject %{buildroot}/%{_bindir}/vobject +install -Dpm 0755 bin/vobjectvalidate.php \ +         %{buildroot}/%{_bindir}/vobjectvalidate +  %check  %if %{with_tests} @@ -96,13 +97,9 @@ phpunit \  %defattr(-,root,root,-)  %doc ChangeLog composer.json LICENSE README.md  %{_datadir}/php/Sabre -%{_bindir}/vobject +%{_bindir}/vobjectvalidate  %changelog -* Tue Dec 31 2013 Remi Collet <remi@fedoraproject.org> - 3.1.3-2 -- improved autoloader patch to avoid issue when old -  version, from pear channel is installed - -* Tue Dec 31 2013 Remi Collet <remi@fedoraproject.org> - 3.1.3-1 +* Tue Dec 31 2013 Remi Collet <remi@fedoraproject.org> - 2.1.3-1  - Initial packaging
\ No newline at end of file diff --git a/sabre-vobject-cmd.patch b/sabre-vobject-cmd.patch new file mode 100644 index 0000000..8f03e54 --- /dev/null +++ b/sabre-vobject-cmd.patch @@ -0,0 +1,33 @@ +--- bin/vobjectvalidate.php.old	2013-12-31 17:24:11.000000000 +0100 ++++ bin/vobjectvalidate.php	2013-12-31 17:24:27.000000000 +0100 +@@ -1,21 +1,18 @@ +-#!/usr/bin/env php ++#!/usr/bin/php + <?php +  + namespace Sabre\VObject; +  +-// This sucks.. we have to try to find the composer autoloader. But chances +-// are, we can't find it this way. So we'll do our bestest +-$paths = array( +-    __DIR__ . '/../vendor/autoload.php',  // In case vobject is cloned directly +-    __DIR__ . '/../../../autoload.php',   // In case vobject is a composer dependency. +-); ++// Simple PSR-0 autoloader ++// dont rely on include path as pear directory ++// may contains old incompatible version +  +-foreach($paths as $path) { +-    if (file_exists($path)) { +-        include $path; +-        break; ++spl_autoload_register(function ($class) { ++    if (strpos($class, 'Sabre\\')===0) { ++        $file = '/usr/share/php/'.str_replace('\\', '/', $class).'.php'; ++        @include $file; +     } +-} ++}); +  + if (!class_exists('Sabre\\VObject\\Version')) { +     fwrite(STDERR, "Composer autoloader could not be properly loaded.\n");  | 
