summaryrefslogtreecommitdiffstats
path: root/php-mcnetic-zipstreamer.spec
blob: 40f64c7efc0c0e61d7879e98ed54ae2642ba7080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# remirepo/fedora spec file for php-mcnetic-zipstreamer
#
# Copyright (c) 2016-2017 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    e57c198486242476587d04844084adbe8330581d
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     McNetic
%global gh_project   PHPZipStreamer
%global with_tests   0%{!?_without_tests:1}
%global namespace    ZipStreamer

Name:           php-mcnetic-zipstreamer
Epoch:          1
Version:        1.0
Release:        1%{?dist}
Summary:        Stream zip files without i/o overhead

Group:          Development/Libraries
License:        GPLv3+
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  php-composer(theseer/autoload)
%if %{with_tests}
BuildRequires:  php(language) >= 5.3.0
BuildRequires:  php-date
BuildRequires:  php-hash
BuildRequires:  php-mbstring
BuildRequires:  php-pcre
BuildRequires:  php-spl
BuildRequires:  php-composer(phpunit/phpunit)
BuildRequires:  php-pecl(Xdebug)
BuildRequires:  php-pecl(pecl_http)
%endif

# From composer.json
#      "php": ">=5.3.0"
Requires:       php(language) >= 5.3.0
# From phpcompatinfo report for version0.7
Requires:       php-date
Requires:       php-hash
Requires:       php-mbstring
Requires:       php-spl
%if 0%{?fedora} > 21
# For compression
Recommends:     php-pecl(pecl_http)
%else
Requires:       php-pecl(pecl_http)
%endif

Provides:       php-composer(mcnetic/zipstreamer) = %{version}


%description
Simple Class to create zip files on the fly and stream directly to the
HTTP client as the content is added (without using temporary files).

Autoloader: %{_datadir}/php/%{namespace}/autoload.php


%prep
%setup -q -n %{gh_project}-%{gh_commit}


%build
%{_bindir}/phpab -o src/autoload.php src


%install
rm -rf     %{buildroot}
mkdir -p   %{buildroot}%{_datadir}/php
cp -pr src %{buildroot}%{_datadir}/php/%{namespace}


%check
%if %{with_tests}
: Ensure we use our autoloader
sed -e '/^ZipStreamer.php/d' -i test/*php

if [ $(php -r "echo PHP_INT_SIZE;") -eq 8 ]; then
  : Run test suite
  %{_bindir}/phpunit \
    --bootstrap %{buildroot}%{_datadir}/php/%{namespace}/autoload.php \
    --configuration test/phpunit.xml
else
  : Ignore test suite as Count64 do not support 32 bits overflow
fi

if which php70; then
  : Run test suite with PHP 7.0 SCL
  php70 %{_bindir}/phpunit \
    --bootstrap %{buildroot}%{_datadir}/php/%{namespace}/autoload.php \
    --configuration test/phpunit.xml
fi
%else
: Test suite disabled
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc *.md
%doc composer.json
%{_datadir}/php/%{namespace}


%changelog
* Sat Apr  2 2016 Remi Collet <remi@fedoraproject.org> - 1:1.0.1
- update to 1.0

* Wed Jan 20 2016 Remi Collet <remi@fedoraproject.org> - 1:0.7.1
- fix version, from review #1296901

* Fri Jan  8 2016 Remi Collet <remi@fedoraproject.org> - 1.7.2
- ensure we use our autoloader during the test suite
- ignore test suite on 32bits build

* Fri Jan  8 2016 Remi Collet <remi@fedoraproject.org> - 1.7.1
- initial package
- add patch to workaround error raised by pecl_http
  see https://github.com/McNetic/PHPZipStreamer/issues/29