summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-10-16 15:28:39 +0200
committerRemi Collet <fedora@famillecollet.com>2015-10-16 15:28:39 +0200
commit4c35aa8af40d2d1249c8fca6cbdabddb11c80d3c (patch)
treecfb1362fa1d6105ac79de52e7f89e789a03ac102
parentdd33a015445d2b8be8c977a4bc6aa65958b1ba3f (diff)
php-swift-Swift: 5.4.1HEADmaster
-rw-r--r--php-swift-Swift.spec127
-rw-r--r--swiftmailer-upstream.patch80
2 files changed, 165 insertions, 42 deletions
diff --git a/php-swift-Swift.spec b/php-swift-Swift.spec
index c8527c0..3dd735b 100644
--- a/php-swift-Swift.spec
+++ b/php-swift-Swift.spec
@@ -1,27 +1,48 @@
-%{!?__pear: %global __pear %{_bindir}/pear}
-%global pear_name Swift
+# remirepo spec file for php-swift-Swift, from
+#
+# Fedora spec file for php-swift-Swift
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+%global gh_commit 0697e6aa65c83edf97bb0f23d8763f94e3f11421
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner swiftmailer
+%global gh_project swiftmailer
+%global with_tests 0%{!?_without_tests:1}
+%global php_home %{_datadir}/php
Name: php-swift-Swift
-Version: 5.1.0
+Version: 5.4.1
Release: 1%{?dist}
Summary: Free Feature-rich PHP Mailer
Group: Development/Libraries
License: MIT
URL: http://www.swiftmailer.org/
-Source0: http://pear.swiftmailer.org/get/Swift-%{version}.tgz
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
+
+# Upstream patches
+# Fix test bootstrap and disable gc to avoid segfault
+Patch0: %{gh_project}-upstream.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-BuildRequires: php-channel(pear.swiftmailer.org)
-BuildRequires: php-pear(PEAR)
-
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-Requires: php(language) >= 5.2.4
-Requires: php-pear(PEAR)
-Requires: php-channel(pear.swiftmailer.org)
-# from phpcompatinfo report on version 5.1.0
+%if %{with_tests}
+BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: php-composer(theseer/autoload)
+# From composer.json, "require-dev": {
+# "mockery/mockery": "~0.9.1,<0.9.4"
+BuildRequires: php-composer(mockery/mockery) >= 0.9.1
+BuildRequires: php-composer(mockery/mockery) < 0.9.4
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.3.3"
+Requires: php(language) >= 5.3.3
+# from phpcompatinfo report on version 5.4.1
Requires: php-bcmath
Requires: php-ctype
Requires: php-date
@@ -33,47 +54,62 @@ Requires: php-mhash
Requires: php-openssl
Requires: php-pcre
Requires: php-reflection
+Requires: php-simplexml
Requires: php-spl
-# optional but not yet available https://github.com/xdecock/php-opendkim
+# Single package in this channel
+Obsoletes: php-channel-swift <= 1.3
+
+Provides: php-composer(swiftmailer/swiftmailer) = %{version}
+Provides: php-pear(pear.swiftmailer.org/Swift) = %{version}
-Provides: php-pear(pear.swiftmailer.org/%{pear_name}) = %{version}
%description
Swift Mailer integrates into any web app written in PHP 5, offering a
flexible and elegant object-oriented approach to sending emails with
a multitude of features.
+To use this library, you just have to add, in your project:
+ require_once '%{php_home}/Swift/swift_required.php';
+
+
%prep
-%setup -q -c
-cd %{pear_name}-%{version}
-mv ../package.xml %{pear_name}.xml
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p1
+
+mv lib/swift_required_pear.php lib/swift_required.php
+rm lib/swiftmailer_generate_mimes_config.php
%build
-cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.
%install
rm -rf %{buildroot}
-cd %{pear_name}-%{version}
-%{__pear} install --nodeps --packagingroot %{buildroot} %{pear_name}.xml
-# Clean up unnecessary files
-rm -rf %{buildroot}%{pear_metadir}/.??*
+mkdir -p %{buildroot}/%{php_home}/Swift
+cp -p lib/*.php %{buildroot}/%{php_home}/Swift/
+cp -pr lib/classes/* %{buildroot}/%{php_home}/Swift/
+cp -pr lib/dependency_maps %{buildroot}/%{php_home}/Swift/
-mkdir -p %{buildroot}%{pear_phpdir}/tmp
-mv %{buildroot}%{pear_phpdir}/*.php \
- %{buildroot}%{pear_phpdir}/Swift \
- %{buildroot}%{pear_phpdir}/dependency_maps \
- %{buildroot}%{pear_phpdir}/tmp
-mv %{buildroot}%{pear_phpdir}/tmp %{buildroot}%{pear_phpdir}/Swift
-# Install XML package description
-mkdir -p %{buildroot}%{pear_xmldir}
-install -pm 644 %{pear_name}.xml %{buildroot}%{pear_xmldir}
+%check
+%if %{with_tests}
+: Use installed tree and autoloader
+mkdir vendor
+%{_bindir}/phpab --output vendor/autoload.php tests
+cat << 'EOF' | tee -a vendor/autoload.php
+require_once '%{buildroot}/%{php_home}/Swift/swift_required.php';
+require_once '/usr/share/php/Mockery/autoload.php';
+EOF
+
+: Run upstream test suite
+%{_bindir}/phpunit --exclude smoke --verbose
+%endif
+
%clean
@@ -81,23 +117,30 @@ rm -rf %{buildroot}
%post
-%{__pear} install --nodeps --soft --force --register-only \
- %{pear_xmldir}/%{pear_name}.xml >/dev/null || :
-
-%postun
-if [ $1 -eq 0 ] ; then
- %{__pear} uninstall --nodeps --ignore-errors --register-only \
- %{pear_name} >/dev/null || :
+if [ -x %{_bindir}/pear ]; then
+ %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
+ pear.swiftmailer.org/Swift >/dev/null || :
fi
%files
%defattr(-,root,root,-)
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{pear_name}.xml
-%{pear_phpdir}/%{pear_name}
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc CHANGES README
+%doc doc
+%doc composer.json
+%{php_home}/Swift
+
%changelog
+* Fri Oct 16 2015 Remi Collet <remi@fedoraproject.org> - 5.4.1-1
+- update to 5.4.1
+- sources from github, pear channel is dead
+- provide php-composer(swiftmailer/swiftmailer)
+- add BR on mockery/mockery
+- fix license handling
+
* Tue Mar 18 2014 Remi Collet <remi@fedoraproject.org> - 5.1.0-1
- Update to 5.1.0 (stable)
- add dependencies on bcmath, mcrypt and mhash
diff --git a/swiftmailer-upstream.patch b/swiftmailer-upstream.patch
new file mode 100644
index 0000000..68611ed
--- /dev/null
+++ b/swiftmailer-upstream.patch
@@ -0,0 +1,80 @@
+From 94a0f8bffb1f6832fe97e4c9c67c4852fe55e2a3 Mon Sep 17 00:00:00 2001
+From: Christian Schmidt <cs@blackwoodseven.com>
+Date: Thu, 25 Jun 2015 21:43:00 +0200
+Subject: [PATCH] Do not assume that require_once returns an object
+
+---
+ composer.json | 5 +++++
+ tests/bootstrap.php | 3 +--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/composer.json b/composer.json
+index a7b5e44..0549006 100644
+--- a/composer.json
++++ b/composer.json
+@@ -23,6 +23,11 @@
+ "autoload": {
+ "files": ["lib/swift_required.php"]
+ },
++ "autoload-dev": {
++ "psr-0": {
++ "Swift_": "tests/unit"
++ }
++ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.4-dev"
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index 9b169b3..55538bb 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -1,7 +1,6 @@
+ <?php
+
+-$autoloader = require_once dirname(__DIR__).'/vendor/autoload.php';
+-$autoloader->add('Swift_', __DIR__.'/unit');
++require_once dirname(__DIR__).'/vendor/autoload.php';
+
+ set_include_path(get_include_path().PATH_SEPARATOR.dirname(__DIR__).'/lib');
+
+From 5174336501b554dce18f304af74c4440d4b78c9d Mon Sep 17 00:00:00 2001
+From: Hugo Hamon <hugo.hamon@sensiolabs.com>
+Date: Sun, 23 Aug 2015 12:09:17 +0200
+Subject: [PATCH] Added PHP 5.6, PHP 7 and HHVM to the build matrix.
+
+---
+ .travis.yml | 22 +++++++++++-----------
+ phpunit.xml.dist | 2 +-
+ tests/bootstrap.php | 5 ++++-
+ 3 files changed, 16 insertions(+), 13 deletions(-)
+
+diff --git a/phpunit.xml.dist b/phpunit.xml.dist
+index 2420586..0d3e698 100644
+--- a/phpunit.xml.dist
++++ b/phpunit.xml.dist
+@@ -32,6 +32,6 @@
+ </testsuites>
+
+ <listeners>
+- <listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
++ <listener class="Mockery\Adapter\Phpunit\TestListener"/>
+ </listeners>
+ </phpunit>
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index 55538bb..34f56b5 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -2,9 +2,12 @@
+
+ require_once dirname(__DIR__).'/vendor/autoload.php';
+
++// Disable garbage collector to prevent segfaults
++gc_disable();
++
+ set_include_path(get_include_path().PATH_SEPARATOR.dirname(__DIR__).'/lib');
+
+-\Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
++Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
+
+ if (is_file(__DIR__.'/acceptance.conf.php')) {
+ require_once __DIR__.'/acceptance.conf.php';