blob: 7579ba877701524bf2bba8e81574936a948371a9 (
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
|
# remirepo/fedora spec file for php-williamdes-mariadb-mysql-kbs
#
# Copyright (c) 2019-2024 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%bcond_without tests
# Github
%global gh_commit 07106dab252127c329cc206cd79cf2f51f989e5e
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner williamdes
%global gh_project mariadb-mysql-kbs
# Packagist
%global pk_vendor %{gh_owner}
%global pk_project %{gh_project}
# Namespace
%global ns_vendor Williamdes
%global ns_project MariaDBMySQLKBS
%global major %nil
Name: php-%{pk_vendor}-%{pk_project}%{major}
Version: 1.3.0
Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary: An index of the MariaDB and MySQL Knowledge bases
License: MPL-2.0
URL: https://github.com/%{gh_owner}/%{gh_project}
# pull from github to retrieve full data
Source0: %{name}-%{version}-%{?gh_short}.tgz
Source1: makesrc.sh
Patch0: %{name}-layout.patch
BuildArch: noarch
%if %{with tests}
BuildRequires: php(language) >= 7.2
BuildRequires: php-json
BuildRequires: php-pcre
# For tests, from composer.json "require-dev": {
# "phpunit/phpunit": "^8 || ^9 || ^10 || ^11"",
# "phpstan/phpstan": "^1.2",
# "wdes/coding-standard": "^3.2.1",
# "swaggest/json-schema": "^0.12.29"
BuildRequires: phpunit10
%global phpunit %{_bindir}/phpunit10
BuildRequires: (php-composer(swaggest/json-schema) >= 0.12.29 with php-composer(swaggest/json-schema) < 1)
# For autoloader
BuildRequires: php-composer(fedora/autoloader)
%endif
# From composer.json, "require": {
# "php": "^7.2 || ^8.0"
Requires: php(language) >= 7.2
# From phpcompatinfo report for 1.2.7
Requires: php-json
Requires: php-pcre
# For generated autoloader
Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
%description
An index of the MariaDB and MySQL Knowledge bases.
Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
%patch -P0 -p1 -b .rpm
find src -name \*.rpm -delete
: Create autoloader
cat <<'AUTOLOAD' | tee src/autoload.php
<?php
/* Autoloader for %{name} and its dependencies */
require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__);
AUTOLOAD
%build
: Generate merged data
%{_bindir}/php -d auto_prepend_file=src/autoload.php src/merge.php
%install
: Library
mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
: Data
mkdir -p %{buildroot}%{_datadir}/%{name}
# only dist is used at runtime
cp -pr dist %{buildroot}%{_datadir}/%{name}/dist
cp -pr data %{buildroot}%{_datadir}/%{name}/data
cp -pr schemas %{buildroot}%{_datadir}/%{name}/schemas
%check
%if %{with tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Test\\', dirname(__DIR__).'/test');
require '%{_datadir}/php/Swaggest/JsonSchema/autoload.php';
EOF
export RPM_BUILDROOT=%{buildroot}
ret=0
for cmdarg in "php %{phpunit}" php81 php82 php83 php84; do
if which $cmdarg; then
set $cmdarg
$1 ${2:-%{_bindir}/phpunit10} --no-coverage || ret=1
fi
done
exit $ret
%else
: Test suite disabled
%endif
%files
%license LICENSE
%doc composer.json
%doc *.md
%dir %{_datadir}/php/%{ns_vendor}/
%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
%exclude %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/merge.php
%exclude %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/rust
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/dist
%doc %{_datadir}/%{name}/data
%doc %{_datadir}/%{name}/schemas
%changelog
* Mon Jul 8 2024 Remi Collet <remi@remirepo.net> - 1.3.0-1
- update to 1.3.0
* Wed Dec 7 2022 Remi Collet <remi@remirepo.net> - 1.2.14-1
- update to 1.2.14
* Mon Dec 20 2021 Remi Collet <remi@remirepo.net> - 1.2.13-1
- update to 1.2.13
* Mon Jan 4 2021 Remi Collet <remi@remirepo.net> - 1.2.12-1
- update to 1.2.12
* Mon Sep 14 2020 Remi Collet <remi@remirepo.net> - 1.2.11-1
- update to 1.2.11
- switch to phpunit9
* Thu Feb 27 2020 Remi Collet <remi@remirepo.net> - 1.2.10-1
- update to 1.2.10
- sources from git snapshot
* Mon Jan 27 2020 Remi Collet <remi@remirepo.net> - 1.2.9-1
- update to 1.2.9
- switch to phpunit8
* Tue Nov 12 2019 Remi Collet <remi@remirepo.net> - 1.2.8-1
- update to 1.2.8
* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 1.2.7-1
- initial package
|