blob: cb513aecdee4f62ff2484b5f6c1f6061d276d1d1 (
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
207
208
209
210
|
# 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.1.2
%global github_commit 3cbc6ed222422a28400e470050f14928a153207e
%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
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.1.2)
# <none>
## Autoloader
BuildRequires: php-composer(symfony/class-loader)
%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.1.2)
# <none>
# 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}
: Create autoloader
cat <<'AUTOLOAD' | tee Goutte/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
*
* @return \Symfony\Component\ClassLoader\ClassLoader
*/
if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php';
}
$fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
$fedoraClassLoader->register();
}
$fedoraClassLoader->addPrefix('Goutte\\', dirname(__DIR__));
require_once '%{phpdir}/GuzzleHttp6/autoload.php';
require_once '%{phpdir}/Symfony/Component/BrowserKit/autoload.php';
require_once '%{phpdir}/Symfony/Component/CssSelector/autoload.php';
require_once '%{phpdir}/Symfony/Component/DomCrawler/autoload.php';
return $fedoraClassLoader;
AUTOLOAD
%build
# Empty build section, nothing required
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{phpdir}/Goutte
cp -p Goutte/{autoload,Client}.php %{buildroot}/%{phpdir}/Goutte/
%check
%if %{with_tests}
ret=0
run=0
if which php56; then
php56 %{_bindir}/phpunit --verbose \
--bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php || ret=1
run=1
fi
if which php71; then
php71 %{_bindir}/phpunit --verbose \
--bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php || ret=1
run=1
fi
if [ $run -eq 0 ]; then
%{_bindir}/phpunit --verbose \
--bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php
fi
exit $ret
%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
* 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
|