LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File polipo.spec of Package polipo (Project server:http)

#
# spec file for package polipo
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           polipo
Version:        1.0.4.1_git201111291707
Release:        0
%define trimcache_version 0.2
Summary:        Lightweight Caching Web Proxy
License:        X11
Group:          Productivity/Networking/Web/Proxy
Source:         http://www.pps.jussieu.fr/~jch/software/files/polipo/polipo-%{version}.tar.bz2
Patch1:         polipo-fix-makefile.patch
Patch2:         polipo-config.patch
Patch3:         polipo-forbidden.patch
Patch4:         polipo-logfile-path.patch
Source1:        polipo.init
Source2:        polipo.logrotate
Source3:        polipo.permissions
Source4:        polipo-dontcache
Source10:       http://ely.ath.cx/~piranha/software/polipo_trimcache/polipo_trimcache-%{trimcache_version}.py
Source11:       polipo-trimcache.sh
Source12:       polipo-trimcache.sysconfig
Source13:       polipo-trimcache.cron
Source14:       polipo-rpmlintrc
Source15:       polipo.service
Url:            http://www.pps.jussieu.fr/~jch/software/polipo/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %install_info_prereq permissions
PreReq:         %insserv_prereq %fillup_prereq
%if 0%{?suse_version} < 1230
Requires(pre):  pwdutils
%else
Requires(pre):  shadow
%endif
Requires:       cron
Requires:       logrotate
Requires:       python
BuildRequires:  gcc
BuildRequires:  glibc-devel
BuildRequires:  make
%if 0%{?suse_version} < 1220
BuildRequires:  texinfo
%else
BuildRequires:  makeinfo
%endif

%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%{?systemd_requires}
%define has_systemd 1
%endif

%description
Polipo is a lightweight caching Web proxy that was designed as a personal
cache. It is able to cache incomplete objects and will complete them using
range requests. It will use HTTP/1.1 pipelining if supported by the remote
server.

%prep
%setup -q
%patch1
%patch2
%patch3
%patch4

%build
%__make \
	%{?jobs:-j%{jobs}} \
	PREFIX="%{_prefix}" \
	BINDIR="%{_bindir}" \
	MANDIR="%{_mandir}" \
	INFODIR="%{_infodir}" \
	LOCAL_ROOT="%{_datadir}/polipo/www" \
	DISK_CACHE_ROOT="%{_localstatedir}/cache/polipo" \
	CDEBUGFLAGS="%{optflags} -Wall -fno-strict-aliasing -D_GNU_SOURCE"

%install
%__make \
	PREFIX="%{_prefix}" \
	BINDIR="%{_bindir}" \
	MANDIR="%{_mandir}" \
	INFODIR="%{_infodir}" \
	LOCAL_ROOT="%{_datadir}/polipo/www" \
	DISK_CACHE_ROOT="%{_localstatedir}/cache/polipo" \
	TARGET="%{buildroot}" \
	install

%__install -d "%{buildroot}%{_localstatedir}/cache/polipo"

%__install -d "%{buildroot}%{_localstatedir}/log/polipo"

%__install -d "%{buildroot}%{_sysconfdir}/polipo"
%__install -m0640 config.sample "%{buildroot}%{_sysconfdir}/polipo/config"
%__install -m0640 forbidden.sample "%{buildroot}%{_sysconfdir}/polipo/forbidden"
%__install -m0640 "%{SOURCE4}" "%{buildroot}%{_sysconfdir}/polipo/dontcache"

%__install -D -m0755 "%{SOURCE1}" "%{buildroot}/etc/init.d/polipo"
%__install -d "%{buildroot}/usr/sbin"
%__ln_s ../../etc/init.d/polipo "%{buildroot}/usr/sbin/rcpolipo"

%__install -D -m0644 "%{SOURCE2}" "%{buildroot}/etc/logrotate.d/polipo"

%__install -D -m0644 "%{SOURCE3}" "%{buildroot}/etc/permissions.d/polipo"

%__install "%{SOURCE10}" "%{buildroot}%{_sbindir}/polipo_trimcache.py"
%__install "%{SOURCE11}" "%{buildroot}%{_sbindir}/polipo-trimcache.sh"
%__install -D -m 0644 "%{SOURCE12}" "%{buildroot}/var/adm/fillup-templates/sysconfig.polipo-trimcache"
%__install -D -m 0644 "%{SOURCE13}" "%{buildroot}/etc/cron.d/polipo-trimcache"
%if 0%{?has_systemd}
%__install -D -m 0644 "%{SOURCE15}" "%{buildroot}%{_unitdir}/%{name}.service"
%endif
%pre
/usr/sbin/groupadd -r polipo >/dev/null 2>&1 || :
/usr/sbin/useradd -r -d "%{_localstatedir}/cache/polipo" \
	-g polipo \
	-c "Polipo Cache" \
	-s /bin/false \
	polipo >/dev/null 2>&1 || :
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%post
%install_info --info-dir="%{_infodir}" "%{_infodir}/polipo".info*
%fillup_only polipo-trimcache
%if 0%{?set_permissions:1} > 0
%set_permissions /etc/polipo/
%set_permissions /etc/polipo/forbidden
%set_permissions /var/log/polipo/ 
%set_permissions /var/cache/polipo/ 
%set_permissions /etc/polipo/config
%else
%run_permissions
%endif
%verifyscript
%verify_permissions -e /etc/polipo/
%verify_permissions -e /etc/polipo/forbidden
%verify_permissions -e /var/cache/polipo/
%verify_permissions -e /etc/polipo/config
%verify_permissions -e /var/log/polipo/
%if 0%{?has_systemd}
%service_add_post %{name}.service
%endif
%preun
%stop_on_removal %{name}
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%endif
%postun
%install_info_delete --info-dir="%{_infodir}" "%{_infodir}/polipo".info*
%restart_on_update %{name}
%{insserv_cleanup}
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%endif

%clean
%__rm -rf "%{buildroot}"

%files
%defattr(-,root,root)
%doc CHANGES COPYING README
%attr(0550,polipo,root) %dir %{_sysconfdir}/polipo
%attr(0640,root,polipo) %config(noreplace) %{_sysconfdir}/polipo/config
%attr(0640,root,polipo) %config(noreplace) %{_sysconfdir}/polipo/forbidden
%attr(0640,root,polipo) %config(noreplace) %{_sysconfdir}/polipo/dontcache
%config(noreplace) /etc/logrotate.d/polipo
%config(noreplace) /etc/permissions.d/polipo
%{_bindir}/polipo
%{_datadir}/polipo
%attr(0700,polipo,polipo) %{_localstatedir}/cache/polipo
%config /etc/init.d/polipo
/usr/sbin/rcpolipo
%attr(0700,polipo,polipo) %{_localstatedir}/log/polipo
%doc %{_infodir}/polipo.info*
%doc %{_mandir}/man1/polipo.1*
%{_sbindir}/polipo_trimcache.py
%{_sbindir}/polipo-trimcache.sh
%config(noreplace) /etc/cron.d/polipo-trimcache
/var/adm/fillup-templates/sysconfig.polipo-trimcache
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%endif

# Local Variables:
# mode: rpm-spec
# tab-width: 3
# End:

%changelog