blob: 4b02c9078297dd9e18e71f5f4804c4286cbac778 (
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
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
|
# remirepo spec file for php-goutte, from:
#
# Fedora spec file for php-goutte
#
# Copyright (c) 2014-2016 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#
%global github_owner FriendsOfPHP
%global github_name Goutte
%global github_version 3.2.0
%global github_commit 8cc89de5e71daf84051859616891d3320d88a9e8
%global composer_vendor fabpot
%global composer_project goutte
# "php": ">=5.5.0"
%global php_min_ver 5.5.0
# "guzzlehttp/guzzle": "^6.0"
%global guzzle_min_ver 6.0
%global guzzle_max_ver 7.0
# "symfony/browser-kit": "~2.1|~3.0"
# "symfony/css-selector": "~2.1|~3.0"
# "symfony/dom-crawler": "~2.1|~3.0"
# NOTE: Min version not 2.1 because autoloader required
%global symfony_min_ver 2.7.1
%global symfony_max_ver 4.0
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-goutte
Version: %{github_version}
Release: 1%{?github_release}%{?dist}
Summary: A simple PHP web scraper
Group: Development/Libraries
License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
# Fix tests after #246 was merged (header case normalization)
# https://patch-diff.githubusercontent.com/raw/FriendsOfPHP/Goutte/pull/290.patch
Patch0: %{name}-pull-request-290.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
BuildRequires: php-composer(phpunit/phpunit)
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(guzzlehttp/guzzle) < %{guzzle_max_ver}
BuildRequires: php-composer(guzzlehttp/guzzle) >= %{guzzle_min_ver}
BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver}
## phpcompatinfo (computed from version 3.2.0)
BuildRequires: php-reflection
## Autoloader
BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
Requires: php(language) >= %{php_min_ver}
Requires: php-composer(guzzlehttp/guzzle) < %{guzzle_max_ver}
Requires: php-composer(guzzlehttp/guzzle) >= %{guzzle_min_ver}
Requires: php-composer(symfony/browser-kit) < %{symfony_max_ver}
Requires: php-composer(symfony/browser-kit) >= %{symfony_min_ver}
Requires: php-composer(symfony/css-selector) < %{symfony_max_ver}
Requires: php-composer(symfony/css-selector) >= %{symfony_min_ver}
Requires: php-composer(symfony/dom-crawler) < %{symfony_max_ver}
Requires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver}
# phpcompatinfo (computed from version 3.2.0)
# <none>
# Autoloader
Requires: php-composer(fedora/autoloader)
# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
Goutte is a screen scraping and web crawling library for PHP.
Goutte provides a nice API to crawl websites and extract data
from the HTML/XML responses.
Autoloader: %{phpdir}/Goutte/autoload.php
%prep
%setup -qn %{github_name}-%{github_commit}
: Fix tests after #246 was merged (header case normalization)
%patch0 -p1
%build
: Create autoloader
cat <<'AUTOLOAD' | tee Goutte/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
*/
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Goutte\\', __DIR__);
\Fedora\Autoloader\Dependencies::required([
'%{phpdir}/GuzzleHttp6/autoload.php',
'%{phpdir}/Symfony/Component/BrowserKit/autoload.php',
'%{phpdir}/Symfony/Component/CssSelector/autoload.php',
'%{phpdir}/Symfony/Component/DomCrawler/autoload.php',
]);
AUTOLOAD
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{phpdir}/Goutte
cp -p Goutte/{autoload,Client}.php %{buildroot}/%{phpdir}/Goutte/
%check
%if %{with_tests}
BOOTSTRAP=%{buildroot}/%{phpdir}/Goutte/autoload.php
%{_bindir}/phpunit --verbose --bootstrap $BOOTSTRAP
: Upstream tests with SCLs if available
SCL_RETURN_CODE=0
for SCL in php56 php70 php71; do
if which $SCL; then
$SCL %{_bindir}/phpunit --verbose --bootstrap $BOOTSTRAP || SCL_RETURN_CODE=1
fi
done
exit $SCL_RETURN_CODE
%else
: Tests skipped
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.rst
%doc composer.json
%{phpdir}/Goutte
%changelog
* Fri Dec 30 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 3.2.0-1
- Updated to 3.2.0 (RHBZ #1395456)
- Use php-composer(fedora/autoloader)
- Run upstream tests with SCLs if they are available
* Sat Jul 09 2016 Shawn Iwinski <shawn@iwin.ski> - 3.1.2-1
- Update to 3.1.2 (RHBZ #1100719, 1289798)
* Sun Jun 12 2016 Shawn Iwinski <shawn@iwin.ski> - 2.0.4-1
- Update to 2.0.4
* Mon Mar 28 2016 Shawn Iwinski <shawn@iwin.ski> - 1.0.7-3
- Fixed Guzzle min version for autoloader
- Added "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" virtual provide
- Fixed \Goutte\Client::VERSION
- Added library version value and autoloader check
* Mon Nov 23 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.7-1
- Updated to 1.0.7
- Added spec file license header
- php-composer(*) dependencies
- Added php-composer(fabpot/goutte) virtual provide
- Added autoloader
* Sat May 17 2014 Remi Collet <remi@fedoraproject.org> 1.0.6-1
- backport 1.0.6 for remi repo
* Fri May 16 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.6-1
- Updated to 1.0.6
* Fri Feb 21 2014 Remi Collet <remi@fedoraproject.org> 1.0.5-1
- backport for remi repo
* Wed Feb 19 2014 Shawn Iwinski <shawn.iwinski@gmail.com> 1.0.5-1
- Updated to 1.0.5
- Conditional release dist
- Fixed %%files
* Mon Jan 27 2014 Shawn Iwinski <shawn.iwinski@gmail.com> 1.0.3-1.20140118gite83f8f9
- Initial package
|