summaryrefslogtreecommitdiffstats
path: root/php-nrk-Predis.spec
blob: 3a50beec41057e9f77e1b99a7932bbe8046c6738 (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
# remirepo/fedora spec file for php-nrk-Predis
#
# Copyright (c) 2013-2016 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%{!?__pear: %global __pear %{_bindir}/pear}
%global pear_name    Predis
%global pear_channel pear.nrk.io

%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}
%else
%global with_tests   %{?_with_tests:1}%{!?_with_tests:0}
%endif

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

Group:          Development/Libraries
License:        MIT
URL:            http://%{pear_channel}
Source0:        http://%{pear_channel}/get/%{pear_name}-%{version}.tgz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  php(language) >= 5.3.9
BuildRequires:  php-pear(PEAR)
BuildRequires:  php-channel(%{pear_channel})
%if %{with_tests}
BuildRequires:  php-phpunit-PHPUnit
BuildRequires:  redis > 2.8
%endif

Requires(post): %{__pear}
Requires(postun): %{__pear}
Requires:       php(language) >= 5.3.9
Requires:       php-reflection
Requires:       php-curl
Requires:       php-filter
Requires:       php-pcre
Requires:       php-session
Requires:       php-sockets
Requires:       php-spl
Requires:       php-pear(PEAR)
Requires:       php-channel(%{pear_channel})

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


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


%prep
%setup -q -c

cd %{pear_name}-%{version}
mv ../package.xml %{name}.xml


%build
cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.


%install
rm -rf %{buildroot}
cd %{pear_name}-%{version}
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml

# Clean up unnecessary files
rm -rf %{buildroot}%{pear_metadir}/.??*

# Install XML package description
mkdir -p %{buildroot}%{pear_xmldir}
install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}

# Relocate PATH so test suite can be run from install dir
sed -e 's:tests/::' \
    %{buildroot}%{pear_testdir}/%{pear_name}/phpunit.xml.dist \
  > %{buildroot}%{pear_testdir}/%{pear_name}/phpunit.xml


%check
%if %{with_tests}

: Launch redis server
pidfile=$PWD/run/redis/redis.pid
mkdir -p {run,log,lib}/redis
sed -e "s:/var:$PWD:" \
    /etc/redis.conf >redis.conf
%{_bindir}/redis-server \
    ./redis.conf \
    --daemonize yes \
    --pidfile $pidfile

: Run the installed test Suite against the installed library
pushd %{buildroot}%{pear_testdir}/%{pear_name}
ret=0
%{_bindir}/phpunit --include-path=%{buildroot}%{pear_phpdir} || ret=1

if which php71; then
   php71 %{_bindir}/phpunit --include-path=%{buildroot}%{pear_phpdir} || ret=1
fi
popd

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

exit $ret
%else
: Test disabled
%endif


%clean
rm -rf %{buildroot}


%post
%{__pear} install --nodeps --soft --force --register-only \
    %{pear_xmldir}/%{name}.xml >/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    %{__pear} uninstall --nodeps --ignore-errors --register-only \
        %{pear_channel}/%{pear_name} >/dev/null || :
fi


%files
%defattr(-,root,root,-)
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{name}.xml
%{pear_phpdir}/%{pear_name}
%{pear_testdir}/%{pear_name}


%changelog
* 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