summaryrefslogtreecommitdiffstats
path: root/php-nrk-Predis.spec
blob: 1881b2823884e41707554c405a9d81cbff220933 (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
# remirepo/fedora spec file for php-nrk-Predis
#
# Copyright (c) 2013-2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%if 0%{?fedora} >= 31 || 0%{?rhel} >= 8
%bcond_without  tests
%else
%bcond_with     tests
%endif

%global gh_owner     nrk
%global gh_project   predis
%global gh_commit    8be2418f0116572f1937083daf5cceb1bddc9f0d
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})

%global ns_project   Predis

%global pear_name    Predis
%global pear_channel pear.nrk.io

Name:           php-nrk-Predis
Version:        1.1.4
Release:        1%{?dist}
Summary:        PHP client library for Redis

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

BuildArch:      noarch
BuildRequires:  php(language) >= 5.3.9
%if %{with tests}
BuildRequires:  php-phpunit-PHPUnit
BuildRequires:  redis
%endif

Requires:       php(language) >= 5.3.9
Requires:       php-reflection
Requires:       php-filter
Requires:       php-pcre
Requires:       php-session
Requires:       php-sockets
Requires:       php-spl
%if 0%{?fedora} >= 30 || 0%{?rhel} >=8
Recommends:     php-curl
Recommends:     php-phpiredis
%endif

Provides:       php-pear(%{pear_channel}/%{pear_name}) = %{version}
Provides:       php-composer(predis/predis) = %{version}

# This pkg was the only one in this channel so the channel is no longer needed
Obsoletes:     php-channel-nrk < 1.4


%description
Flexible and feature-complete PHP client library for Redis.


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


%build
: nothing

%install
mkdir -p   %{buildroot}%{_datadir}/php/
cp -pr src %{buildroot}%{_datadir}/php/%{ns_project}

# for compatibility with PEAR installation
mkdir -p   %{buildroot}%{_datadir}/pear/%{ns_project}
ln -s ../../php/Predis/Autoloader.php %{buildroot}%{_datadir}/pear/%{ns_project}/Autoloader.php


%check
%if %{with tests}
: Launch redis server
port=$(expr 6379 + %{?fedora}%{?rhel})
pidfile=$PWD/redis.pid
mkdir -p data
redis-server                   \
    --bind      127.0.0.1      \
    --port      $port          \
    --daemonize yes            \
    --logfile   $PWD/redis.log \
    --dir       $PWD/data      \
    --pidfile   $pidfile

: Run the installed test Suite against the installed library
sed -e "s/6379/$port/" phpunit.xml.dist > phpunit.xml
sed -e "/expectedExceptionMessageRegExp/s/6379/$port/" -i tests/PHPUnit/PredisConnectionTestCase.php

# testReturnsCommandInfoOnExistingCommand failing on recent Redis version

ret=0
php -d memory_limit=1G %{_bindir}/phpunit \
    --include-path=%{buildroot}%{_datadir}/pear \
    --filter '^((?!(testReturnsCommandInfoOnExistingCommand)).)*$' \
    --verbose || ret=1

: Cleanup
if [ -f $pidfile ]; then
   kill $(cat $pidfile)
fi

exit $ret
%else
: Test disabled
%endif


%pre
if [ -x %{_bindir}/pear ]; then
   %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
      %{pear_channel}/%{pear_name} >/dev/null || :
fi


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
%doc *md
%doc examples
%{_datadir}/php/%{ns_project}
%{_datadir}/pear/%{ns_project}


%changelog
* Mon Aug 31 2020 Remi Collet <remi@remirepo.net> - 1.1.4-1
- update to 1.1.4

* Wed Aug 19 2020 Remi Collet <remi@remirepo.net> - 1.1.3-1
- update to 1.1.3 (no change)

* Wed Aug 12 2020 Remi Collet <remi@remirepo.net> - 1.1.2-1
- update to 1.1.2
- sources from git snapshot
- obsolete php-channel-nrk
- drop dependency on pear
- move to /usr/share/php with autoloader link for BC

* Tue Feb 13 2018 Remi Collet <remi@remirepo.net> - 1.1.1-5
- fix FTBFS from Koschei with patch from
  https://github.com/nrk/predis/pull/486

* Thu Nov 17 2016 Remi Collet <remi@fedoraproject.org> - 1.1.1-2
- fix bootstraping to redis server for test suite
- add patch for PHP 7.1
- open https://github.com/nrk/predis/pull/393

* Fri Jun 17 2016 Remi Collet <remi@fedoraproject.org> - 1.1.1-1
- Update to 1.1.1

* Tue Jun 07 2016 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- Update to 1.1.0

* Tue May 31 2016 Remi Collet <remi@fedoraproject.org> - 1.0.4-1
- Update to 1.0.4

* Fri Jul 31 2015 Remi Collet <remi@fedoraproject.org> - 1.0.3-1
- Update to 1.0.3

* Thu Jul 30 2015 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
- Update to 1.0.2

* Fri Jan 02 2015 Remi Collet <remi@fedoraproject.org> - 1.0.1-1
- Update to 1.0.1

* Mon Nov 03 2014 Remi Collet <remi@fedoraproject.org> - 1.0.0-1
- Update to 1.0.0
- upstream patch for tests

* Wed Jul 16 2014 Remi Collet <remi@fedoraproject.org> - 0.8.6-1
- Update to 0.8.6
- provides php-composer(predis/predis)
- enable test suite in EL-7

* Thu Jan 16 2014 Remi Collet <remi@fedoraproject.org> - 0.8.5-1
- Update to 0.8.5 (stable)

* Wed Jan  8 2014 Remi Collet <remi@fedoraproject.org> - 0.8.5-0
- Update to 0.8.5 (test build)

* Sun Jul 28 2013 Remi Collet <remi@fedoraproject.org> - 0.8.4-1
- Update to 0.8.4

* Wed Jul  3 2013 Remi Collet <remi@fedoraproject.org> - 0.8.3-2
- fixed sources, https://github.com/nrk/predis/issues/125

* Wed Jun  5 2013 Remi Collet <remi@fedoraproject.org> - 0.8.3-1
- initial package