From b80d61eba60f6e1eafe7a7cf1cb940783421ca19 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 13 Oct 2015 08:49:11 +0200 Subject: php-phpoffice-phpexcel: import from Fedora --- php-phpoffice-phpexcel-pr695-1-8-1-custom.patch | 26 +++ php-phpoffice-phpexcel.spec | 219 ++++++++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 php-phpoffice-phpexcel-pr695-1-8-1-custom.patch create mode 100644 php-phpoffice-phpexcel.spec diff --git a/php-phpoffice-phpexcel-pr695-1-8-1-custom.patch b/php-phpoffice-phpexcel-pr695-1-8-1-custom.patch new file mode 100644 index 0000000..2486dd7 --- /dev/null +++ b/php-phpoffice-phpexcel-pr695-1-8-1-custom.patch @@ -0,0 +1,26 @@ +--- unitTests/Classes/PHPExcel/Reader/XEEValidatorTest.php.ORIG 2015-10-08 14:24:46.586539987 -0400 ++++ unitTests/Classes/PHPExcel/Reader/XEEValidatorTest.php 2015-10-08 14:25:19.824561274 -0400 +@@ -26,9 +26,9 @@ + + public function providerInvalidXML() + { +- $tests = []; ++ $tests = array(); + foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) { +- $tests[] = [realpath($file), true]; ++ $tests[] = array(realpath($file), true); + } + return $tests; + } +@@ -45,9 +45,9 @@ + + public function providerValidXML() + { +- $tests = []; ++ $tests = array(); + foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) { +- $tests[] = [realpath($file), file_get_contents($file)]; ++ $tests[] = array(realpath($file), file_get_contents($file)); + } + return $tests; + } diff --git a/php-phpoffice-phpexcel.spec b/php-phpoffice-phpexcel.spec new file mode 100644 index 0000000..1d5119a --- /dev/null +++ b/php-phpoffice-phpexcel.spec @@ -0,0 +1,219 @@ +# +# Fedora spec file for php-phpoffice-phpexcel +# +# Copyright (c) 2015 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner PHPOffice +%global github_name PHPExcel +%global github_version 1.8.1 +%global github_commit 372c7cbb695a6f6f1e62649381aeaa37e7e70b32 + +%global composer_vendor phpoffice +%global composer_project phpexcel + +# php": ">=5.2.0" +%global php_min_ver 5.2.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{dist} +Summary: A pure PHP library for reading and writing spreadsheet files + +Group: Development/Libraries +# Everything is LGPLv2 except for PHPExcel/Shared/OLE* which are PHP +# See: +# * https://github.com/PHPOffice/PHPExcel/issues/364 +# * https://github.com/PHPOffice/PHPExcel/issues/407 +License: LGPLv2 and PHP +URL: http://phpoffice.github.io/phpexcel_features.html +Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# Fix test for PHP < 5.4 +# https://github.com/PHPOffice/PHPExcel/pull/695 +# NOTE: Custom patch for 1.8.1 because pull request patch does not apply cleanly +Patch0: %{name}-pr695-1-8-1-custom.patch + +BuildArch: noarch +# Tests +%if %{with_tests} +BuildRequires: php-composer(phpunit/phpunit) +# composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-gd +BuildRequires: php-mbstring +BuildRequires: php-pecl(zip) +BuildRequires: php-xml +BuildRequires: php-xmlwriter +# phpcompatinfo (computed from version 1.8.1) +BuildRequires: php-ctype +BuildRequires: php-date +BuildRequires: php-dom +BuildRequires: php-iconv +BuildRequires: php-libxml +BuildRequires: php-pcre +BuildRequires: php-pecl(igbinary) +BuildRequires: php-posix +BuildRequires: php-reflection +BuildRequires: php-simplexml +BuildRequires: php-spl +BuildRequires: php-sqlite3 +BuildRequires: php-xmlreader +BuildRequires: php-zlib +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +Requires: php-mbstring +Requires: php-xml +Requires: php-xmlwriter +# composer.json (optional) +Requires: php-gd +Requires: php-pecl(zip) +# phpcompatinfo (computed from version 1.8.1) +Requires: php-ctype +Requires: php-date +Requires: php-dom +Requires: php-iconv +Requires: php-libxml +Requires: php-pcre +Requires: php-pecl(igbinary) +Requires: php-posix +Requires: php-reflection +Requires: php-simplexml +Requires: php-spl +Requires: php-sqlite3 +Requires: php-xmlreader +Requires: php-zlib +# Unbundled +Requires: php-pclzip + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +# Bundled +# +# https://pear.php.net/package/OLE +# See: +# * https://github.com/PHPOffice/PHPExcel/issues/364 +# * https://github.com/PHPOffice/PHPExcel/issues/407 +Provides: bundled(php-pear-OLE) + +%description +Project providing a set of classes for the PHP programming language, which +allow you to write to and read from different spreadsheet file formats, like +Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice +Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's +OpenXML standard and PHP. + +Optional: +* APC (php-pecl-apc) +* Memcache (php-pecl-memcache) + + +%prep +%setup -qn %{github_name}-%{github_commit} + +%patch0 -p0 + +: Fix wrong-file-end-of-line-encoding +find Examples -type f -exec sed -i 's/\r$//' {} \; + +: Remove unneeded files +find . -name '\.git*' | xargs rm -f + +: Remove bundled pclzip +rm -rf Classes/PHPExcel/Shared/PCLZip + + + + +%build +# Empty build section, nothing required + + +%install +mkdir -p %{buildroot}%{phpdir} +cp -rp Classes/* %{buildroot}%{phpdir}/ + +: Symlink to system pclzip +ln -s %{phpdir}/pclzip %{buildroot}%{phpdir}/PHPExcel/Shared/PCLZip + +: Locales +for LOCALE in %{buildroot}%{phpdir}/PHPExcel/locale/* +do + LOCALE_LANG=`basename $LOCALE` + echo "%%lang(${LOCALE_LANG}) $LOCALE" +done | sed 's#%{buildroot}##' | tee %{name}.lang + +: Autoloader +ln -s ../PHPExcel.php %{buildroot}%{phpdir}/PHPExcel/autoload.php + + +%check +%if %{with_tests} +cd unitTests + +: Remove tests known to fail +rm -f \ + Classes/PHPExcel/Calculation/DateTimeTest.php \ + Classes/PHPExcel/Calculation/EngineeringTest.php \ + Classes/PHPExcel/Calculation/FinancialTest.php \ + Classes/PHPExcel/Calculation/LookupRefTest.php \ + Classes/PHPExcel/Calculation/MathTrigTest.php \ + Classes/PHPExcel/Calculation/MathTrigTest.php \ + Classes/PHPExcel/Calculation/TextDataTest.php \ + Classes/PHPExcel/Shared/DateTest.php \ + Classes/PHPExcel/Shared/PasswordHasherTest.php \ + Classes/PHPExcel/Shared/StringTest.php \ + Classes/PHPExcel/Style/NumberFormatTest.php testFormatValueWithMask \ + Classes/PHPExcel/Worksheet/AutoFilter/Column/RuleTest.php \ + Classes/PHPExcel/Worksheet/CellCollectionTest.php + +%{_bindir}/phpunit +%else +: Tests skipped +%endif + + +%files -f %{name}.lang +%{!?_licensedir:%global license %%doc} +%license license.md +%doc Examples +%doc changelog.txt +%doc composer.json + %{phpdir}/PHPExcel.php +%dir %{phpdir}/PHPExcel +%dir %{phpdir}/PHPExcel/locale + %{phpdir}/PHPExcel/*.php + %{phpdir}/PHPExcel/CachedObjectStorage + %{phpdir}/PHPExcel/CalcEngine + %{phpdir}/PHPExcel/Calculation + %{phpdir}/PHPExcel/Cell + %{phpdir}/PHPExcel/Chart + %{phpdir}/PHPExcel/Helper + %{phpdir}/PHPExcel/Reader + %{phpdir}/PHPExcel/RichText + %{phpdir}/PHPExcel/Shared + %{phpdir}/PHPExcel/Style + %{phpdir}/PHPExcel/Worksheet + %{phpdir}/PHPExcel/Writer + + +%changelog +* Sun Oct 11 2015 Shawn Iwinski - 1.8.1-1 +- Updated to 1.8.1 +- Spec cleanup + +* Thu May 29 2014 Shawn Iwinski - 1.8.0-1.20140526git4ab61ad +- Initial package -- cgit