summaryrefslogtreecommitdiffstats
path: root/php-monolog2.spec
blob: 3f8a86f93590a116226c2a0ea0d288887d2d5d23 (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
# remirepo/fedora spec file for php-monolog2
#
# Copyright (c) 2012-2023 Shawn Iwinski <shawn.iwinski@gmail.com>
#                         Remi Collet <remi@remirepo.net>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

# TODO optional (and not available yet)
# symfony/mailer + symfony/mime ^5.4 || ^6
# guzzlehttp/guzzle + guzzlehttp/psr7

%global github_owner     Seldaek
%global github_name      monolog
%global github_version   2.9.3
%global github_commit    a30bfe2e142720dfa990d0a7e573997f5d884215

%global composer_vendor  monolog
%global composer_project monolog
%global major            2

# "php": ">=7.2"
%global php_min_ver 7.2
# "psr/log": "^1.0.1 || ^2.0 || ^3.0"
%global psrlog_min_ver 1.0.1
%global psrlog_max_ver 4
# "aws/aws-sdk-php": "^2.4.9 || ^3.0"
#     NOTE: Min version not 2.4.9 because autoloader required
%global aws_min_ver 2.8.13
%global aws_max_ver 4.0
# "swiftmailer/swiftmailer": "~5.3"
%global swift_min_ver 5.3
%global swift_max_ver 7

# Build using "--without tests" to disable tests
%bcond_without tests

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

Name:      php-%{composer_project}%{major}
Version:   %{github_version}
Release:   1%{?dist}
Summary:   Sends your logs to files, sockets, inboxes, databases and various web services

License:   MIT
URL:       https://github.com/%{github_owner}/%{github_name}
Source0:   %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:      noarch
# Tests
%if %{with tests}
## composer.json
BuildRequires:  php(language) >= %{php_min_ver}
BuildRequires:  phpunit9 >= 9.6.19
# remirepo:1
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
BuildRequires: (php-composer(psr/log)                 >= %{psrlog_min_ver} with php-composer(psr/log)                 < %{psrlog_max_ver})
BuildRequires: (php-composer(swiftmailer/swiftmailer) >= %{swift_min_ver}  with php-composer(swiftmailer/swiftmailer) < %{swift_max_ver})
# remirepo:4
%else
BuildRequires:  php-PsrLog
BuildRequires:  php-swiftmailer6
%endif
## optional
## phpcompatinfo (computed from version 2.1.1)
BuildRequires:  php-curl
BuildRequires:  php-date
BuildRequires:  php-filter
BuildRequires:  php-json
BuildRequires:  php-mbstring
BuildRequires:  php-openssl
BuildRequires:  php-pcntl
BuildRequires:  php-pcre
BuildRequires:  php-posix
BuildRequires:  php-reflection
BuildRequires:  php-soap
BuildRequires:  php-sockets
BuildRequires:  php-spl
BuildRequires:  php-xml
## Autoloader
BuildRequires:  php-fedora-autoloader-devel
%endif

# composer.json
Requires:       php(language) >= %{php_min_ver}
# remirepo:1
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
Requires:      (php-composer(psr/log)                 >= %{psrlog_min_ver} with php-composer(psr/log)                 < %{psrlog_max_ver})
# remirepo:5
%else
Requires:       php-PsrLog
%endif
# phpcompatinfo (computed from version 2.1.1)
Requires:       php-curl
Requires:       php-date
Requires:       php-filter
Requires:       php-json
Requires:       php-mbstring
Requires:       php-openssl
Requires:       php-pcntl
Requires:       php-pcre
Requires:       php-posix
Requires:       php-sockets
Requires:       php-spl
Requires:       php-xml
# Autoloader
Requires:      php-composer(fedora/autoloader)

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

# Weak dependencies
# remirepo:1
%if 0%{?fedora} >=21 || 0%{?rhel} >= 8
# TODO graylog2/gelf-php, doctrine/couchdb, ruflin/elastica, elasticsearch/elasticsearch
#      rollbar/rollbar
Suggests:      php-composer(php-amqplib/php-amqplib)
Suggests:      php-pecl(amqp)
Suggests:      php-pecl(mongo)
Suggests:      php-composer(mongodb/mongodb)
Suggests:      php-composer(aws/aws-sdk-php)
Suggests:      php-composer(swiftmailer/swiftmailer)
# remirepo:1
%endif

%description
Monolog sends your logs to files, sockets, inboxes, databases and various web
services. Special handlers allow you to build advanced logging strategies.

This library implements the PSR-3 [1] interface that you can type-hint against
in your own libraries to keep a maximum of interoperability. You can also use it
in your applications to make sure you can always use another compatible logger
at a later time.

[1] http://www.php-fig.org/psr/psr-3/

Autoloader: %{phpdir}/Monolog%{major}/autoload.php


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


%build
: Create autoloader
phpab -t fedora \
      -o src/Monolog/autoload.php \
         src/Monolog

cat <<'AUTOLOAD' | tee -a src/Monolog/autoload.php

\Fedora\Autoloader\Dependencies::required([
    [
        '%{phpdir}/Psr/Log3/autoload.php',
        '%{phpdir}/Psr/Log2/autoload.php',
        '%{phpdir}/Psr/Log/autoload.php',
    ],
]);

\Fedora\Autoloader\Dependencies::optional([
    [
        '%{phpdir}/Aws3/autoload.php',
        '%{phpdir}/Aws/autoload.php',
    ], [
        '%{phpdir}/Swift6/autoload.php',
        '%{phpdir}/Swift/swift_required.php',
    ],
    '%{phpdir}/MongoDB/autoload.php',
]);
AUTOLOAD


%install
mkdir -p %{buildroot}%{phpdir}
cp -pr src/Monolog %{buildroot}%{phpdir}/Monolog%{major}


%check
%if %{with tests}
mkdir vendor
: Create tests bootstrap
cat << 'BOOTSTRAP' | tee vendor/autoload.php
<?php
require_once '%{buildroot}%{phpdir}/Monolog%{major}/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Monolog\\', dirname(__DIR__) . '/tests/Monolog');
BOOTSTRAP

: Remove MongoDBHandlerTest because it requires a running MongoDB server
rm -f tests/Monolog/Handler/MongoDBHandlerTest.php

: Remove RedisHandlerTest because it requires a running Redis server
rm -f tests/Monolog/Handler/Redis*Test.php

: Remove GitProcessorTest because it requires a git repo
rm -f tests/Monolog/Processor/GitProcessorTest.php

: Mocking issues
rm -f tests/Monolog/Handler/SocketHandlerTest.php
rm -f tests/Monolog/Handler/RollbarHandlerTest.php

: Not available
rm -f tests/Monolog/Handler/ElasticsearchHandlerTest.php
rm -f tests/Monolog/Handler/SymfonyMailerHandlerTest.php

: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit9)
for PHP_EXEC in "" php81 php82 php83; do
    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
        $PHP_EXEC $PHPUNIT \
          --filter '^((?!(testWriteInvalidResource)).)*$' \
          --verbose || RETURN_CODE=1
    fi
    rm -rf .hg
done
exit $RETURN_CODE
%else
: Tests skipped
%endif


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc doc
%doc composer.json
%{phpdir}/Monolog%{major}


%changelog
* Tue Apr 16 2024 Remi Collet <remi@remirepo.net> - 2.9.3-1
- update to 2.9.3

* Mon Dec 11 2023 Remi Collet <remi@remirepo.net> - 2.9.2-1
- update to 2.9.2

* Tue Feb  7 2023 Remi Collet <remi@remirepo.net> - 2.9.1-1
- update to 2.9.1

* Mon Jul 25 2022 Remi Collet <remi@remirepo.net> - 2.8.0-1
- update to 2.8.0

* Thu Jun  9 2022 Remi Collet <remi@remirepo.net> - 2.7.0-1
- update to 2.7.0

* Tue May 10 2022 Remi Collet <remi@remirepo.net> - 2.6.0-1
- update to 2.6.0

* Mon Apr 11 2022 Remi Collet <remi@remirepo.net> - 2.5.0-1
- update to 2.5.0

* Mon Mar 14 2022 Remi Collet <remi@remirepo.net> - 2.4.0-1
- update to 2.4.0

* Mon Oct  4 2021 Remi Collet <remi@remirepo.net> - 2.3.5-1
- update to 2.3.5

* Wed Sep 22 2021 Remi Collet <remi@remirepo.net> - 2.3.4-1
- update to 2.3.4
- allow psr/log v2 and v3

* Fri Jul 23 2021 Remi Collet <remi@remirepo.net> - 2.3.2-1
- update to 2.3.2

* Mon Jul 19 2021 Remi Collet <remi@remirepo.net> - 2.3.1-1
- update to 2.3.1

* Mon Jul  5 2021 Remi Collet <remi@remirepo.net> - 2.3.0-1
- update to 2.3.0

* Mon Jan  4 2021 Remi Collet <remi@remirepo.net> - 2.2.0-1
- update to 2.2.0

* Thu Jul 23 2020 Remi Collet <remi@remirepo.net> - 2.1.1-1
- update to 2.1.1
- rename to php-monolog2
- install in /usr/share/php/Monolog2
- raise dependency on PHP 7.2
- switch to classmap autoloader

* Thu Jul 23 2020 Remi Collet <remi@remirepo.net> - 1.25.5-1
- update to 1.25.5

* Thu Nov 14 2019 Remi Collet <remi@remirepo.net> - 1.25.2-1
- update to 1.25.2

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

* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.23.0-1
- Update to 1.23.0 (RHBZ #1432274)
- Test with SCLs if available

* Tue Jun 20 2017 Remi Collet <remi@remirepo.net> - 1.23.0-1
- Update to 1.23.0
- add max version for build dependencies

* Mon Mar 13 2017 Remi Collet <remi@remirepo.net> - 1.22.1-1
- Update to 1.22.1

* Sat Nov 26 2016 Remi Collet <remi@fedoraproject.org> - 1.22.0-1
- update to 1.22.0
- switch from symfony/class-loader to fedora/autoloader
- allow aws/aws-sdk-php version 3

* Sun Nov 06 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.21.0-2
- Fix test suite for php-sentry >= 0.16.0
- Modified php-psr-log dependency (min version 1.0.0-8 => 1.0.1)

* Mon Aug 08 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.21.0-1
- Updated to 1.21.0 (RHBZ #1362318)

* Fri Aug  5 2016 Remi Collet <remi@remirepo.net> - 1.21.0-1
- update to 1.21.0

* Tue Jul  5 2016 Remi Collet <remi@remirepo.net> - 1.20.0-1.1
- sync with Fedora, re-add dependency on raven
  (sentry is only a rename)

* Mon Jul 04 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.20.0-1
- Updated to 1.20.0 (RHBZ #1352494)
- Updated autoloader to not use "@include_once"

* Sun Jul  3 2016 Remi Collet <remi@remirepo.net> - 1.20.0-1
- update to 1.20.0
- drop dependency on raven (upstream switch to sentry)

* Thu Apr 14 2016 Remi Collet <remi@remirepo.net> - 1.19.0-1
- update to 1.19.0
- updated autoloader dependency loading

* Mon Apr 04 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.18.2-1
- Updated to 1.18.2 (RHBZ #1313579)
- Removed patch (accepted upstream and applied to this version)
- Added additional weak dependencies (AMQP and MongoDB)

* Sat Apr  2 2016 Remi Collet <remi@remirepo.net> - 1.18.2-1
- update to 1.18.2

* Fri Apr 01 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.18.1-2
- Increased PSR log min version for autoloader
- Updated autoloader
- Added weak dependencies

* Fri Mar 25 2016 Remi Collet <remi@remirepo.net> - 1.18.1-1
- update to 1.18.1
- use php-swiftmailer instead of old php-swift-Swift
- install optional dependencies during the build for tests
- add patch for missing property, breaking test suite
  open https://github.com/Seldaek/monolog/pull/757

* Thu Oct 15 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.17.2-1
- Updated to 1.17.2 (RHBZ #1271882)

* Thu Oct 15 2015 Remi Collet <remi@remirepo.net> - 1.17.2-1
- update to 1.17.2

* Sun Sep 13 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.17.1-1
- Updated to 1.17.1 (RHBZ #1258230)

* Tue Aug 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.16.0-1
- Updated to 1.16.0 (RHBZ #1251783)
- Updated autoloader to load dependencies after self registration

* Mon Aug 10 2015 Remi Collet <remi@remirepo.net> - 1.16.0-1
- update to 1.16.0

* Mon Jul 20 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.15.0-2
- Fix autoloader

* Sun Jul 19 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.15.0-1
- Updated to 1.15.0 (RHBZ #1199105)
- Added autoloader

* Sun Jan 04 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.12.0-1
- Updated to 1.12.0 (BZ #1178410)

* Sun Nov  9 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.11.0-1
- Updated to 1.11.0 (BZ #1148336)
- Added php-composer(psr/log-implementation) virtual provide
- %%license usage

* Sun Jun  8 2014 Remi Collet <RPMS@famillecollet.com> 1.10.0-1
- backport 1.10.0 for remi repo

* Sat Jun 07 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.10.0-1
- Updated to 1.10.0 (BZ #1105816)
- Removed max PHPUnit dependency
- Added php-composer(monolog/monolog) virtual provide

* Mon Apr 28 2014 Remi Collet <RPMS@famillecollet.com> 1.9.1-1
- backport 1.9.1 for remi repo

* Fri Apr 25 2014 Shawn Iwinski <shawn.iwinski@gmail.com> 1.9.1-1
- Updated to 1.9.1 (BZ #1080872)
- Added option to build without tests ("--without tests")

* Thu Jan 16 2014 Shawn Iwinski <shawn.iwinski@gmail.com> 1.7.0-3
- Properly obsolete sub-packages

* Wed Jan 15 2014 Shawn Iwinski <shawn.iwinski@gmail.com> 1.7.0-2
- Removed sub-packages (optional dependencies note in description instead)

* Mon Dec 30 2013 Remi Collet <RPMS@famillecollet.com> 1.7.0-1
- backport 1.7.0 for remi repo

* Mon Dec 30 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.7.0-1
- Updated to 1.7.0 (BZ #1030923)
- Added dynamo sub-package
- Spec cleanup

* Tue Aug 20 2013 Remi Collet <RPMS@famillecollet.com> 1.6.0-1
- backport 1.6.0 for remi repo

* Sat Aug 17 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.6.0-1
- Updated to version 1.6.0
- Added phpcompatinfo build requires
- php-common -> php(language)
- No conditional php-filter require
- Added php-hash require
- Global raven min and max versions
- Removed MongoDBHandlerTest because it requires a running MongoDB server

* Tue Apr  2 2013 Remi Collet <RPMS@famillecollet.com> 1.4.1-1
- backport 1.4.1 for remi repo

* Mon Apr 01 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.4.1-1
- Updated to version 1.4.1
- Updates for "new" Fedora GitHub guidelines
- Updated summary and description
- Added php-PsrLog require
- Added tests (%%check)
- Removed tests sub-package
- Added raven sub-package

* Sun Nov 25 2012 Remi Collet <RPMS@famillecollet.com> 1.2.1-1
- backport 1.2.1 for remi repo

* Sat Nov 17 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 1.2.1-1
- Updated to upstream version 1.2.1
- Changed %%{libname} from monolog to Monolog
- Fixed license
- GitHub archive source
- Added php-pear(pear.swiftmailer.org/Swift), php-curl, and php-sockets requires
- Added optional packages note in %%{description}
- Simplified %%prep
- Added subpackages for AMQP and MongoDB handlers
- Changed RPM_BUILD_ROOT to %%{buildroot}

* Sun Jul 22 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 1.1.0-1
- Initial package