Andrea Veri cb295c5
%if 0%{?rhel}
Andrea Veri cb295c5
%global apxs /usr/sbin/apxs
Andrea Veri cb295c5
%endif
Andrea Veri cb295c5
%if 0%{?fedora}
Andrea Veri cb295c5
%global apxs /usr/bin/apxs
Andrea Veri cb295c5
%endif
Andrea Veri cb295c5
%global mirrorbrain_user mirrorbrain
Andrea Veri cb295c5
%global mirrorbrain_group mirrorbrain
Andrea Veri cb295c5
%global apache apache
Andrea Veri cb295c5
%global apache_libexecdir %(%{apxs} -q LIBEXECDIR)
Andrea Veri cb295c5
%global apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
Andrea Veri cb295c5
%global apache_includedir %(%{apxs} -q INCLUDEDIR)
Andrea Veri cb295c5
%global apache_serverroot %(%{apxs} -q PREFIX)
Andrea Veri cb295c5
%global apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
Andrea Veri cb295c5
Andrea Veri cb295c5
Name:		mirrorbrain
Andrea Veri cb295c5
Summary:	A download redirector and metalink generator
Andrea Veri cb295c5
Url:		http://mirrorbrain.org/
Andrea Veri f052ed8
Version:	2.18.1
Andrea Veri 52a874f
Release:	23%{?dist}
Andrea Veri cb295c5
# ASL licensed files are: mod_autoindex_mb.c, mod_mirrorbrain.c, null-rsync
Andrea Veri cb295c5
# Other files are licensed under the GPLv2
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Source:		http://mirrorbrain.org/files/releases/mirrorbrain-%{version}.tar.gz
Andrea Veri cb295c5
# Mirrorbrain ships a modified version of the zsync library.
Andrea Veri 52a874f
Patch0:         zsync_modified_version.patch
Andrea Veri 52a874f
Patch1:         01-python-runtime-binary.patch
Andrea Veri 52a874f
Requires(pre):  shadow-utils
Andrea Veri cb295c5
4614160
BuildRequires:  gcc
Andrea Veri cb295c5
BuildRequires:	httpd-devel
Andrea Veri cb295c5
BuildRequires:	geoip
Andrea Veri cb295c5
BuildRequires:	geoip-devel
Andrea Veri b524ca0
BuildRequires:	mod_form-devel
15925c1
BuildRequires:	perl-generators
Andrea Veri cb295c5
BuildRequires:	python2-devel
3ffaf01
BuildRequires:	python2-sphinx
Andrea Veri cb295c5
Andrea Veri cb295c5
%description
Andrea Veri cb295c5
This apache module redirects clients to mirror servers, using an SQL backend,
Andrea Veri cb295c5
and generates metalinks.
Andrea Veri cb295c5
Andrea Veri cb295c5
%package doc
Andrea Veri cb295c5
License:        ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:        MirrorBrain redirector Apache module
Andrea Veri 52340d8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
Andrea Veri cb295c5
%description doc
Andrea Veri cb295c5
MirrorBrain is a scalable download redirector.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains the documentation.
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%package -n mod_mirrorbrain
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:	MirrorBrain redirector Apache module
Andrea Veri cb295c5
Requires:	httpd
Andrea Veri cb295c5
Requires:	apr-util-pgsql
Andrea Veri cb295c5
Requires:	geoip
Andrea Veri cb295c5
Requires:	mod_geoip
Andrea Veri cb295c5
Requires:	mod_form
Andrea Veri cb295c5
Requires:	%{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%description -n mod_mirrorbrain
Andrea Veri cb295c5
MirrorBrain is a scalable download redirector.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains mod_mirrorbrain, the Apache module which represents the
Andrea Veri cb295c5
core of MirrorBrain.
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%package -n mod_autoindex_mb
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:	Apache module generating directory indexes for MirrorBrain
Andrea Veri cb295c5
Requires:	mod_mirrorbrain
Andrea Veri 52340d8
Requires:	%{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
Andrea Veri cb295c5
%description -n mod_autoindex_mb
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains mod_autoindex_mb, the Apache module which represents the
Andrea Veri cb295c5
core of MirrorBrain.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains mod_autoindex_mb, which is a patched mod_autoindex. It
Andrea Veri cb295c5
adds a little further capability as index option.
Andrea Veri cb295c5
Andrea Veri cb295c5
It adds these two options:
Andrea Veri cb295c5
Andrea Veri cb295c5
        <IfModule mod_autoindex_mb.c>
Andrea Veri cb295c5
            IndexOptions Metalink
Andrea Veri cb295c5
            IndexOptions Mirrorlist
Andrea Veri cb295c5
        </IfModule>
Andrea Veri cb295c5
Andrea Veri cb295c5
The Metalink option adds a link named "Metalink" to the index, which links to
Andrea Veri cb295c5
the same file but with ".metalink" appended.
Andrea Veri cb295c5
Andrea Veri cb295c5
The MirrorList option adds a link named "Mirrors" to the index, which links to
Andrea Veri cb295c5
the same resources but with "?mirrorlist" appended.
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%package tools
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:	MirrorBrain commandline tools
3ffaf01
Requires:	python2-mb
3ffaf01
Requires:	python2-cmdln
3ffaf01
Requires:	python2-sqlobject
3ffaf01
Requires:	python2-psycopg2
Andrea Veri cb295c5
Requires:	geoip
Andrea Veri cb295c5
Requires:	logrotate
Andrea Veri 52340d8
Requires:	%{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
Andrea Veri cb295c5
%description tools
Andrea Veri cb295c5
MirrorBrain is a scalable download redirector.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains utilities provided by the MirrorBrain framework to
Andrea Veri cb295c5
maintain the database and scan mirrors.
Andrea Veri cb295c5
Andrea Veri cb295c5
3e8f495
%package -n python2-mb
3e8f495
%{?python_provide:%python_provide python2-mb}
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:	Python module used by the MirrorBrain commandline tools
3ffaf01
Requires:	python2-sqlobject
3ffaf01
Requires:	python2-psycopg2
Andrea Veri cb295c5
Requires:	geoip
Andrea Veri 52340d8
Requires:	%{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
3e8f495
%description -n python2-mb
Andrea Veri cb295c5
MirrorBrain is a scalable download redirector.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains a Python module (named "mb") for easily maintaining
Andrea Veri cb295c5
MirrorBrain.
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%package scanner
Andrea Veri cb295c5
License:	ASL 2.0 and GPLv2
Andrea Veri cb295c5
Summary:	MirrorBrain scanner
Andrea Veri cb295c5
Requires:	perl(Config::IniFiles)
Andrea Veri cb295c5
Requires:	perl(Digest::MD4)
Andrea Veri cb295c5
Requires:	perl(DBD::Pg)
Andrea Veri cb295c5
Requires:	perl-TimeDate
Andrea Veri cb295c5
Requires:	perl-libwww-perl
Andrea Veri 52340d8
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Andrea Veri 52340d8
Requires:	%{name}%{?_isa} = %{version}-%{release}
Andrea Veri cb295c5
Andrea Veri cb295c5
%description scanner
Andrea Veri cb295c5
MirrorBrain is a scalable download redirector.
Andrea Veri cb295c5
Andrea Veri cb295c5
This package contains the mirror scanner.
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%prep
Andrea Veri cb295c5
%setup -q -n mirrorbrain-%{version}
Andrea Veri cb295c5
%patch0 -p1
Andrea Veri cb295c5
Andrea Veri 52a874f
%if 0%{?fedora} >= 30
Andrea Veri 52a874f
%patch1 -p0
Andrea Veri 52a874f
%endif
Andrea Veri 52a874f
Andrea Veri cb295c5
%build
Andrea Veri cb295c5
cd mod_mirrorbrain
Andrea Veri cb295c5
%{apxs} -c -Wc,"%{optflags}" -lm mod_mirrorbrain.c
Andrea Veri cb295c5
cd ../mod_autoindex_mb
Andrea Veri cb295c5
%{apxs} -c -Wc,"%{optflags}" mod_autoindex_mb.c
Andrea Veri cb295c5
cd ../tools
Andrea Veri cb295c5
gcc %{optflags} -Wall -o geoiplookup_continent geoiplookup_continent.c -lGeoIP
Andrea Veri cb295c5
gcc %{optflags} -Wall -o geoiplookup_city geoiplookup_city.c -lGeoIP
Andrea Veri cb295c5
cd ../mb
Andrea Veri cb295c5
CFLAGS="%{optflags}" \
Andrea Veri cb295c5
%{__python2} setup.py build
4629d11
cd ../docs
4629d11
make %{?_smp_mflags} html && rm _build/html/.buildinfo
Andrea Veri cb295c5
Andrea Veri cb295c5
Andrea Veri cb295c5
%install
Andrea Veri cb295c5
mkdir -p %{buildroot}/%{apache_libexecdir}
Andrea Veri cb295c5
cp -p mod_mirrorbrain/.libs/mod_mirrorbrain.so %{buildroot}/%{apache_libexecdir}
Andrea Veri cb295c5
cp -p mod_autoindex_mb/.libs/mod_autoindex_mb.so %{buildroot}/%{apache_libexecdir}
Andrea Veri cb295c5
# tools
Andrea Veri cb295c5
install -D -p -m 755 tools/geoiplookup_continent %{buildroot}/%{_bindir}/geoiplookup_continent
Andrea Veri cb295c5
install -D -p -m 755 tools/geoiplookup_city %{buildroot}/%{_bindir}/geoiplookup_city
Andrea Veri cb295c5
install -D -p -m 755 tools/bdecode %{buildroot}/%{_bindir}/bdecode
Andrea Veri cb295c5
install -D -p -m 755 tools/rsyncinfo %{buildroot}/%{_bindir}/rsyncinfo
Andrea Veri cb295c5
install -D -p -m 755 tools/rsyncusers %{buildroot}/%{_bindir}/rsyncusers
Andrea Veri cb295c5
install -D -p -m 755 tools/geoip-lite-update %{buildroot}/%{_bindir}/geoip-lite-update
Andrea Veri cb295c5
install -D -p -m 755 tools/create_timestamp %{buildroot}/%{_bindir}/create_timestamp
Andrea Veri cb295c5
install -D -p -m 755 tools/null-rsync %{buildroot}/%{_bindir}/null-rsync
Andrea Veri cb295c5
install -D -p -m 755 tools/scanner.pl %{buildroot}/%{_bindir}/scanner
Andrea Veri cb295c5
install -D -p -m 755 mirrorprobe/mirrorprobe.py %{buildroot}/%{_bindir}/mirrorprobe
Andrea Veri cb295c5
install -D -p -m 644 tools/mirrorprobe-logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/mirrorprobe
Andrea Veri cb295c5
Andrea Veri cb295c5
# Python mb module
Andrea Veri cb295c5
cd mb
Andrea Veri cb295c5
%{__python2} setup.py install --prefix=%{_prefix} --root %{buildroot}
Andrea Veri cb295c5
Andrea Veri cb295c5
# Icons
Andrea Veri cb295c5
mkdir -p %{buildroot}/%{_datadir}/mirrorbrain
Andrea Veri cb295c5
cp -a famfamfam_flag_icons %{buildroot}/%{_datadir}/mirrorbrain/
Andrea Veri cb295c5
Andrea Veri cb295c5
# log directory
Andrea Veri cb295c5
mkdir -p %{buildroot}/%{_localstatedir}/log/mirrorbrain
Andrea Veri cb295c5
Andrea Veri cb295c5
# Fix permissions on the python-mb file
Andrea Veri cb295c5
chmod a+x %{buildroot}%{python2_sitearch}/mb/*
Andrea Veri cb295c5
chmod 644 %{buildroot}%{python2_sitearch}/mb/zsync.so
Andrea Veri cb295c5
Andrea Veri cb295c5
%pre
Andrea Veri cb295c5
getent group %{mirrorbrain_group} >/dev/null || groupadd -r %{mirrorbrain_group}
Andrea Veri cb295c5
getent passwd %{mirrorbrain_user} >/dev/null || useradd -r -g %{mirrorbrain_group} -M -s /sbin/nologin %{mirrorbrain_user}
Andrea Veri cb295c5
exit 0
Andrea Veri cb295c5
Andrea Veri cb295c5
%files
4629d11
%{!?_licensedir:%global license %%doc}
4629d11
%license COPYING mod_autoindex_mb/NOTICE
4629d11
%doc FAQ TODO
Andrea Veri cb295c5
%doc mod_mirrorbrain/*.conf
Andrea Veri cb295c5
%dir %attr(750,%{mirrorbrain_user},%{mirrorbrain_group}) %{_localstatedir}/log/mirrorbrain
Andrea Veri cb295c5
Andrea Veri cb295c5
%files doc
4629d11
%doc docs/_build/html
Andrea Veri cb295c5
%doc sql
Andrea Veri cb295c5
Andrea Veri cb295c5
%files -n mod_mirrorbrain
Andrea Veri cb295c5
%{apache_libexecdir}/mod_mirrorbrain.so
Andrea Veri cb295c5
Andrea Veri cb295c5
%files -n mod_autoindex_mb
Andrea Veri cb295c5
%{apache_libexecdir}/mod_autoindex_mb.so
Andrea Veri cb295c5
Andrea Veri cb295c5
%files tools
Andrea Veri cb295c5
%{_bindir}/bdecode
Andrea Veri cb295c5
%{_bindir}/create_timestamp
Andrea Veri cb295c5
%{_bindir}/geoip-lite-update
Andrea Veri cb295c5
%{_bindir}/geoiplookup_city
Andrea Veri cb295c5
%{_bindir}/geoiplookup_continent
Andrea Veri cb295c5
%{_bindir}/mirrorprobe
Andrea Veri cb295c5
%{_bindir}/null-rsync
Andrea Veri cb295c5
%{_bindir}/rsyncinfo
Andrea Veri cb295c5
%{_bindir}/rsyncusers
Andrea Veri cb295c5
%config(noreplace) %{_sysconfdir}/logrotate.d/mirrorprobe
Andrea Veri cb295c5
%{_datadir}/mirrorbrain
Andrea Veri cb295c5
3e8f495
%files -n python2-mb
Andrea Veri cb295c5
%{_bindir}/mb
Andrea Veri cb295c5
%{python2_sitearch}/mb*
Andrea Veri cb295c5
Andrea Veri cb295c5
%files scanner
Andrea Veri cb295c5
%{_bindir}/scanner
Andrea Veri cb295c5
7cf91ff
%changelog
Andrea Veri 52a874f
* Fri May 03 2019 Andrea Veri <averi@fedoraproject.org> - 2.18.1-23
Andrea Veri 52a874f
- Land 01-python-runtime-binary.patch to make sure the Python binary
Andrea Veri 52a874f
  is explicitly declared (fixes RH BZ #1676006).
Andrea Veri 52a874f
4f6f330
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-22
4f6f330
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
4f6f330
a46a14d
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-21
a46a14d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
a46a14d
87e69eb
* Wed Jun 27 2018 Jitka Plesnikova <jplesnik@redhat.com> - 2.18.1-20
87e69eb
- Perl 5.28 rebuild
87e69eb
3ffaf01
* Tue Feb 20 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.18.1-19
3ffaf01
- Update Python 2 dependency declarations to new packaging standards
3ffaf01
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
3ffaf01
00eb246
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.18.1-18
00eb246
- Escape macros in %%changelog
00eb246
0aabedc
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-17
0aabedc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
0aabedc
3e8f495
* Sun Dec 17 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.18.1-16
3e8f495
- Python 2 binary package renamed to python2-mb
3e8f495
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
3e8f495
c2c6258
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-15
c2c6258
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c2c6258
e203d10
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-14
e203d10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e203d10
939fe71
* Sun Jun 04 2017 Jitka Plesnikova <jplesnik@redhat.com> - 2.18.1-13
939fe71
- Perl 5.26 rebuild
939fe71
cd42100
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-12
cd42100
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
cd42100
4193177
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.18.1-11
4193177
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
4193177
Andrea Veri b524ca0
* Tue Jun 07 2016 Andrea Veri <averi@fedoraproject.org> - 2.18.1-10
Andrea Veri b524ca0
- BuildRequire should be set on mod_form-devel.
Andrea Veri b524ca0
9a7459f
* Sat May 14 2016 Jitka Plesnikova <jplesnik@redhat.com> - 2.18.1-9
9a7459f
- Perl 5.24 rebuild
9a7459f
0d95452
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-8
0d95452
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
0d95452
7b3e2ad
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.18.1-7
7b3e2ad
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
7b3e2ad
9c4f9a8
* Fri Jun 05 2015 Jitka Plesnikova <jplesnik@redhat.com> - 2.18.1-6
9c4f9a8
- Perl 5.22 rebuild
9c4f9a8
4629d11
* Sun May 17 2015 Ville Skyttä <ville.skytta@iki.fi> - 2.18.1-5
4629d11
- Build and install HTML docs instead of doc sources, mark licenses as %%license
4629d11
a5cc2ee
* Wed Aug 27 2014 Jitka Plesnikova <jplesnik@redhat.com> - 2.18.1-4
a5cc2ee
- Perl 5.20 rebuild
a5cc2ee
7cf91ff
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.18.1-3
7cf91ff
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
7cf91ff
dc10a4b
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.18.1-2
dc10a4b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
dc10a4b
Andrea Veri f052ed8
* Tue Feb 04 2014 Andrea Veri <averi@fedoraproject.org> 2.18.1-1
Andrea Veri f052ed8
- New upstream release.
Andrea Veri f052ed8
Andrea Veri cb295c5
* Thu Dec 05 2013 Andrea Veri <averi@fedoraproject.org> 2.17.0-3
Andrea Veri cb295c5
- Added a note about what files are licensed under the ASL 2.0.
Andrea Veri cb295c5
- Moved shadow-utils as a Require(pre)
Andrea Veri 52a874f
- Add a zsync_modified_version patch, we're shipping zsync.so on
Andrea Veri cb295c5
  python_sitearch/mb given this specific zsync release just contains
Andrea Veri cb295c5
  the code needed for the checksums to happen.
Andrea Veri cb295c5
Andrea Veri cb295c5
* Thu Dec 05 2013 Andrea Veri <averi@fedoraproject.org> 2.17.0-2
Andrea Veri cb295c5
- Make use of optflags.
00eb246
- Don't mix $-style and %%-style.
Andrea Veri cb295c5
- Make sure each package depends on the base package.
Andrea Veri cb295c5
- Put the docs that exceed 1M on their own package.
Andrea Veri cb295c5
- Fix permissions on the python-mb's files.
Andrea Veri cb295c5
Andrea Veri 52a874f
* Thu Nov 28 2013 Andrea Veri <averi@fedoraproject.org> 2.17.0-1
Andrea Veri cb295c5
- First package release.