summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-03-16 12:56:26 +0100
committerRemi Collet <fedora@famillecollet.com>2016-03-16 12:56:26 +0100
commitbe9c16ffae597f03473b6eb1c7b6771731f50c60 (patch)
treef87f080ece9bd39f18d5b961486d4ea94c02cbb3
parent842aa910e681965ee24b173af82df7a60ecedc4f (diff)
php-sabre-vobject: 3.4.6 (synced with Fedora)
-rw-r--r--php-sabre-vobject-autoload.php18
-rw-r--r--php-sabre-vobject.spec74
-rw-r--r--sabre-vobject-bin.patch80
3 files changed, 112 insertions, 60 deletions
diff --git a/php-sabre-vobject-autoload.php b/php-sabre-vobject-autoload.php
new file mode 100644
index 0000000..aa94f26
--- /dev/null
+++ b/php-sabre-vobject-autoload.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Autoloader for sabre/vobject and its dependencies
+ */
+
+$vendorDir = '/usr/share/php';
+
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+
+$fedoraClassLoader->addPrefix('Sabre\\VObject\\', dirname(dirname(__DIR__)));
diff --git a/php-sabre-vobject.spec b/php-sabre-vobject.spec
index 6ab3783..c974b13 100644
--- a/php-sabre-vobject.spec
+++ b/php-sabre-vobject.spec
@@ -1,4 +1,4 @@
-# Spec file for php-sabre-vobject
+# remirepo/fedora spec file for php-sabre-vobject
#
# Copyright (c) 2013-2016 Remi Collet
# License: CC-BY-SA
@@ -6,7 +6,7 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit a064447d7e76dc564ffcf3a830057c2f0c17bfbd
+%global gh_commit c2606c5985aabd14f37d444e494d72f67b71d290
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner fruux
%global gh_project sabre-vobject
@@ -14,22 +14,31 @@
Name: php-%{gh_project}
Summary: Library to parse and manipulate iCalendar and vCard objects
-Version: 3.2.4
+Version: 3.4.6
Release: 1%{?dist}
URL: http://sabre.io/vobject/
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
License: BSD
Group: Development/Libraries
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
+Source1: %{name}-autoload.php
-# replace composer autloader by PSR-O trivial one
+# replace composer autloader
Patch0: %{gh_project}-bin.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
%if %{with_tests}
+BuildRequires: php-composer(phpunit/phpunit)
BuildRequires: php(language) >= 5.3.1
-BuildRequires: php-phpunit-PHPUnit
+BuildRequires: php-mbstring
+BuildRequires: php-date
+BuildRequires: php-json
+BuildRequires: php-pcre
+BuildRequires: php-spl
+BuildRequires: php-xml
+# Autoloader
+BuildRequires: php-composer(symfony/class-loader)
%endif
# From composer.json
@@ -37,12 +46,15 @@ BuildRequires: php-phpunit-PHPUnit
# "ext-mbstring" : "*"
Requires: php(language) >= 5.3.1
Requires: php-mbstring
-# From phpcompatinfo report for version 3.2.0
+# From phpcompatinfo report for version 3.4.5
+Requires: php-cli
Requires: php-date
Requires: php-json
Requires: php-pcre
Requires: php-spl
Requires: php-xml
+# Autoloader
+Requires: php-composer(symfony/class-loader)
Provides: php-composer(sabre/vobject) = %{version}
@@ -59,18 +71,8 @@ years. The VObject library has 100% unittest coverage.
%prep
%setup -q -n %{gh_project}-%{gh_commit}
-%patch0 -p0 -b .psr0
-
-: Create trivial PSR0 autoloader for tests
-cat <<EOF | tee psr0.php
-<?php
-spl_autoload_register(function (\$class) {
- \$file = str_replace('\\\\', '/', \$class).'.php';
- @include \$file;
-});
-define('SABRE_TEMPDIR', __DIR__ . '/temp/');
-mkdir(SABRE_TEMPDIR);
-EOF
+%patch0 -p1 -b .rpm
+cp %{SOURCE1} lib/autoload.php
%build
@@ -79,22 +81,29 @@ EOF
%install
# Install as a PSR-0 library
-mkdir -p %{buildroot}%{_datadir}/php
-cp -pr lib/Sabre %{buildroot}%{_datadir}/php/Sabre
+mkdir -p %{buildroot}%{_datadir}/php/Sabre
+cp -pr lib %{buildroot}%{_datadir}/php/Sabre/VObject
-# Install the command
+# Install the commands
install -Dpm 0755 bin/vobject \
%{buildroot}/%{_bindir}/vobject
+install -Dpm 0755 bin/generate_vcards \
+ %{buildroot}/%{_bindir}/generate_vcards
%check
%if %{with_tests}
-: Run upstream test suite against installed library
+: Fix bootstrap
cd tests
-phpunit \
- --bootstrap=../psr0.php \
- --include-path=%{buildroot}%{_datadir}/php \
- -d date.timezone=UTC
+sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php
+
+: Run upstream test suite against installed library
+%{_bindir}/phpunit --verbose
+
+if which php70; then
+ rm VObject/Property/FloatTest.php
+ php70 %{_bindir}/phpunit --verbose || : ignore test results
+fi
%else
: Skip upstream test suite
%endif
@@ -102,12 +111,19 @@ phpunit \
%files
%defattr(-,root,root,-)
-%doc ChangeLog.md composer.json LICENSE README.md
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *md
+%doc composer.json
%{_datadir}/php/Sabre
%{_bindir}/vobject
+%{_bindir}/generate_vcards
%changelog
+* Wed Feb 24 2016 Remi Collet <remi@fedoraproject.org> - 3.4.6-1
+- update to 3.4.6
+
* Wed Jul 16 2014 Remi Collet <remi@fedoraproject.org> - 3.2.4-1
- update to 3.2.4
@@ -129,4 +145,4 @@ phpunit \
- update to 3.1.3
* Tue Dec 31 2013 Remi Collet <remi@fedoraproject.org> - 2.1.3-1
-- Initial packaging \ No newline at end of file
+- Initial packaging
diff --git a/sabre-vobject-bin.patch b/sabre-vobject-bin.patch
index 3514fcf..60b7f9a 100644
--- a/sabre-vobject-bin.patch
+++ b/sabre-vobject-bin.patch
@@ -1,38 +1,56 @@
-diff -up bin/vobject.psr0 bin/vobject
---- bin/vobject.psr0 2014-04-06 09:55:39.145932310 +0200
-+++ bin/vobject 2014-04-06 09:59:04.416686079 +0200
-@@ -1,24 +1,21 @@
--#!/usr/bin/env php
-+#!/usr/bin/php
- <?php
-
- namespace Sabre\VObject;
+diff -up ./bin/generate_vcards.rpm ./bin/generate_vcards
+--- ./bin/generate_vcards.rpm 2015-07-20 15:36:00.466610252 +0200
++++ ./bin/generate_vcards 2015-07-20 15:36:24.434738474 +0200
+@@ -6,8 +6,7 @@ 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.
++ '/usr/share/php/Sabre/VObject/autoload.php', // RPM installation
+ );
--// 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(
+ foreach($paths as $path) {
+diff -up ./bin/vobject.rpm ./bin/vobject
+--- ./bin/vobject.rpm 2015-07-20 15:34:43.499198500 +0200
++++ ./bin/vobject 2015-07-20 15:36:20.645718203 +0200
+@@ -6,8 +6,7 @@ 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
++ '/usr/share/php/Sabre/VObject/autoload.php', // RPM installation
+ );
--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;
- }
--}
-+});
+ foreach($paths as $path) {
+diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
+--- ./tests/bootstrap.php.rpm 2015-07-20 15:36:46.774857986 +0200
++++ ./tests/bootstrap.php 2015-07-20 15:40:20.007998716 +0200
+@@ -3,8 +3,7 @@
+ date_default_timezone_set('UTC');
- if (!class_exists('Sabre\\VObject\\Version')) {
-- fwrite(STDERR, "Composer autoloader could not be loaded.\n");
-+ fwrite(STDERR, "Autoloader could not be properly loaded.\n");
- die(1);
+ $try = array(
+- __DIR__ . '/../vendor/autoload.php',
+- __DIR__ . '/../../../autoload.php',
++ '@BUILDROOT@/usr/share/php/Sabre/VObject/autoload.php', // RPM installation
+ );
+
+ foreach($try as $path) {
+@@ -14,8 +13,6 @@ foreach($try as $path) {
+ }
}
+-$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/VObject');
+-
+ if (!defined('SABRE_TEMPDIR')) {
+ define('SABRE_TEMPDIR', __DIR__ . '/temp/');
+ }
+@@ -23,3 +21,7 @@ if (!defined('SABRE_TEMPDIR')) {
+ if (!file_exists(SABRE_TEMPDIR)) {
+ mkdir(SABRE_TEMPDIR);
+ }
++
++// Not catched by autoloader
++require_once __DIR__ . '/VObject/TestCase.php';
++require_once __DIR__ . '/VObject/ITip/BrokerTester.php';