summaryrefslogtreecommitdiffstats
path: root/phan.spec
blob: 47a9404c3828211766828115a40a2925363ccf85 (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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# remirepo/fedora spec file for phan
#
# Copyright (c) 2016-2019 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

# For compatibility with SCL
%undefine __brp_mangle_shebangs

%global gh_commit    f5c8f8665f252161de3b39f32cb231eb6517dc70
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     phan
#global gh_date      20150820
%global gh_project   phan
%global psr0         Phan
%global with_tests   0%{!?_without_tests:1}
%global upstream_version 2.1.0
#global upstream_prever  RC2

Name:           %{gh_project}
Version:        %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
Release:        1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary:        A static analyzer for PHP

License:        MIT
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        %{name}-%{upstream_version}%{?upstream_prever}-%{?gh_short}.tgz
Source1:        makesrc.sh

# Use fedora autoloader
Patch0:         %{name}-autoload.patch

BuildArch:      noarch
%if %{with_tests}
BuildRequires:  php(language) >= 7.1.0
BuildRequires:  php-ast >= 1.0.1
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires:  (php-composer(composer/semver) >= 1.4                  with php-composer(composer/semver) < 2)
BuildRequires:  (php-composer(composer/xdebug-handler) >= 1.3.2        with php-composer(composer/xdebug-handler) < 2)
BuildRequires:  (php-composer(felixfbecker/advanced-json-rpc) >= 3.0.3 with php-composer(felixfbecker/advanced-json-rpc) <  4)
BuildRequires:  (php-composer(microsoft/tolerant-php-parser) >= 0.0.17 with php-composer(microsoft/tolerant-php-parser) <  0.1)
BuildRequires:  (php-composer(sabre/event) >= 5.0                      with php-composer(sabre/event) <  6)
BuildRequires:  (php-composer(symfony/console) >= 2.8                  with php-composer(symfony/console) <  5)
# remirepo:13
%else
BuildRequires:  php-composer(composer/semver) < 2
BuildRequires:  php-composer(composer/semver) >= 1.4
BuildRequires:  php-composer(composer/xdebug-handler) < 2
BuildRequires:  php-composer(composer/xdebug-handler) >= 1.3.2
BuildRequires:  php-composer(felixfbecker/advanced-json-rpc) <  4
BuildRequires:  php-composer(felixfbecker/advanced-json-rpc) >= 3.0.3
BuildRequires:  php-composer(microsoft/tolerant-php-parser) <  0.1
BuildRequires:  php-composer(microsoft/tolerant-php-parser) >= 0.0.17
BuildRequires:  php-composer(sabre/event) <  6
BuildRequires:  php-composer(sabre/event) >= 5.0
BuildRequires:  php-composer(symfony/console) <  4
%endif
BuildRequires:  php-reflection
BuildRequires:  php-ctype
BuildRequires:  php-dom
BuildRequires:  php-filter
BuildRequires:  php-json
BuildRequires:  php-mbstring
BuildRequires:  php-pcntl
BuildRequires:  php-pcre
BuildRequires:  php-posix
BuildRequires:  php-spl
BuildRequires:  php-sysvmsg
BuildRequires:  php-sysvsem
# For tests, from composer.json "require-dev": {
#        "brianium/paratest": "^2.2.0",
#        "phpunit/phpunit": "^7.5.0"
BuildRequires:  phpunit7 >= 7.5
BuildRequires:  php-date
BuildRequires:  php-intl
BuildRequires:  php-soap
%endif
# For autoloader
BuildRequires:  php-composer(fedora/autoloader)

# From composer.json, "require": {
#        "php": "^7.1.0",
#        "ext-filter": "*",
#        "ext-json": "*",
#        "composer/semver": "^1.4",
#        "composer/xdebug-handler": "^1.3.2",
#        "felixfbecker/advanced-json-rpc": "^3.0.3",
#        "microsoft/tolerant-php-parser": "0.0.17",
#        "sabre/event": "^5.0",
#        "symfony/console": "^2.3|^3.0|~4.0",
#        "symfony/polyfill-mbstring": "^1.11.0"
Requires:       php(language) >= 7.1.0
Requires:       php-filter
Requires:       php-json
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
# From composer.json, "suggest": {
#        "ext-ast": "Needed for parsing ASTs (unless --use-fallback-parser is used). 1.0.1+ is needed.",
#        "ext-igbinary": "Improves performance of polyfill when ext-ast is unavailable",
#        "ext-tokenizer": "Needed for non-AST support and file/line-based suppressions."
Recommends:     php-ast >= 1.0.1
Suggests:       php-igbinary
Recommends:     php-tokenizer
Requires:       (php-composer(composer/semver) >= 1.4                  with php-composer(composer/semver) < 2)
Requires:       (php-composer(composer/xdebug-handler) >= 1.3.2        with php-composer(composer/xdebug-handler) < 2)
Requires:       (php-composer(felixfbecker/advanced-json-rpc) >= 3.0.3 with php-composer(felixfbecker/advanced-json-rpc) <  4)
Requires:       (php-composer(nikic/php-parser) >= 3.1.1               with php-composer(nikic/php-parser) <  4)
Requires:       (php-composer(microsoft/tolerant-php-parser) >= 0.0.17 with php-composer(microsoft/tolerant-php-parser) <  0.1)
Requires:       (php-composer(sabre/event) >= 5.0                      with php-composer(sabre/event) <  6)
Requires:       (php-composer(symfony/console) >= 2.8                  with php-composer(symfony/console) <  5)
# remirepo:14
%else
Requires:       php-ast >= 0.1.5
Requires:       php-composer(composer/semver) < 2
Requires:       php-composer(composer/semver) >= 1.4
Requires:       php-composer(composer/xdebug-handler) < 2
Requires:       php-composer(composer/xdebug-handler) >= 1.3.2
Requires:       php-composer(felixfbecker/advanced-json-rpc) <  4
Requires:       php-composer(felixfbecker/advanced-json-rpc) >= 3.0.3
Requires:       php-composer(microsoft/tolerant-php-parser) <  0.1
Requires:       php-composer(microsoft/tolerant-php-parser) >= 0.0.17
Requires:       php-composer(sabre/event) <  6
Requires:       php-composer(sabre/event) >= 5.0
Requires:       php-composer(symfony/console) <  4
%endif
# From phpcompatinfo report for 1.2.5
Requires:       php-cli
Requires:       php-reflection
Requires:       php-ctype
Requires:       php-dom
Requires:       php-mbstring
Requires:       php-pcntl
Requires:       php-pcre
Requires:       php-posix
Requires:       php-readline
Requires:       php-spl
Requires:       php-sysvmsg
Requires:       php-sysvsem
# For autoloader
Requires:       php-composer(fedora/autoloader)

# Composer
Provides:       php-composer(etsy/%{gh_project}) = %{version}
Provides:       php-composer(%{gh_owner}/%{gh_project}) = %{version}


%description
Phan is a static analyzer that looks for common issues and will verify type
compatibility on various operations when type information is available or can
be deduced. Phan does not make any serious attempt to understand flow control
and narrow types based on conditionals.


%prep
%setup -q -n %{gh_project}-%{gh_commit}

%patch0 -p1 -b .rpm

cat << 'EOF' | tee src/autoload.php
<?php
/* Autoloader for etsy/phan and its dependencies */

require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Phan\\', __DIR__ . '/Phan');
\Fedora\Autoloader\Dependencies::required([
    '%{_datadir}/php/Composer/Semver/autoload.php',
    '%{_datadir}/php/Composer/XdebugHandler/autoload.php',
    '%{_datadir}/php/AdvancedJsonRpc3/autoload.php',
    '%{_datadir}/php/Microsoft/PhpParser/autoload.php',
    '%{_datadir}/php/Sabre/Event5/autoload.php',
    [
        '%{_datadir}/php/Symfony4/Component/Console/autoload.php',
        '%{_datadir}/php/Symfony3/Component/Console/autoload.php',
        '%{_datadir}/php/Symfony/Component/Console/autoload.php',
    ],
]);
EOF

find . -name \*.rpm -delete
chmod +x src/phan.php


%build
: Nothing to build


%install
: Library
mkdir -p   %{buildroot}%{_datadir}/php/
cp -pr src %{buildroot}%{_datadir}/php/%{psr0}

: Plugins
cp -pr .phan/plugins %{buildroot}%{_datadir}/php/%{psr0}/plugins

: Commands
mkdir -p %{buildroot}%{_bindir}
ln -s ../share/php/%{psr0}/phan.php %{buildroot}%{_bindir}/phan
install -Dpm 755 phan_client %{buildroot}%{_bindir}/phan-client


%check
%if %{with_tests}
cat << 'EOF' | tee tests/autoload.php
<?php
require '%{buildroot}%{_datadir}/php/%{psr0}/Phan/Bootstrap.php';
\Fedora\Autoloader\Autoload::addPsr4('Phan\\Tests\\', __DIR__ . '/Phan');
EOF

# NOTICE mosquitto, request and grpc must be disabled
%{_bindir}/phpunit7 -d memory_limit=1G --bootstrap tests/autoload.php --verbose


%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
%doc *.md
%{_datadir}/php/%{psr0}
%{_bindir}/phan*


%changelog
* Sun Jun  2 2019 Remi Collet <remi@remirepo.net> - 2.1.0-1
- update to 2.1.0

* Mon May 20 2019 Remi Collet <remi@remirepo.net> - 2.0.0-1
- update to 2.0.0

* Tue May 14 2019 Remi Collet <remi@remirepo.net> - 2.0.0~RC2-1
- update to 2.0.0RC2
- raise dependency on PHP 7.1.0
- raise dependency on ast 1.0.1
- switch to phpunit7

* Fri May 10 2019 Remi Collet <remi@remirepo.net> - 1.3.4-1
- update to 1.3.4

* Thu May  9 2019 Remi Collet <remi@remirepo.net> - 1.3.3-1
- update to 1.3.3

* Mon Apr 29 2019 Remi Collet <remi@remirepo.net> - 1.3.2-1
- update to 1.3.2

* Tue Apr 23 2019 Remi Collet <remi@remirepo.net> - 1.3.1-1
- update to 1.3.1

* Mon Apr  8 2019 Remi Collet <remi@remirepo.net> - 1.2.8-1
- update to 1.2.8

* Sat Mar 23 2019 Remi Collet <remi@remirepo.net> - 1.2.7-1
- update to 1.2.7
- raise dependency on microsoft/tolerant-php-parser 0.0.17

* Sun Mar 10 2019 Remi Collet <remi@remirepo.net> - 1.2.6-1
- update to 1.2.6

* Wed Feb 27 2019 Remi Collet <remi@remirepo.net> - 1.2.5-1
- update to 1.2.5
- add dependecy on mbstring
- add weak dependecy on igbinary

* Tue Feb 19 2019 Remi Collet <remi@remirepo.net> - 1.2.4-1
- update to 1.2.4
- raise dependency on composer/xdebug-handler 1.3.2

* Mon Feb 11 2019 Remi Collet <remi@remirepo.net> - 1.2.3-1
- update to 1.2.3

* Mon Feb  4 2019 Remi Collet <remi@remirepo.net> - 1.2.2-1
- update to 1.2.2

* Sat Jan 19 2019 Remi Collet <remi@remirepo.net> - 1.2.1-1
- update to 1.2.1
- raise dependency on microsoft/tolerant-php-parser 0.0.16

* Sun Jan  6 2019 Remi Collet <remi@remirepo.net> - 1.2.0-1
- update to 1.2.0

* Mon Dec 31 2018 Remi Collet <remi@remirepo.net> - 1.1.10-1
- update to 1.1.10

* Fri Dec 28 2018 Remi Collet <remi@remirepo.net> - 1.1.9-1
- update to 1.1.9

* Sun Dec 16 2018 Remi Collet <remi@remirepo.net> - 1.1.8-1
- update to 1.1.8

* Sun Dec  9 2018 Remi Collet <remi@remirepo.net> - 1.1.7-1
- update to 1.1.7

* Fri Nov 30 2018 Remi Collet <remi@remirepo.net> - 1.1.5-1
- update to 1.1.5

* Wed Nov 28 2018 Remi Collet <remi@remirepo.net> - 1.1.4-1
- update to 1.1.4

* Wed Nov 21 2018 Remi Collet <remi@remirepo.net> - 1.1.3-1
- update to 1.1.3

* Tue Nov  6 2018 Remi Collet <remi@remirepo.net> - 1.1.2-1
- update to 1.1.2

* Tue Oct 23 2018 Remi Collet <remi@remirepo.net> - 1.1.1-1
- update to 1.1.1

* Tue Oct  9 2018 Remi Collet <remi@remirepo.net> - 1.1.0-1
- update to 1.1.0

* Wed Oct  3 2018 Remi Collet <remi@remirepo.net> - 1.0.7-1
- update to 1.0.7
- raise dependency on microsoft/tolerant-php-parser 0.0.15
- php-ast is optional

* Wed Sep 26 2018 Remi Collet <remi@remirepo.net> - 1.0.6-1
- update to 1.0.6
- sources from git snapshot

* Sat Sep 22 2018 Remi Collet <remi@remirepo.net> - 1.0.5-1
- update to 1.0.5
- open https://github.com/phan/phan/issues/1986 keep the tests
- keep ast mandatory despite it is now optional

* Mon Sep 10 2018 Remi Collet <remi@remirepo.net> - 1.0.4-1
- update to 1.0.4
- add the upstream plugins
- raise dependency on felixfbecker/advanced-json-rpc 3.0.3

* Sat Sep  8 2018 Remi Collet <remi@remirepo.net> - 1.0.3-1
- update to 1.0.3

* Fri Sep  7 2018 Remi Collet <remi@remirepo.net> - 1.0.2-1
- update to 1.0.2
- raise dependency on composer/xdebug-handler 1.3

* Mon Aug 27 2018 Remi Collet <remi@remirepo.net> - 1.0.1-1
- update to 1.0.1
- raise dependency on microsoft/tolerant-php-parser 0.0.13

* Tue Aug 14 2018 Remi Collet <remi@remirepo.net> - 1.0.0-1
- update to 1.0.0

* Mon Jul 23 2018 Remi Collet <remi@remirepo.net> - 0.12.15-1
- update to 0.12.15

* Mon Jul  9 2018 Remi Collet <remi@remirepo.net> - 0.12.14-1
- update to 0.12.14

* Tue Jun 19 2018 Remi Collet <remi@remirepo.net> - 0.12.13-1
- update to 0.12.13
- raise dependency on microsoft/tolerant-php-parser 0.0.11
- raise dependency on composer/xdebug-handler 1.1

* Mon Jun 11 2018 Remi Collet <remi@remirepo.net> - 0.12.12-1
- update to 0.12.12

* Thu May 31 2018 Remi Collet <remi@remirepo.net> - 0.12.11-1
- update to 0.12.11

* Mon May 28 2018 Remi Collet <remi@remirepo.net> - 0.12.10-1
- update to 0.12.10

* Wed May 23 2018 Remi Collet <remi@remirepo.net> - 0.12.9-1
- update to 0.12.9
- raise dependency on microsoft/tolerant-php-parser 0.0.11

* Sun May 13 2018 Remi Collet <remi@remirepo.net> - 0.12.8-1
- update to 0.12.8

* Tue Apr  3 2018 Remi Collet <remi@remirepo.net> - 0.12.5-1
- update to 0.12.5

* Mon Apr  2 2018 Remi Collet <remi@remirepo.net> - 0.12.4-1
- update to 0.12.4

* Mon Mar 26 2018 Remi Collet <remi@remirepo.net> - 0.12.3-1
- update to 0.12.3
- add dependency on composer/xdebug-handler
- raise dependency on microsoft/tolerant-php-parser 0.0.10

* Sat Mar  3 2018 Remi Collet <remi@remirepo.net> - 0.12.2-1
- Update to 0.12.2

* Thu Mar  1 2018 Remi Collet <remi@remirepo.net> - 0.12.1-1
- Update to 0.12.1

* Mon Feb 26 2018 Remi Collet <remi@remirepo.net> - 0.12.0-1
- Update to 0.12.0
- drop dependency on nikic/PHP-Parser
- add dependency on composer/semver
- same version for PHP 7.0, 7.1 and 7.2

* Thu Feb 15 2018 Remi Collet <remi@remirepo.net> - 0.11.3-1
- Update to 0.11.3
- raise dependency on microsoft/tolerant-php-parser 0.0.9

* Mon Feb 12 2018 Remi Collet <remi@remirepo.net> - 0.11.2-1
- Update to 0.11.2

* Mon Jan 22 2018 Remi Collet <remi@remirepo.net> - 0.11.1-1
- Update to 0.11.1
- raise dependency on felixfbecker/advanced-json-rpc 3.0
- add dependency on microsoft/tolerant-php-parser
- allow Symfony 4

* Sat Nov 18 2017 Remi Collet <remi@remirepo.net> - 0.11.0-1
- Update to 0.11.0
- raise dependency on PHP 7.2

* Sat Nov 18 2017 Remi Collet <remi@remirepo.net> - 0.10.2-1
- Update to 0.10.2

* Sat Oct 21 2017 Remi Collet <remi@remirepo.net> - 0.10.1-1
- Update to 0.10.1
- add dependency on felixfbecker/advanced-json-rpc 2.0
- add dependency on sabre/event 5.0

* Mon Sep 25 2017 Remi Collet <remi@remirepo.net> - 0.10.0-1
- Update to 0.10.0
- raise dependency on ast 0.1.5
- add dependency on nikic/php-parser 3.1.1
- move from etsy/phan to phan/phan

* Wed Aug 16 2017 Remi Collet <remi@remirepo.net> - 0.9.4-1
- Update to 0.9.4

* Wed Jul 12 2017 Remi Collet <remi@remirepo.net> - 0.9.3-1
- Update to 0.9.3
- installation layout match upstream tree
- remove phan-prep command (only an example)
- add phan-client command

* Wed Jun 14 2017 Remi Collet <remi@remirepo.net> - 0.9.2-1
- Update to 0.9.2
- allow Symfony 3
- use phpunit 6

* Thu Mar 16 2017 Remi Collet <remi@remirepo.net> - 0.9.1-1
- Update to 0.9.1
- raise dependency on PHP 7.1
- raise dependency on ast 0.1.4

* Fri Jan 27 2017 Remi Collet <remi@remirepo.net> - 0.8.3-1
- update to 0.8.3

* Thu Jan 26 2017 Remi Collet <remi@remirepo.net> - 0.8.2-1
- update to 0.8.2

* Wed Jan 25 2017 Remi Collet <remi@fedoraproject.org> - 0.8.0-1
- update to 0.8.0

* Fri Dec  9 2016 Remi Collet <remi@fedoraproject.org> - 0.7-1
- update to 0.7

* Thu Nov 24 2016 Remi Collet <remi@fedoraproject.org> - 0.6-1
- initial package