summaryrefslogtreecommitdiffstats
path: root/php-webimpress-http-middleware-compatibility.spec
blob: d5849c06200bf4db1f0ce380e772c7f56a07979d (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
# remirepo/fedora spec file for php-webimpress-http-middleware-compatibility
#
# Copyright (c) 2020-2021 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    8ed1c2c7523dce0035b98bc4f3a73ca9cd1d3717
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     webimpress
%global gh_project   http-middleware-compatibility
# Packagist
%global pk_vendor    %{gh_owner}
%global pk_project   %{gh_project}
%global major        %nil

Name:           php-%{pk_vendor}-%{pk_project}%{major}
Version:        0.1.4
Release:        6%{?dist}
Summary:        Compatibility library for Draft PSR-15 HTTP Middleware

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

BuildArch:      noarch
%if %{with tests}
BuildRequires:  php(language) >= 5.4
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires: (php-composer(http-interop/http-middleware) > 0.1.1 with php-composer(http-interop/http-middleware) < 0.6)
# For tests, from composer.json "require-dev": {
#        "phpunit/phpunit": "^5.7.23 || ^6.4.3"
# remirepo:3
%else
BuildRequires:  php-composer(http-interop/http-middleware)
%endif
BuildRequires:  phpunit9
%global phpunit %{_bindir}/phpunit9
%endif

# From composer.json, "require": {
#        "php": "^5.6 || ^7.0",
#        "http-interop/http-middleware": "^0.1.1 || ^0.2 || ^0.3 || ^0.4.1 || ^0.5",
#        "webimpress/composer-extra-dependency": "^0.2.2"
Requires:       php(language) >= 5.6
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:      (php-composer(http-interop/http-middleware) > 0.1.1 with php-composer(http-interop/http-middleware) < 0.6)
# remirepo:3
%else
Requires:       php-composer(http-interop/http-middleware)
%endif
# From phpcompatinfo report for 0.1.4
# Only core

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


%description
The purpose of the library is to deliver consistent interface for
different versions of http-interop/http-middleware which implements
Draft of PSR-15 HTTP Middleware.

Many projects currently use different version of library
http-interop/http-middleware and updating to newest version requires
usually major release. The library lets consumers of your component
decide what version of http-interop/http-middleware they want to use
and allow them to migrate to the latest version at any time.

Autoloader: %{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}/autoload.php


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

mv LICENSE.md LICENSE


%build
cat << 'EOF' | tee autoload/autoload.php
<?php
require_once '%{_datadir}/php/Interop/Http/Middleware/autoload.php';
require_once __DIR__ . '/http-middleware.php';
EOF


%install
: Library
mkdir -p        %{buildroot}%{_datadir}/php/%{pk_vendor}/
cp -pr autoload %{buildroot}%{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}


%check
%if %{with tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
require '%{buildroot}%{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}/autoload.php';
EOF

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


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
%doc *.md
%dir %{_datadir}/php/%{pk_vendor}/
     %{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}


%changelog
* Tue Mar 23 2021 Remi Collet <remi@remirepo.net> - 0.1.4-6
- switch to phpunit9

* Tue Jan 14 2020 Remi Collet <remi@remirepo.net> - 0.1.4-2
- own /usr/share/php/webimpress #1789783

* Fri Jan 10 2020 Remi Collet <remi@remirepo.net> - 0.1.4-1
- initial package