summaryrefslogtreecommitdiffstats
path: root/php-opencloud-openstack.spec
blob: 8813362880add3a732fb68c5b21877594b7f07a1 (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# remirepo spec file for php-opencloud-openstack, from:
#
# Fedora spec file for php-opencloud-openstack
#
# Copyright (c) 2013-2017 Gregor Tätzner <brummbq@fedoraproject.org>
#                         Shawn Iwinski <shawn.iwinski@gmail.com>
#                         Christian Glombek <lorbus@fedoraproject.org>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner   php-opencloud
%global github_name    openstack
%global github_version 3.0.5
%global github_commit  2883c92cdfe05d4a11533497c2b74cc018c7cf0b

%global composer_vendor  php-opencloud
%global composer_project openstack

# "php" : "~7.0"
%global php_min_ver 7.0
# "guzzlehttp/http" : "~6.1"
%global guzzle_min_ver 6.1
%global guzzle_max_ver 7
# "justinrainbow/json-schema": "~5.2"
%global json_schema_min_ver 5.2
%global json_schema_max_ver 6

# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:           php-opencloud-openstack
Version:        %{github_version}
Release:        1%{?github_release}%{?dist}
Summary:        PHP SDK for OpenStack clouds

License:        ASL 2.0
URL:            https://php-openstack-sdk.readthedocs.io/
Source0:        https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:      noarch

# Docs
%if 0%{?fedora} >= 29
%global with_docs 1
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3dist(sphinxcontrib-phpdomain)
%else
%global with_docs 0
%endif
BuildRequires:  fontawesome-fonts
Requires:       fontawesome-fonts
%if 0%{?fedora} >= 25
BuildRequires:  fontawesome-fonts-web
Requires:       fontawesome-fonts-web
%endif
BuildRequires:  lato-fonts
Requires:       lato-fonts
%if 0%{?fedora} >= 25 || 0%{?rhel} >= 7
BuildRequires:  google-roboto-slab-fonts
Requires:       google-roboto-slab-fonts
%endif
%if 0%{?fedora} >= 29
BuildRequires:  levien-inconsolata-fonts
Requires:       levien-inconsolata-fonts
%endif

# Tests
%if %{with_tests}
## composer.json
BuildRequires:  php(language) >= %{php_min_ver}
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires: (php-guzzlehttp-guzzle6 >= %{guzzle_min_ver} with php-guzzlehttp-guzzle6 < %{guzzle_max_ver})
BuildRequires: (php-justinrainbow-json-schema5 >= %{json_schema_min_ver} with php-justinrainbow-json-schema5 < %{json_schema_max_ver})
%else
BuildRequires:  php-guzzlehttp-guzzle6 >= %{guzzle_min_ver}
BuildRequires:  php-justinrainbow-json-schema5 >= %{json_schema_min_ver}
%endif
BuildRequires:  phpunit6
## Autoloader
BuildRequires:  php-fedora-autoloader
%endif

# composer.json
Requires:       php(language) >= %{php_min_ver}
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:      (php-guzzlehttp-guzzle6 >= %{guzzle_min_ver} with php-guzzlehttp-guzzle6 < %{guzzle_max_ver})
Requires:      (php-justinrainbow-json-schema5 >= %{json_schema_min_ver} with php-justinrainbow-json-schema5 < %{json_schema_max_ver})
%else
Requires:       php-guzzlehttp-guzzle6 >= %{guzzle_min_ver}
Requires:       php-justinrainbow-json-schema5 >= %{json_schema_min_ver}
%endif
# Autoloader
Requires:       php-fedora-autoloader

# Composer
Provides:       php-composer(%{composer_vendor}/%{composer_project}) = %{version}

%description
php-opencloud/openstack is an SDK which allows PHP developers to easily connect
to OpenStack APIs in a simple and idiomatic way. This binding is specifically
designed for OpenStack APIs, but other provider SDKs are available. Multiple
OpenStack services, and versions of services, are supported.

Autoloader: %{phpdir}/OpenStack/autoload.php


%package doc
Summary: Documentation for PHP SDK for OpenStack clouds


%description doc
Documentation for PHP SDK for OpenStack clouds


%prep
%setup -qn %{github_name}-%{github_commit}


%build
%if %{with_docs}
# Generate html docs
PYTHONPATH=${PWD} sphinx-build-3 doc html
# Remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
# Unbundle fonts
pushd html/_static/fonts/
for file in FontAwesome*; do
    rm -f $file
    ln -s /usr/share/fonts/fontawesome/$file $file
done
for file in fontawesome*; do
    rm -f $file
    ln -s /usr/share/fonts/fontawesome/$file $file
done
for file in Lato*; do
    rm -f $file
    ln -s /usr/share/fonts/lato/$file $file
done
%if 0%{?fedora} >= 24 || 0%{?rhel} >= 7
for file in RobotoSlab*; do
    rm -f $file
    ln -s /usr/share/fonts/google-roboto-slab/$file $file
done
%endif
%if 0%{?fedora} >= 29
for file in Inconsolata*; do
    rm -f $file
    ln -s /usr/share/fonts/levien-inconsolata/$file $file
done
%endif
popd
%endif

: Create autoloader
cat <<'AUTOLOAD' | tee src/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('OpenStack\\', __DIR__);

\Fedora\Autoloader\Dependencies::required(array(
    '%{phpdir}/GuzzleHttp6/autoload.php',
    '%{phpdir}/JsonSchema5/autoload.php',
));
AUTOLOAD


%install
mkdir -p %{buildroot}%{phpdir}/OpenStack
cp -pr src/* %{buildroot}%{phpdir}/OpenStack/


%check
%if %{with_tests}
: Create mock Composer autoloader
mkdir vendor
cat <<'AUTOLOAD' | tee vendor/autoload.php
<?php
require '%{buildroot}%{phpdir}/OpenStack/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('OpenStack\\Test\\', __DIR__.'/../tests/unit');
\Fedora\Autoloader\Autoload::addPsr4('OpenStack\\Integration\\', __DIR__.'/../tests/integration/');
AUTOLOAD

: Upstream tests
for cmd in php php70 php71 php72 php73
do
  if which $cmd; then
    $cmd %{_bindir}/phpunit6 --verbose
  fi
done
%else
: Tests skipped
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{phpdir}/OpenStack


%files doc
%doc doc
%doc samples


%changelog
* Fri Jul  6 2018 Remi Collet <remi@remirepo.net> - 3.0.5-1
- backport for remirepo

* Sun Jul 01 2018 Christian Glombek <lorbus@fedoraproject.org> - 3.0.5-1
- Update to version 3.0.5
- Rename to php-opencloud-openstack

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.16.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Nov  2 2017 Remi Collet <remi@remimrepo.net> - 1.16.0-4
- fix FTBFS from Koschei, add patch for PHP 7.2 from
  https://github.com/mikemccabe/json-patch-php/pull/17

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.16.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon May 29 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.16.0-2
- Fix autoloader dependency

* Sun Feb 26 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.16.0-1
- Update to 1.16.0 (RHBZ #1312624)
- Fix FTBFS (skip tests known to fail)
- Add bundled dependency php-composer(mikemccabe/json-patch-php)
- Use php-composer(fedora/autoloader)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sat Mar 26 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.12.2-1
- Updated to 1.12.2
- Updated URL
- Updated dependencies to use php-composer(*)
- Added autoloader (and bumped dependency versions for their autoloaders)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.12.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Jan 02 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.12.1-1
- Updated to 1.12.1 (BZ #1172637)
- Added php-composer(rackspace/php-opencloud) virtual provide

* Sat Nov 22 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.11.0-3
- Removed obsolete of php-cloudfiles

* Sun Nov 02 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.11.0-2
- No BuildRequires unless with tests

* Sun Nov 02 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.11.0-1
- Updated to 1.11.0 (BZ #1159522)
- Spec cleanup

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu Jan 30 2014 Gregor Tätzner <brummbq@fedoraproject.org> - 1.6.0-4
- obsolete php-cloudfiles

* Sat Jan 25 2014 Gregor Tätzner <brummbq@fedoraproject.org> - 1.6.0-3
- use commit revision in source url

* Fri Jan 03 2014 Gregor Tätzner <brummbq@fedoraproject.org> - 1.6.0-2
- move lib to psr-0 compliant location
- drop autoloader

* Tue Dec 31 2013 Gregor Tätzner <brummbq@fedoraproject.org> - 1.6.0-1
- initial packaging