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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# remirepo/fedora spec file for php-nyholm-psr7
#
# Copyright (c) 2019-2022 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global bootstrap 0
# github
%global gh_commit f734364e38a876a23be4d906a2a089e1315be18a
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner Nyholm
%global gh_project psr7
# packagist
%global pk_vendor nyholm
%global pk_project %{gh_project}
%global major %nil
# namespace
%global php_home %{_datadir}/php
%global ns_vendor Nyholm
%global ns_project Psr7
%bcond_without tests
# php-http/psr7-integration-tests 1.1.0
%global psr7_integration_tests_commit b63c2f50c114a474086c6801aea58c0aa96f9b27
%global psr7_integration_tests_short %(c=%{psr7_integration_tests_commit}; echo ${c:0:7})
# http-interop/http-factory-tests 0.9.0
%global http_factory_tests_commit 642056c5360e8a74779cbf133afbc8aa2c174e15
%global http_factory_tests_short %(c=%{http_factory_tests_commit}; echo ${c:0:7})
Name: php-%{pk_vendor}-%{pk_project}%{major}
Version: 1.5.1
Release: 1%{?dist}
Summary: A fast PHP7 implementation of PSR-7
License: MIT
URL: https://github.com/%{gh_owner}/%{gh_project}
# git snapshot for skip .gitattributes
Source0: %{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
# Only used for tests and no version released (dev-master required)
Source2: https://github.com/php-http/psr7-integration-tests/archive/%{psr7_integration_tests_commit}/%{name}-integration-tests-%{psr7_integration_tests_short}.tar.gz
Source3: https://github.com/http-interop/http-factory-tests/archive/%{http_factory_tests_commit}/%{name}-factory-tests-%{http_factory_tests_short}.tar.gz
BuildArch: noarch
BuildRequires: php(language) >= 7.1
BuildRequires: php-pcre
BuildRequires: php-spl
%if %{with tests}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
BuildRequires: (php-composer(php-http/message-factory) >= 1.0 with php-composer(php-http/message-factory) < 2)
BuildRequires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2)
BuildRequires: (php-composer(symfony/error-handler) >= 4.4 with php-composer(symfony/error-handler) < 5)
# remirepo:6
%else
BuildRequires: php-psr-http-message
BuildRequires: php-http-message-factory
BuildRequires: php-psr-http-factory
BuildRequires: php-symfony4-error-handler >= 4.4
%endif
# from composer.json, "require-dev": {
# "phpunit/phpunit": "^7.5 || 8.5 || 9.4",
# "php-http/psr7-integration-tests": "^1.0",
# "http-interop/http-factory-tests": "^0.9",
# "symfony/error-handler": "^4.4"
%global phpunit %{_bindir}/phpunit9
BuildRequires: phpunit9 >= 9.4
%endif
# Autoloader
BuildRequires: php-fedora-autoloader-devel >= 1.0.0
# from composer.json, "require": {
# "php": ">=7.1",
# "psr/http-message": "^1.0",
# "php-http/message-factory": "^1.0",
# "psr/http-factory": "^1.0"
Requires: php(language) >= 7.1
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
Requires: (php-composer(php-http/message-factory) >= 1.0 with php-composer(php-http/message-factory) < 2)
Requires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2)
# remirepo:5
%else
Requires: php-psr-http-message
Requires: php-http-message-factory
Requires: php-psr-http-factory
%endif
# from phpcompatinfo report for version 1.1.0
Requires: php-pcre
Requires: php-spl
# Autoloader
Requires: php-composer(fedora/autoloader)
Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
Provides: php-composer(psr/http-message-implementation) = 1.0
Provides: php-composer(psr/http-factory-implementation) = 1.0
%description
A super lightweight PSR-7 implementation. Very strict and very fast..
Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit} -a2 -a3
%build
# Generate the Autoloader
phpab --template fedora --output src/autoload.php src
cat << 'EOF' | tee -a src/autoload.php
\Fedora\Autoloader\Dependencies::required([
'%{_datadir}/php/Psr/Http/Message/autoload.php',
'%{_datadir}/php/Http/Message/autoload.php',
'%{_datadir}/php/Psr/Http/Message/http-factory-autoload.php',
]);
EOF
# Generate test Autoloader
phpab --template fedora --output test-autoload.php \
psr7-integration-tests-%{psr7_integration_tests_commit} \
http-factory-tests-%{http_factory_tests_commit}
%install
mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{major}
%check
%if %{with tests}
mkdir vendor
cat <<EOF | tee vendor/autoload.php
<?php
require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
require_once '%{php_home}/Symfony4/Component/ErrorHandler/autoload.php';
require_once dirname(__DIR__) . '/test-autoload.php';
EOF
: Fix path
sed -e 's:./vendor/http-interop/http-factory-tests:http-factory-tests-%{http_factory_tests_commit}:' \
phpunit.xml.dist >phpunit.xml
: Run upstream test suite
: Ignore online tests
# TODO testCanDetachStream may fail on local build (extension conflicts ?)
# testIsNotSeekable|testIsNotWritable|testIsNotReadable|testRewindNotSeekable fail only in mock
ret=0
for cmdarg in "php %{phpunit}" php74 php80 php81 php82; do
if which $cmdarg; then
set $cmdarg
$1 ${2:-%{_bindir}/phpunit9} \
--filter '^((?!(testIsNotSeekable|testIsNotWritable|testIsNotReadable|testRewindNotSeekable|testCanDetachStream)).)*$' \
--verbose || ret=1
fi
done
exit $ret
%else
: bootstrap build with test suite disabled
%endif
%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{php_home}/%{ns_vendor}
%changelog
* Wed Jun 22 2022 Remi Collet <remi@remirepo.net> - 1.5.1-1
- update to 1.5.1
* Thu Feb 3 2022 Remi Collet <remi@remirepo.net> - 1.5.0-1
- update to 1.5.0
* Mon Jul 5 2021 Remi Collet <remi@remirepo.net> - 1.4.1-1
- update to 1.4.1
* Mon Mar 22 2021 Remi Collet <remi@remirepo.net> - 1.4.0-2
- fir for EL-7
* Wed Feb 24 2021 Remi Collet <remi@remirepo.net> - 1.4.0-1
- update to 1.4.0
* Fri Jan 29 2021 Remi Collet <remi@remirepo.net> - 1.3.2-2
- fix test path and FTBFS
* Mon Nov 16 2020 Remi Collet <remi@remirepo.net> - 1.3.2-1
- update to 1.3.2
- switch to phpunit9
* Mon May 25 2020 Remi Collet <remi@remirepo.net> - 1.3.0-1
- update to 1.3.0
* Fri Sep 6 2019 Remi Collet <remi@remirepo.net> - 1.2.1-1
- update to 1.2.1 (no change)
* Fri Aug 23 2019 Remi Collet <remi@remirepo.net> - 1.2.0-1
- update to 1.2.0
* Fri Jun 28 2019 Remi Collet <remi@remirepo.net> - 1.1.0-2
- License is MIT
* Fri Jun 28 2019 Remi Collet <remi@remirepo.net> - 1.1.0-1
- initial package, version 1.1.0
|