summaryrefslogtreecommitdiffstats
path: root/php-symfony-monolog-bundle.spec
blob: 30a09bb0048e540945ea084a5dc18d33a93816f2 (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
# remirepo/fedora spec file for php-symfony-monolog-bundle
#
# Copyright (c) 2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    572e143afc03419a75ab002c80a2fd99299195ff
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     symfony
%global gh_project   monolog-bundle
# Packagist
%global pk_vendor    %{gh_owner}
%global pk_project   %{gh_project}
# Namespace
%global ns_vendor    Symfony
%global ns_sub       Bundle
%global ns_project   MonologBundle
%global php_home     %{_datadir}/php
# Test
%global with_tests   0%{!?_without_tests:1}

Name:           php-%{pk_vendor}-%{pk_project}
Version:        3.3.1
Release:        1%{?gh_date:.%{gh_date}git%{gh_short}}%{?dist}
Summary:        Symfony MonologBundle

License:        MIT
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{?gh_short}.tar.gz

BuildArch:      noarch
%if %{with_tests}
# For tests
BuildRequires:  php(language) >= 5.6
BuildRequires:  php-json
BuildRequires:  php-pcre
BuildRequires:  php-spl
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >=8
BuildRequires: (php-composer(%{pk_vendor}/monolog-bridge)       >= 2.7    with php-composer(%{pk_vendor}/monolog-bridge)       < 5)
BuildRequires: (php-composer(%{pk_vendor}/dependency-injection) >= 2.7    with php-composer(%{pk_vendor}/dependency-injection) < 5)
BuildRequires: (php-composer(%{pk_vendor}/config)               >= 2.7    with php-composer(%{pk_vendor}/config)               < 5)
BuildRequires: (php-composer(%{pk_vendor}/http-kernel)          >= 2.7    with php-composer(%{pk_vendor}/http-kernel)          < 5)
BuildRequires: (php-composer(monolog/monolog)                   >= 1.22   with php-composer(monolog/monolog)                   < 2)
# remirepo:7
%else
BuildRequires:  php-symfony3-monolog-bridge         >= 3.3
BuildRequires:  php-symfony3-dependency-injection   >= 3.3
BuildRequires:  php-symfony3-config                 >= 3.3
BuildRequires:  php-symfony3-http-kernel            >= 3.3
BuildRequires:  php-Monolog                         >= 1.22
%endif
# From composer.json, "require-dev": {
#        "symfony/yaml": "~2.7|~3.3|~4.0",
#        "symfony/console": "~2.7|~3.3|~4.0",
#        "symfony/phpunit-bridge": "^3.3|^4.0"
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >=8
%global phpunit %{_bindir}/phpunit7
BuildRequires: (php-composer(%{pk_vendor}/yaml)                 >= 2.7    with php-composer(%{pk_vendor}/yaml)                 < 5)
BuildRequires: (php-composer(%{pk_vendor}/console)              >= 2.7    with php-composer(%{pk_vendor}/console)              < 5)
BuildRequires: (php-composer(%{pk_vendor}/phpunit-bridge)       >= 2.7    with php-composer(%{pk_vendor}/phpunit-bridge)       < 5)
# remirepo:6
%else
%global phpunit %{_bindir}/phpunit
BuildRequires:  php-symfony3-yaml                   >= 3.3
BuildRequires:  php-symfony3-console                >= 3.3
BuildRequires:  php-symfony3-phpunit-bridge         >= 3.3
%endif
BuildRequires: %{phpunit}
# Autoloader
BuildRequires:  php-composer(fedora/autoloader)
%endif

# From composer.json, "require": {
#        "php": ">=5.6",
#        "symfony/monolog-bridge": "~2.7|~3.3|~4.0",
#        "symfony/dependency-injection": "~2.7|~3.4.10|^4.0.10",
#        "symfony/config": "~2.7|~3.3|~4.0",
#        "symfony/http-kernel": "~2.7|~3.3|~4.0",
#        "monolog/monolog": "~1.22"
Requires:       php(language) >= 5.6
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >=8
Requires:      (php-composer(%{pk_vendor}/monolog-bridge)       >= 2.7    with php-composer(%{pk_vendor}/monolog-bridge)       < 5)
Requires:      (php-composer(%{pk_vendor}/dependency-injection) >= 2.7    with php-composer(%{pk_vendor}/dependency-injection) < 5)
Requires:      (php-composer(%{pk_vendor}/config)               >= 2.7    with php-composer(%{pk_vendor}/config)               < 5)
Requires:      (php-composer(%{pk_vendor}/http-kernel)          >= 2.7    with php-composer(%{pk_vendor}/http-kernel)          < 5)
Requires:      (php-composer(monolog/monolog)                   >= 1.22   with php-composer(monolog/monolog)                   < 2)
# remirepo:7
%else
Requires:       php-symfony3-monolog-bridge         >= 3.3
Requires:       php-symfony3-dependency-injection   >= 3.3
Requires:       php-symfony3-config                 >= 3.3
Requires:       php-symfony3-http-kernel            >= 3.3
Requires:       php-Monolog                         >= 1.22
%endif
# From phpcompatinfo report for version 3.3.1
Requires:       php-json
Requires:       php-pcre
Requires:       php-spl
# Autoloader
Requires:       php-composer(fedora/autoloader)

Provides:       php-composer(%{pk_vendor}/%{pk_project}) = %{version}


%description
The MonologBundle provides integration of the Monolog library
into the Symfony framework.

Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_sub}/%{ns_project}/autoload.php


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


%build
: Create autoloader
cat <<'AUTOLOAD' | tee autoload.php
<?php
/* Autoloader for %{name} and its dependencies */
require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_sub}\\%{ns_project}\\', __DIR__);
\Fedora\Autoloader\Dependencies::required([
    [
        '%{_datadir}/php/Symfony4/Bridge/Monolog/autoload.php',
        '%{_datadir}/php/Symfony3/Bridge/Monolog/autoload.php',
        '%{_datadir}/php/Symfony/Bridge/Monolog/autoload.php',
    ],
    [
        '%{_datadir}/php/Symfony4/Component/DependencyInjection/autoload.php',
        '%{_datadir}/php/Symfony3/Component/DependencyInjection/autoload.php',
        '%{_datadir}/php/Symfony/Component/DependencyInjection/autoload.php',
    ],
    [
        '%{_datadir}/php/Symfony4/Component/Config/autoload.php',
        '%{_datadir}/php/Symfony3/Component/Config/autoload.php',
        '%{_datadir}/php/Symfony/Component/Config/autoload.php',
    ],
    [
        '%{_datadir}/php/Symfony4/Component/HttpKernel/autoload.php',
        '%{_datadir}/php/Symfony3/Component/HttpKernel/autoload.php',
        '%{_datadir}/php/Symfony/Component/HttpKernel/autoload.php',
    ],
    '%{_datadir}/php/Monolog/autoload.php',
]);
AUTOLOAD


%install
mkdir -p                   %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_sub}/%{ns_project}
for i in *php DependencyInjection Resources SwiftMailer
do
  cp -pr $i                 %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_sub}/%{ns_project}/$i
done


%check
%if %{with_tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
require_once '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_sub}/%{ns_project}/autoload.php';
\Fedora\Autoloader\Dependencies::required([
    [
        '%{_datadir}/php/Symfony4/Component/Yaml/autoload.php',
        '%{_datadir}/php/Symfony3/Component/Yaml/autoload.php',
        '%{_datadir}/php/Symfony/Component/Yaml/autoload.php',
    ], [
        '%{_datadir}/php/Symfony4/Component/Console/autoload.php',
        '%{_datadir}/php/Symfony3/Component/Console/autoload.php',
        '%{_datadir}/php/Symfony/Component/Console/autoload.php',
    ], [
        '%{_datadir}/php/Symfony4/Bridge/PhpUnit/autoload.php',
        '%{_datadir}/php/Symfony3/Bridge/PhpUnit/autoload.php',
        '%{_datadir}/php/Symfony/Bridge/PhpUnit/autoload.php',
    ],
]);
EOF

ret=0
for cmd in php php71 php72 php73; do
  if which $cmd; then
    $cmd %{phpunit} \
      --no-coverage \
      --verbose
  fi
done
exit $ret
%else
: Test suite disabled
%endif


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
%doc *.md
%dir %{php_home}/%{ns_vendor}/
%dir %{php_home}/%{ns_vendor}/%{ns_sub}
     %{php_home}/%{ns_vendor}/%{ns_sub}/%{ns_project}


%changelog
* Wed Nov 28 2018 Remi Collet <remi@remirepo.net> - 3.3.1-1
- initial package, version 3.3.1