-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmemcached.spec
299 lines (232 loc) · 8.21 KB
/
memcached.spec
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
%define selinux_variants mls strict targeted
%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp)
%define modulename memcached
%define username memcached
%define groupname memcached
Name: memcached
Version: 1.4.5
Release: 1%{?dist}
Summary: High Performance, Distributed Memory Object Cache
Group: System Environment/Daemons
License: BSD
URL: http://memcached.org/
#Source0: http://www.danga.com/memcached/dist/%{name}-%{version}.tar.gz
Source0: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
# custom init script
Source1: memcached.sysv.patched
# SELinux files
Source10: %{modulename}.te
Source11: %{modulename}.fc
Source12: %{modulename}.if
Patch0: memcached-test.patch
#Patch1: memcached-macro.patch
# Fixes
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libevent-devel
BuildRequires: perl(Test::More)
Requires: initscripts
Requires: libevent
Requires(pre): shadow-utils
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(postun): /sbin/service
%description
memcached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load.
%if %{?rhel} == 5
%package selinux
Summary: SELinux policy module supporting memcached
Group: System Environment/Base
BuildRequires: checkpolicy, selinux-policy-devel, hardlink
%if "%{selinux_policyver}" != ""
Requires: selinux-policy >= %{selinux_policyver}
%endif
Requires: %{name} = %{version}-%{release}
Requires(post): policycoreutils
Requires(postun): policycoreutils
%description selinux
SELinux policy module supporting memcached.
%endif%
%package devel
Summary: Files needed for development using memcached protocol
Group: Development/Libraries
%description devel
Install memcached-devel if you are developing C/C++ applications that require access to the
memcached binary include files.
%prep
%setup -q
%patch0 -p0 -b .test
#%patch1 -p0 -b .macro
%if %{?rhel} == 5
mkdir SELinux
cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} SELinux/
%endif%
%build
%configure
make %{?_smp_mflags}
%if %{?rhel} == 5
pushd SELinux
for selinuxvariant in %{selinux_variants}; do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
popd
%endif%
%check
# remove failing test that doesn't work in
# build systems
rm -f t/daemonize.t
make test
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
# remove memcached-debug
rm -f %{buildroot}/%{_bindir}/memcached-debug
# Perl script for monitoring memcached
install -Dp -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool
# Init script
install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/memcached
# Default configs
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
cat <<EOF >%{buildroot}/%{_sysconfdir}/sysconfig/%{name}
PORT="11211"
USER="%{username}"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
EOF
# pid directory
mkdir -p %{buildroot}/%{_localstatedir}/run/memcached
%if %{?rhel} == 5
# Install SELinux policy modules
pushd SELinux
for selinuxvariant in %{selinux_variants}; do
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 %{modulename}.pp.${selinuxvariant} \
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
done
popd
# Hardlink identical policy module packages together
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
%endif%
%clean
rm -rf %{buildroot}
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d %{_localstatedir}/run/memcached \
-s /sbin/nologin -c "Memcached daemon" %{username}
exit 0
%post
/sbin/chkconfig --add %{name}
%preun
if [ "$1" = 0 ] ; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
exit 0
%postun
if [ "$1" -ge 1 ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1
fi
exit 0
%if %{?rhel} == 5
%post selinux
# Install SELinux policy modules
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
done
/usr/sbin/semanage port -a -t memcached_port_t -p tcp 11211 &> /dev/null || :
/sbin/fixfiles -R %{name} restore || :
%postun selinux
# Clean up after package removal
if [ $1 -eq 0 ]; then
/usr/sbin/semanage port -d -t memcached_port_t -p tcp 11211 &> /dev/null || :
# Remove SELinux policy modules
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
done
/sbin/fixfiles -R %{name} restore || :
fi
%endif%
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README doc/CONTRIBUTORS doc/*.txt
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%dir %attr(755,%{username},%{groupname}) %{_localstatedir}/run/memcached
%{_bindir}/memcached-tool
%{_bindir}/memcached
%{_mandir}/man1/memcached.1*
%{_initrddir}/memcached
%if %{?rhel} == 5
%files selinux
%defattr(-,root,root,0755)
%doc SELinux/*.te SELinux/*.fc SELinux/*.if
%{_datadir}/selinux/*/%{modulename}.pp
%endif%
%files devel
%defattr(-,root,root,0755)
%{_includedir}/memcached/*
%changelog
* Mon Apr 19 2010 David Hrbáč <[email protected]> - 1.4.5-1
- new upstream version
* Sun Nov 29 2009 David Hrbáč <[email protected]> - 1.4.4-1
- new upstream version
* Wed Nov 18 2009 David Hrbáč <[email protected]> - 1.4.3-1
- new upstream version
* Tue Oct 13 2009 David Hrbáč <[email protected]> - 1.4.2-1
- new upstream version
* Fri Sep 18 2009 David Hrbáč <[email protected]> - 1.4.1-2
- patched init script to work
* Mon Sep 14 2009 David Hrbáč <[email protected]> - 1.4.1-1
- initial rebuild
- patch to tests
- C5 build patch
* Sat Aug 29 2009 Paul Lindner <[email protected]> - 1.4.1-1
- Upgrade to 1.4.1
- http://code.google.com/p/memcached/wiki/ReleaseNotes141
* Wed Apr 29 2009 Paul Lindner <[email protected]> - 1.2.8-1
- Upgrade to memcached-1.2.8
- Addresses CVE-2009-1255
* Wed Feb 25 2009 Fedora Release Engineering <[email protected]> - 1.2.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Jul 29 2008 Paul Lindner <[email protected]> - 1.2.6-1
- Upgrade to memcached-1.2.6
* Tue Mar 4 2008 Paul Lindner <[email protected]> - 1.2.5-1
- Upgrade to memcached-1.2.5
* Tue Feb 19 2008 Fedora Release Engineering <[email protected]> - 1.2.4-4
- Autorebuild for GCC 4.3
* Sun Jan 27 2008 Paul Lindner <[email protected]> - 1.2.4-3
- Adjust libevent dependencies
* Sat Dec 22 2007 Paul Lindner <[email protected]> - 1.2.4-2
- Upgrade to memcached-1.2.4
* Fri Sep 07 2007 Konstantin Ryabitsev <[email protected]> - 1.2.3-8
- Add selinux policies
- Create our own system user
* Mon Aug 6 2007 Paul Lindner <[email protected]> - 1.2.3-7
- Fix problem with -P and -d flag combo on x86_64
- Fix init script for FC-6
* Fri Jul 13 2007 Paul Lindner <[email protected]> - 1.2.3-4
- Remove test that fails in fedora build system on ppc64
* Sat Jul 7 2007 root <[email protected]> - 1.2.3-2
- Upgrade to 1.2.3 upstream
- Adjust make install to preserve man page timestamp
- Conform with LSB init scripts standards, add force-reload
* Wed Jul 4 2007 Paul Lindner <[email protected]> - 1.2.2-5
- Use /var/run/memcached/ directory to hold PID file
* Sat May 12 2007 Paul Lindner <[email protected]> - 1.2.2-4
- Remove tabs from spec file, rpmlint reports no more errors
* Thu May 10 2007 Paul Lindner <[email protected]> - 1.2.2-3
- Enable build-time regression tests
- add dependency on initscripts
- remove memcached-debug (not needed in dist)
- above suggestions from Bernard Johnson
* Mon May 7 2007 Paul Lindner <[email protected]> - 1.2.2-2
- Tidyness improvements suggested by Ruben Kerkhof in bugzilla #238994
* Fri May 4 2007 Paul Lindner <[email protected]> - 1.2.2-1
- Initial spec file created via rpmdev-newspec