blob: 8dc8e4a9521f19dea45111f293deba59514d3ccb (
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
|
Name: php-rmccue-requests
Version: 1.7.0
Release: 2%{?dist}
BuildArch: noarch
License: ISC and BSD
Summary: Requests for PHP is a humble HTTP request library
URL: https://github.com/rmccue/Requests
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# This is only needed to run the test suite.
Source1: https://github.com/RequestsPHP/test-server/archive/26334a7583c96ae1f966a5d88af9aafaf279f948/requests-tests-26334a75.tar.gz
BuildRequires: php-composer(fedora/autoloader)
BuildRequires: php-fedora-autoloader-devel
BuildRequires: php-zip
BuildRequires: phpunit
BuildRequires: procps-ng
Requires: php(language) >= 5.5.0
Requires: php-composer(fedora/autoloader)
Requires: php-curl
Requires: php-date
Requires: php-json
Requires: php-openssl
Requires: php-pcre
Requires: php-spl
Requires: php-zlib
Provides: php-composer(rmccue/requests) = %{version}
%description
Requests for PHP simplifies how you interact with other sites and takes
away all your worries.
Requests is a HTTP library written in PHP, for human beings. It is
roughly based on the API from the excellent Requests Python library.
Requests is ISC Licensed (similar to the new BSD license) and has no
dependencies, except for PHP 5.2+.
Despite PHP's use as a language for the web, its tools for sending HTTP
requests are severely lacking. cURL has an interesting API, to say the
least, and you can't always rely on it being available. Sockets provide
only low level access, and require you to build most of the HTTP
response parsing yourself.
We all have better things to do. That's why Requests was born.
%prep
%autosetup -n Requests-%{version}
tar xvf %{S:1}
# Remove the bundled CA list and use Fedora's
rm library/Requests/Transport/cacert.pem
ln -s %{_sysconfdir}/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
library/Requests/Transport/cacert.pem
%build
%{_bindir}/phpab --format fedora --output library/autoload.php library
%install
install -d -p -m 0755 %{buildroot}/%{_datadir}/php
install -d -p -m 0755 %{buildroot}/%{_datadir}/php/rmccue
install -d -p -m 0755 %{buildroot}/%{_datadir}/php/rmccue/Requests
cp -ar library/* %{buildroot}/%{_datadir}/php/rmccue/Requests
%check
sed -i "s:include.*:require('%{buildroot}/%{_datadir}/php/rmccue/Requests/autoload.php');:" \
tests/bootstrap.php
if [ "$(netstat -ln | grep 8080)" != "" ]
then
kill php
fi
%{_bindir}/php -S 127.0.0.1:8080 \
test-server-26334a7583c96ae1f966a5d88af9aafaf279f948/bin/serve.php &
PHPPID=$!
pushd tests
# The request test server doesn't run over TLS so we skip HTTPS tests. The other tests fail if they
# can't resolve domain names, so they are skipped as well.
REQUESTS_TEST_HOST="127.0.0.1:8080" phpunit --bootstrap bootstrap.php \
--filter \
^\(\(?!\(testHTTPS\|testAlternateNameSupport\|testSNISupport\|testAlternatePort\)\).\)*$ || \
(kill $PHPPID && exit 1)
popd
kill $PHPPID
%files
%license LICENSE
%doc CHANGELOG.md
%doc composer.json
%doc docs
%doc examples
%doc README.md
%{_datadir}/php/rmccue
%changelog
* Sun Mar 05 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.7.0-2
- Change license tag to ISC and BSD.
- Use a better method for killing the test server.
* Sun Feb 19 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.7.0-1
- Initial release.
|