Logoj0ke.net Open Build Service > Projects > Apache:Modules > apache2-mod_mirrorbrain > mirrorbrain.spec
Sign Up | Log In

File mirrorbrain.spec of Package apache2-mod_mirrorbrain

 
1
#
2
# spec file for package mirrorbrain
3
#
4
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
5
# This file and all modifications and additions to the pristine
6
# package are under the same license as the package itself.
7
#
8
# Please submit bugfixes or comments via http://bugs.opensuse.org/
9
#
10
11
# norootforbuild
12
13
%if %{defined suse_version}
14
%define apxs /usr/sbin/apxs2
15
BuildRequires:  apache2-devel apache2-prefork apache2-worker 
16
%endif
17
#
18
%if %{defined centos_version} || %{defined fedora_version}
19
%define apxs /usr/sbin/apxs
20
BuildRequires:  httpd-devel
21
%endif
22
#
23
BuildRequires:  GeoIP GeoIP-devel apache2-mod_form
24
BuildRequires:  python-devel 
25
#
26
%define apache apache2
27
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
28
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
29
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
30
%define apache_serverroot %(%{apxs} -q PREFIX)
31
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
32
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
33
#
34
Name:           mirrorbrain
35
Summary:        A download redirector and metalink generator
36
# to build a man page, we need to have the script functional, and thus we need more stuff
37
# but python-cmdln is not available
38
#BuildRequires:  help2man python-cmdln
39
Url:            http://mirrorbrain.org/
40
Packager:       Peter Poeml, poeml at mirrorbrain.org
41
Version:        2.18.1
42
Release:        0
43
License:        Apache License 2.0, GPL
44
Group:          Productivity/Networking/Web/Servers
45
#
46
# v=2.8.1+r7675; rm -rf mirrorbrain-$v; osc rm *.tar.gz; svn export -q 'http://svn.mirrorbrain.org/svn/mirrorbrain/trunk' mirrorbrain-$v; tar czf mirrorbrain-$v.tar.gz mirrorbrain-$v; osc add mirrorbrain-$v.tar.gz
47
Source:         http://mirrorbrain.org/files/releases/mirrorbrain-%{version}.tar.gz
48
#
49
%if %{defined suse_version}
50
PreReq:         pwdutils %insserv_prereq %fillup_prereq
51
%else
52
PreReq:         /usr/bin/getent /usr/bin/useradd /usr/bin/groupadd
53
%endif
54
#
55
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
56
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
57
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)")}
58
59
60
%description
61
This apache module redirects clients to mirror servers, using an SQL backend,
62
and generates metalinks.
63
64
See http://mirrorbrain.org/
65
66
Author: Peter Poeml <peter@poeml.de>
67
68
%package -n apache2-mod_mirrorbrain
69
License:        Apache License 2.0, GPL
70
Summary:        MirrorBrain redirector Apache module
71
Obsoletes:      apache2-mod_zrkadlo
72
Group:          Productivity/Networking/Web/Servers
73
# see http://mirrorbrain.org/requirements
74
%if %{defined suse_version}
75
Requires:       apache2 >= 2.2.6 
76
Requires:       %{apache_mmn} 
77
Requires:       libapr-util1 >= 1.3.0
78
Requires:       libapr-util1-dbd-pgsql
79
%else
80
Requires:       httpd
81
%endif
82
Requires:       GeoIP apache2-mod_geoip
83
#
84
# for mod_form
85
Requires:       apache2-mod_form
86
# building with memcache support:
87
%if %{?build_with_memcache:1}0
88
BuildRequires:  apache2-mod_memcache
89
Requires:       apache2-mod_memcache
90
%define memcache_cflags -DWITH_MEMCACHE
91
%else
92
%define memcache_cflags %nil
93
%endif
94
# this module was was split off in a separate package with 2.10.1. Require it
95
# so that existing installations will keep having it installed.
96
# the requires can be removed later (let's say, a few months after October '09)
97
Requires:       apache2-mod_autoindex_mb
98
Autoreqprov:    on
99
100
101
%description -n apache2-mod_mirrorbrain
102
MirrorBrain is a scalable download redirector.
103
104
This package contains mod_mirrorbrain, the Apache module which represents the
105
core of MirrorBrain.
106
107
108
%package -n apache2-mod_autoindex_mb
109
License:        Apache License 2.0, GPL
110
Summary:        Apache module generating directory indexes for MirrorBrain
111
Group:          Productivity/Networking/Web/Servers
112
%if %{defined suse_version}
113
Requires:       %{apache_mmn} 
114
%else
115
Requires:       httpd
116
%endif
117
Requires:       apache2-mod_mirrorbrain
118
Autoreqprov:    on
119
120
121
%description -n apache2-mod_autoindex_mb
122
123
This package contains mod_autoindex_mb, the Apache module which represents the
124
core of MirrorBrain.
125
126
This package contains mod_autoindex_mb, which is a patched mod_autoindex. It
127
adds a little further capability as index option.
128
129
It adds these two options:
130
131
        <IfModule mod_autoindex_mb.c>
132
            IndexOptions Metalink
133
            IndexOptions Mirrorlist
134
        </IfModule>
135
The Metalink option adds a link named "Metalink" to the index, which links to
136
the same file but with ".metalink" appended.
137
138
The MirrorList option adds a link named "Mirrors" to the index, which links to
139
the same resources but with "?mirrorlist" appended.
140
141
142
%package tools
143
License:        Apache License 2.0, GPL
144
Summary:        MirrorBrain commandline tools
145
Group:          Productivity/Networking/Web/Servers
146
Requires:       python-mb python-cmdln python-sqlobject python-psycopg2
147
Requires:       GeoIP 
148
149
%description tools
150
MirrorBrain is a scalable download redirector.
151
152
This package contains utilities provided by the MirrorBrain framework to
153
maintain the database and scan mirrors.
154
155
156
%package -n python-mb
157
License:        Apache License 2.0, GPL
158
Summary:        mb, a Python module used by the MirrorBrain commandline tools
159
Group:          Productivity/Networking/Web/Servers
160
Requires:       python-sqlobject python-psycopg2
161
Requires:       GeoIP 
162
%if %{defined suse_version}
163
%if 0%{?suse_version} < 110
164
Recommends:     python-processing
165
%endif
166
%endif
167
168
%description -n python-mb
169
MirrorBrain is a scalable download redirector.
170
171
This package contains a Python module (named "mb") for easily maintaining
172
MirrorBrain.
173
174
175
%package scanner
176
License:        Apache License 2.0, GPL
177
Summary:        MirrorBrain scanner
178
Group:          Productivity/Networking/Web/Servers
179
Requires:       perl-Config-IniFiles perl-libwww-perl perl-Digest-MD4 perl-DBD-Pg perl-TimeDate
180
181
%description scanner
182
MirrorBrain is a scalable download redirector.
183
184
This package contains the mirror scanner.
185
186
187
%prep
188
%setup -q -n mirrorbrain-%{version}
189
190
%build
191
cd mod_mirrorbrain
192
%{apxs} -c -Wc,"%memcache_cflags -Wall -g" -lm mod_mirrorbrain.c
193
cd ../mod_autoindex_mb
194
%{apxs} -c -Wc,"%memcache_cflags -Wall -g" mod_autoindex_mb.c
195
cd ../tools
196
gcc $RPM_OPT_FLAGS -Wall -o geoiplookup_continent geoiplookup_continent.c -lGeoIP
197
gcc $RPM_OPT_FLAGS -Wall -o geoiplookup_city geoiplookup_city.c -lGeoIP
198
cd ../mb
199
CFLAGS="%{optflags}" \
200
%{__python} setup.py build
201
202
203
%install
204
mkdir -p $RPM_BUILD_ROOT/%{apache_libexecdir}
205
cp -p mod_mirrorbrain/.libs/mod_mirrorbrain.so $RPM_BUILD_ROOT/%{apache_libexecdir}
206
cp -p mod_autoindex_mb/.libs/mod_autoindex_mb.so $RPM_BUILD_ROOT/%{apache_libexecdir}
207
# tools
208
install -D -m 755 tools/geoiplookup_continent $RPM_BUILD_ROOT/%{_bindir}/geoiplookup_continent
209
install -D -m 755 tools/geoiplookup_city $RPM_BUILD_ROOT/%{_bindir}/geoiplookup_city
210
install -D -m 755 tools/bdecode $RPM_BUILD_ROOT/%{_bindir}/bdecode
211
install -D -m 755 tools/rsyncinfo $RPM_BUILD_ROOT/%{_bindir}/rsyncinfo
212
install -D -m 755 tools/rsyncusers $RPM_BUILD_ROOT/%{_bindir}/rsyncusers
213
install -D -m 755 tools/geoip-lite-update $RPM_BUILD_ROOT/%{_bindir}/geoip-lite-update
214
install -D -m 755 tools/create_timestamp $RPM_BUILD_ROOT/%{_bindir}/create_timestamp
215
install -D -m 755 tools/null-rsync $RPM_BUILD_ROOT/%{_bindir}/null-rsync
216
# install -D -m 755 tools/push2mirrors $RPM_BUILD_ROOT/%{_bindir}/push2mirrors
217
install -D -m 755 tools/scanner.pl $RPM_BUILD_ROOT/%{_bindir}/scanner
218
install -D -m 755 mirrorprobe/mirrorprobe.py $RPM_BUILD_ROOT/%{_bindir}/mirrorprobe
219
install -D -m 755 tools/mirrorprobe-logrotate $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/mirrorprobe
220
cd mb
221
%{__python} setup.py install --prefix=%{_prefix} --root %{buildroot}
222
ln -s mb %{buildroot}/%{_bindir}/mirrordoctor # only for backwards compatibility; removal at end of 2010
223
# man page for mb tool
224
#%{buildroot}/%{_bindir}/mb --version
225
#help2man --no-info %{buildroot}/%{_bindir}/mb > mb.1
226
# Icons
227
mkdir -p $RPM_BUILD_ROOT/usr/share/mirrorbrain
228
cp -a famfamfam_flag_icons $RPM_BUILD_ROOT/usr/share/mirrorbrain/
229
# log directory
230
mkdir -p $RPM_BUILD_ROOT/%{_var}/log/mirrorbrain
231
232
%pre
233
if ! /usr/bin/getent group mirrorbrain &>/dev/null; then
234
  echo "Creating mirrorbrain group"
235
  /usr/sbin/groupadd -r mirrorbrain
236
fi
237
if ! /usr/bin/getent passwd mirrorbrain &>/dev/null; then
238
  echo "Creating mirrorbrain user"
239
  /usr/sbin/useradd -o -g mirrorbrain -s /bin/bash -r -c "MirrorBrain user" \
240
                    -d /home/mirrorbrain -m mirrorbrain
241
fi
242
243
%post
244
# move old mirrorprobe logfile to the new location
245
# Update ?
246
if [ ${1:-0} -gt 1 ]; then
247
  if [ -e /var/log/mirrorprobe.log ] && [ ! -e /var/log/mirrorbrain/mirrorprobe.log ]; then
248
    echo "moving /var/log/mirrorprobe.log to /var/log/mirrorbrain/"
249
    mv -v /var/log/mirrorprobe.log /var/log/mirrorbrain/
250
    echo "creating symlink at the old location (/var/log/mirrorprobe.log). You may remove it."
251
    ln -sv /var/log/mirrorbrain/mirrorprobe.log /var/log/mirrorprobe.log
252
    # adjust config, if the defaults were in use
253
    if grep -q '^logfile = /var/log/mirrorprobe.log' /etc/mirrorbrain.conf &>/dev/null; then
254
      echo "adjusting /etc/mirrorbrain.conf"
255
      sed -i 's,^logfile = /var/log/mirrorprobe.log,logfile = /var/log/mirrorbrain/mirrorprobe.log,' /etc/mirrorbrain.conf
256
      echo "/etc/mirrorbrain.conf was migrated to the new location"
257
    fi
258
  fi
259
260
  # create missing database tables that are needed with 2.13.0 and later
261
  if test -e /etc/mirrorbrain.conf && test -x /usr/bin/mb; then 
262
    echo "checking if new tables need to be added after upgrade"
263
    mb > /dev/null
264
  fi
265
fi
266
exit 0
267
268
269
%files
270
%defattr(-,root,root)
271
%doc COPYING FAQ TODO 
272
%doc mod_autoindex_mb/NOTICE
273
%doc mod_mirrorbrain/*.conf
274
%doc docs
275
%doc sql
276
%doc tools/push2mirrors
277
%dir %attr(750,mirrorbrain,mirrorbrain) %{_var}/log/mirrorbrain
278
279
%files -n apache2-mod_mirrorbrain
280
%defattr(-,root,root)
281
%{apache_libexecdir}/mod_mirrorbrain.so
282
283
%files -n apache2-mod_autoindex_mb
284
%defattr(-,root,root)
285
%{apache_libexecdir}/mod_autoindex_mb.so
286
287
%files tools
288
%defattr(-,root,root)
289
%{_bindir}/bdecode
290
%{_bindir}/create_timestamp
291
%{_bindir}/geoip-lite-update
292
%{_bindir}/geoiplookup_city
293
%{_bindir}/geoiplookup_continent
294
%{_bindir}/mirrordoctor
295
%{_bindir}/mirrorprobe
296
%{_bindir}/null-rsync
297
%{_bindir}/rsyncinfo
298
%{_bindir}/rsyncusers
299
%config(noreplace) %{_sysconfdir}/logrotate.d/mirrorprobe
300
301
# Icons
302
/usr/share/mirrorbrain
303
304
%files -n python-mb
305
%defattr(-,root,root)
306
%{_bindir}/mb
307
%{python_sitearch}/*
308
309
%files scanner
310
%defattr(-,root,root)
311
%{_bindir}/scanner
312
313
314
%changelog -n mirrorbrain
315