Fix FTBFS and build Python 2 and 3 bindings
- Fix FTBFS (#1206129) - Build python3-unbound and python-unbound bindings for Python 3 and 2 (#1188080) Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
ebc942cc93
commit
9d0daced90
326
unbound.spec
326
unbound.spec
@ -1,18 +1,18 @@
|
||||
%{?!with_python: %global with_python 1}
|
||||
%{?!with_python3: %global with_python3 1}
|
||||
%{?!with_munin: %global with_munin 1}
|
||||
|
||||
%if %{with_python}
|
||||
%if 0%{?fedora} >= 22
|
||||
%global python python3
|
||||
%global __python %{__python3}
|
||||
%else
|
||||
%global python python2
|
||||
%global __python %{__python2}
|
||||
%endif
|
||||
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
%endif
|
||||
%if 0%{with_python} == 0
|
||||
# if not building Python, don't build Python3
|
||||
%global with_python3 0
|
||||
%else # with_python
|
||||
# needed just for EPEL
|
||||
%if 0%{?rhel} <= 6
|
||||
%{!?__python2: %global __python2 /usr/bin/python2}
|
||||
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
|
||||
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
|
||||
%endif # rhel <= 6
|
||||
%endif # with_python
|
||||
|
||||
%global _hardened_build 1
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
Summary: Validating, recursive, and caching DNS(SEC) resolver
|
||||
Name: unbound
|
||||
Version: 1.5.3
|
||||
Release: 1%{?extra_version:.%{extra_version}}%{?dist}
|
||||
Release: 2%{?extra_version:.%{extra_version}}%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
Source: http://www.unbound.net/downloads/%{name}-%{version}%{?extra_version}.tar.gz
|
||||
@ -43,16 +43,25 @@ Source14: unbound.sysconfig
|
||||
Source15: unbound.cron
|
||||
Source16: unbound-munin.README
|
||||
|
||||
# https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=664
|
||||
Patch0: 0001-Use-print_function-also-for-Python2.patch
|
||||
Patch1: 0002-libunbound-examples-produce-sorted-output.patch
|
||||
Patch2: 0003-libunbound-Python-libldns-is-not-used-anymore.patch
|
||||
Patch3: 0004-Resolve-Python-3-incompatibilities-in-libunbound-and.patch
|
||||
|
||||
Group: System Environment/Daemons
|
||||
BuildRequires: flex, openssl-devel
|
||||
BuildRequires: libevent-devel expat-devel
|
||||
%if %{with_python}
|
||||
BuildRequires: %{python}-devel swig
|
||||
%endif
|
||||
%if 0%{with_python}
|
||||
BuildRequires: python2-devel swig
|
||||
%endif # with_python
|
||||
%if 0%{with_python3}
|
||||
BuildRequires: python3-devel
|
||||
%endif # with_python3
|
||||
BuildRequires: systemd
|
||||
# Required for SVN versions
|
||||
# BuildRequires: bison
|
||||
# BuildRequires: automake autoconf
|
||||
BuildRequires: automake autoconf libtool
|
||||
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
@ -103,40 +112,115 @@ Requires: crontabs
|
||||
%description libs
|
||||
Contains libraries used by the unbound server and client applications
|
||||
|
||||
%if %{with_python}
|
||||
%package python
|
||||
Summary: Python modules and extensions for unbound
|
||||
%if 0%{with_python}
|
||||
%package -n python-unbound
|
||||
Summary: Python 2 modules and extensions for unbound
|
||||
Group: Applications/System
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Provides: unbound-python = %{version}-%{release}
|
||||
Obsoletes: unbound-python < %{version}-%{release}
|
||||
|
||||
%description -n python-unbound
|
||||
Python 2 modules and extensions for unbound
|
||||
%endif # with_python
|
||||
|
||||
%if 0%{with_python3}
|
||||
%package -n python3-unbound
|
||||
Summary: Python 3 modules and extensions for unbound
|
||||
Group: Applications/System
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description python
|
||||
Python modules and extensions for unbound
|
||||
%endif
|
||||
%description -n python3-unbound
|
||||
Python 3 modules and extensions for unbound
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q %{?extra_version:-n %{name}-%{version}%{extra_version}}
|
||||
%{?extra_version:%global pkgname %{name}-%{version}%{extra_version}}%{!?extra_version:%global pkgname %{name}-%{version}}
|
||||
%setup -qcn %{pkgname}
|
||||
|
||||
%if 0%{with_python}
|
||||
mv %{pkgname} %{pkgname}_python2
|
||||
pushd %{pkgname}_python2
|
||||
%endif # with_python
|
||||
|
||||
#Add patches here
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
autoreconf -iv
|
||||
|
||||
%if 0%{with_python}
|
||||
# copy common doc files - after here, since it may be patched
|
||||
cp -pr doc pythonmod libunbound ../
|
||||
popd
|
||||
%endif # with_python
|
||||
|
||||
%if 0%{?with_python3}
|
||||
cp -a %{pkgname}_python2 %{pkgname}_python3
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%build
|
||||
# This is needed to rebuild the configure script to support Python 3.x
|
||||
#autoreconf
|
||||
# autoreconf -iv
|
||||
export LDFLAGS="-Wl,-z,relro,-z,now -pie -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
|
||||
export CFLAGS="$RPM_OPT_FLAGS -fPIE -pie"
|
||||
export CXXFLAGS="$RPM_OPT_FLAGS -fPIE -pie"
|
||||
%configure --with-libevent --with-pthreads --with-ssl \
|
||||
--disable-rpath --disable-static \
|
||||
--with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
|
||||
--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \
|
||||
%if %{with_python}
|
||||
--with-pythonmodule --with-pyunbound PYTHON=%{__python} \
|
||||
%endif
|
||||
--enable-sha2 --disable-gost --enable-ecdsa \
|
||||
|
||||
# ./configure script common arguments
|
||||
%global configure_args --with-libevent --with-pthreads --with-ssl \\\
|
||||
--disable-rpath --disable-static \\\
|
||||
--with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \\\
|
||||
--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \\\
|
||||
--enable-sha2 --disable-gost --enable-ecdsa \\\
|
||||
--with-rootkey-file=%{_sharedstatedir}/unbound/root.key
|
||||
|
||||
%if 0%{with_python}
|
||||
pushd %{pkgname}_python2
|
||||
%endif # with_python
|
||||
|
||||
%configure \
|
||||
%if %{with_python}
|
||||
--with-pythonmodule --with-pyunbound PYTHON=%{__python2} \
|
||||
%endif # with_python
|
||||
%{configure_args}
|
||||
|
||||
%{__make} %{?_smp_mflags}
|
||||
%{__make} %{?_smp_mflags} streamtcp
|
||||
|
||||
%if 0%{with_python}
|
||||
popd
|
||||
%endif # with_python
|
||||
|
||||
%if 0%{with_python3}
|
||||
pushd %{pkgname}_python3
|
||||
%configure \
|
||||
--with-pythonmodule --with-pyunbound PYTHON=%{__python3} \
|
||||
%{configure_args}
|
||||
|
||||
%{__make} %{?_smp_mflags}
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%install
|
||||
%if 0%{with_python3}
|
||||
pushd %{pkgname}_python3
|
||||
%{__make} DESTDIR=%{buildroot} install
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
%if 0%{with_python}
|
||||
pushd %{pkgname}_python2
|
||||
%endif # with_python
|
||||
%{__make} DESTDIR=%{buildroot} install
|
||||
%if 0%{with_python}
|
||||
popd
|
||||
%endif # with_python
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unbound.service
|
||||
install -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/unbound-keygen.service
|
||||
@ -157,11 +241,19 @@ for plugin in unbound_munin_hits unbound_munin_queue unbound_munin_memory unboun
|
||||
done
|
||||
%endif
|
||||
|
||||
%if 0%{with_python}
|
||||
pushd %{pkgname}_python2
|
||||
%endif # with_python
|
||||
|
||||
# install streamtcp used for monitoring / debugging unbound's port 80/443 modes
|
||||
install -m 0755 streamtcp %{buildroot}%{_sbindir}/unbound-streamtcp
|
||||
# install streamtcp man page
|
||||
install -m 0644 testcode/streamtcp.1 %{buildroot}/%{_mandir}/man1/unbound-streamtcp.1
|
||||
|
||||
%if 0%{with_python}
|
||||
popd
|
||||
%endif # with_python
|
||||
|
||||
# Install tmpfiles.d config
|
||||
install -d -m 0755 %{buildroot}%{_tmpfilesdir} %{buildroot}%{_sharedstatedir}/unbound
|
||||
install -m 0644 %{SOURCE8} %{buildroot}%{_tmpfilesdir}/unbound.conf
|
||||
@ -173,9 +265,14 @@ install -m 0644 %{SOURCE13} %{buildroot}%{_sharedstatedir}/unbound/root.key
|
||||
|
||||
# remove static library from install (fedora packaging guidelines)
|
||||
rm %{buildroot}%{_libdir}/*.la
|
||||
%if %{with_python}
|
||||
rm %{buildroot}%{python_sitearch}/*.la
|
||||
%endif
|
||||
|
||||
%if 0%{with_python}
|
||||
rm %{buildroot}%{python2_sitearch}/*.la
|
||||
%endif # with_python
|
||||
|
||||
%if 0%{with_python3}
|
||||
rm %{buildroot}%{python3_sitearch}/*.la
|
||||
%endif # with_python3
|
||||
|
||||
# create softlink for all functions of libunbound man pages
|
||||
for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd ub_ctx_resolvconf ub_ctx_hosts ub_ctx_add_ta ub_ctx_add_ta_file ub_ctx_trustedkeys ub_ctx_debugout ub_ctx_debuglevel ub_ctx_async ub_poll ub_wait ub_fd ub_process ub_resolve ub_resolve_async ub_cancel ub_resolve_free ub_strerror ub_ctx_print_local_zones ub_ctx_zone_add ub_ctx_zone_remove ub_ctx_data_add ub_ctx_data_remove;
|
||||
@ -195,72 +292,12 @@ install -p %{SOURCE11} %{buildroot}%{_sysconfdir}/unbound/local.d/
|
||||
# Link unbound-control-setup.8 manpage to unbound-control.8
|
||||
echo ".so man8/unbound-control.8" > %{buildroot}/%{_mandir}/man8/unbound-control-setup.8
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%files
|
||||
%doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_unitdir}/%{name}-keygen.service
|
||||
%attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
|
||||
%attr(0644,root,root) %{_tmpfilesdir}/unbound.conf
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/keys.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/keys.d/*.key
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/conf.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/conf.d/*.conf
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/local.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/local.d/*.conf
|
||||
%{_sbindir}/unbound
|
||||
%{_sbindir}/unbound-checkconf
|
||||
%{_sbindir}/unbound-control
|
||||
%{_sbindir}/unbound-control-setup
|
||||
%{_sbindir}/unbound-host
|
||||
%{_sbindir}/unbound-streamtcp
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man5/*
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%if %{with_python}
|
||||
%files python
|
||||
%{python_sitearch}/*
|
||||
%doc libunbound/python/examples/*
|
||||
%doc pythonmod/examples/*
|
||||
%endif
|
||||
|
||||
%if %{with_munin}
|
||||
%files munin
|
||||
%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/unbound
|
||||
%{_datadir}/munin/plugins/unbound*
|
||||
%doc unbound-munin.README
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%{_libdir}/libunbound.so
|
||||
%{_includedir}/unbound.h
|
||||
%{_mandir}/man3/*
|
||||
%doc README
|
||||
|
||||
%files libs
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
|
||||
%{_sbindir}/unbound-anchor
|
||||
%{_libdir}/libunbound.so.*
|
||||
%{_sysconfdir}/%{name}/icannbundle.pem
|
||||
%attr(0644,root,root) %{_sysconfdir}/cron.d/unbound-anchor
|
||||
%dir %attr(0755,unbound,unbound) %{_sharedstatedir}/%{name}
|
||||
%attr(0644,unbound,unbound) %config(noreplace) %{_sharedstatedir}/%{name}/root.key
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/dlv.isc.org.key
|
||||
# just left for backwards compat with user changed unbound.conf files - format is different!
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/root.key
|
||||
%doc doc/README doc/LICENSE
|
||||
|
||||
%pre libs
|
||||
getent group unbound >/dev/null || groupadd -r unbound
|
||||
getent passwd unbound >/dev/null || \
|
||||
useradd -r -g unbound -d %{_sysconfdir}/unbound -s /sbin/nologin \
|
||||
-c "Unbound DNS resolver" unbound
|
||||
exit 0
|
||||
|
||||
%post
|
||||
%systemd_post unbound.service
|
||||
@ -291,7 +328,104 @@ exit 0
|
||||
/bin/systemctl try-restart unbound.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart unbound-keygen.service >/dev/null 2>&1 || :
|
||||
|
||||
|
||||
%check
|
||||
%if 0%{with_python}
|
||||
pushd %{pkgname}_python2
|
||||
|
||||
#pushd pythonmod
|
||||
#make test
|
||||
#popd
|
||||
%endif # with_python
|
||||
|
||||
make check
|
||||
|
||||
%if 0%{with_python}
|
||||
popd
|
||||
%endif # with_python
|
||||
|
||||
%if 0%{with_python3}
|
||||
pushd %{pkgname}_python3
|
||||
#pushd pythonmod
|
||||
#make test
|
||||
#popd
|
||||
make check
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%files
|
||||
%doc doc/CREDITS doc/FEATURES
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_unitdir}/%{name}-keygen.service
|
||||
%attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
|
||||
%attr(0644,root,root) %{_tmpfilesdir}/unbound.conf
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/keys.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/keys.d/*.key
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/conf.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/conf.d/*.conf
|
||||
%dir %attr(0755,root,unbound) %{_sysconfdir}/%{name}/local.d
|
||||
%attr(0664,root,unbound) %config(noreplace) %{_sysconfdir}/%{name}/local.d/*.conf
|
||||
%{_sbindir}/unbound
|
||||
%{_sbindir}/unbound-checkconf
|
||||
%{_sbindir}/unbound-control
|
||||
%{_sbindir}/unbound-control-setup
|
||||
%{_sbindir}/unbound-host
|
||||
%{_sbindir}/unbound-streamtcp
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man5/*
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%if 0%{with_python}
|
||||
%files -n python-unbound
|
||||
%license pythonmod/LICENSE
|
||||
%{python2_sitearch}/*
|
||||
%doc libunbound/python/examples/*
|
||||
%doc pythonmod/examples/*
|
||||
%endif
|
||||
|
||||
%if 0%{with_python3}
|
||||
%files -n python3-unbound
|
||||
%license pythonmod/LICENSE
|
||||
%{python3_sitearch}/*
|
||||
%doc libunbound/python/examples/*
|
||||
%doc pythonmod/examples/*
|
||||
%endif
|
||||
|
||||
%if 0%{with_munin}
|
||||
%files munin
|
||||
%doc unbound-munin.README
|
||||
%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/unbound
|
||||
%{_datadir}/munin/plugins/unbound*
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%{_libdir}/libunbound.so
|
||||
%{_includedir}/unbound.h
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%files libs
|
||||
%doc doc/README
|
||||
%license doc/LICENSE
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
|
||||
%{_sbindir}/unbound-anchor
|
||||
%{_libdir}/libunbound.so.*
|
||||
%{_sysconfdir}/%{name}/icannbundle.pem
|
||||
%attr(0644,root,root) %{_sysconfdir}/cron.d/unbound-anchor
|
||||
%dir %attr(0755,unbound,unbound) %{_sharedstatedir}/%{name}
|
||||
%attr(0644,unbound,unbound) %config(noreplace) %{_sharedstatedir}/%{name}/root.key
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/dlv.isc.org.key
|
||||
# just left for backwards compat with user changed unbound.conf files - format is different!
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/root.key
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Apr 16 2015 Tomas Hozza <thozza@redhat.com> - 1.5.3-2
|
||||
- Fix FTBFS (#1206129)
|
||||
- Build python3-unbound and python-unbound bindings for Python 3 and 2 (#1188080)
|
||||
|
||||
* Mon Mar 16 2015 Paul Wouters <pwouters@redhat.com> - 1.5.3-1
|
||||
- Updated to 1.5.3 which is a bugfix on 1.5.2 for sighup handling
|
||||
- Updated to 1.5.2 which fixes DNSSEC validation with different
|
||||
|
Loading…
Reference in New Issue
Block a user