Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Last active April 16, 2023 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaevseev/ffbd4042ff7d05cbf4bf822deb076438 to your computer and use it in GitHub Desktop.
Save ilyaevseev/ffbd4042ff7d05cbf4bf822deb076438 to your computer and use it in GitHub Desktop.
RPM specfile fixes for Unbound DNS, see https://bugzilla.redhat.com/show_bug.cgi?id=1389061 (support for CentOS 7, rebuild without Python)
#!/bin/sh -e
DIR="$(mktemp -d)"
cd "$DIR"
echo "Working directory = $DIR"
yum install -y flex openssl-devel libevent-devel expat-devel pkgconfig python2-devel swig python34-devel systemd wget rpm-build
RPM="unbound-1.5.10-1.fc24.src.rpm"
wget -qcN "http://mirror.yandex.ru/fedora/linux/updates/24/SRPMS/u/$RPM"
rpm2cpio "$RPM" | cpio -i
wget -qcN "https://gist.githubusercontent.com/ilyaevseev/ffbd4042ff7d05cbf4bf822deb076438/raw/097beaf048016b96727c6556cc84a911fb20cf60/unbound.spec.diff"
patch < unbound.spec.diff
rpmbuild -ba --define "_sourcedir $PWD" --define "with_munin 0" --define "with_python 0" --define "with_python3 0" unbound.spec
echo
echo "SUCCESS. PLEASE REMOVE \"$DIR\" DIRECTORY MANUALLY."
echo
exit 0
## END ##
--- unbound.spec.orig 2016-09-28 02:51:17.000000000 +0000
+++ unbound.spec 2016-10-26 18:09:08.022993159 +0000
@@ -21,7 +21,7 @@
Summary: Validating, recursive, and caching DNS(SEC) resolver
Name: unbound
Version: 1.5.10
-Release: 1%{?extra_version:.%{extra_version}}%{?dist}
+Release: 1.1%{?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
@@ -52,7 +52,11 @@
BuildRequires: python2-devel swig
%endif # with_python
%if 0%{with_python3}
+%if 0%{?rhel} <= 7
+BuildRequires: python34-devel
+%else
BuildRequires: python3-devel
+%endif # >rhel7
%endif # with_python3
BuildRequires: systemd
# Required for SVN versions
@@ -141,16 +145,16 @@
%if 0%{with_python}
mv %{pkgname} %{pkgname}_python2
pushd %{pkgname}_python2
+%else
+pushd %{pkgname}
%endif # with_python
# only for snapshots
# 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
@@ -174,6 +178,8 @@
%if 0%{with_python}
pushd %{pkgname}_python2
+%else
+pushd %{pkgname}
%endif # with_python
%configure \
@@ -203,6 +209,8 @@
%install
%if 0%{with_python}
pushd %{pkgname}_python2
+%else
+pushd %{pkgname}
%endif # with_python
%{__make} DESTDIR=%{buildroot} install
%if 0%{with_python}
@@ -241,8 +249,10 @@
pushd %{pkgname}_python2
%endif # with_python
+%if 0%{with_python3}
# install streamtcp man page
install -m 0644 testcode/streamtcp.1 %{buildroot}/%{_mandir}/man1/unbound-streamtcp.1
+%endif
install -D -m 0644 contrib/libunbound.pc %{buildroot}/%{_libdir}/pkgconfig/libunbound.pc
@@ -342,13 +352,13 @@
#pushd pythonmod
#make test
#popd
+%else
+pushd %{pkgname}
%endif # with_python
make check
-%if 0%{with_python}
popd
-%endif # with_python
%if 0%{with_python3}
pushd %{pkgname}_python3
@@ -379,7 +389,9 @@
%{_sbindir}/unbound-control
%{_sbindir}/unbound-control-setup
%{_sbindir}/unbound-host
+%if 0%{with_python3}
%{_sbindir}/unbound-streamtcp
+%endif
%{_mandir}/man1/*
%{_mandir}/man5/*
%exclude %{_mandir}/man8/unbound-anchor*
@@ -432,6 +444,10 @@
%changelog
+* Wed Oct 26 2016 Ilya Evseev <evseev.i@cdnnow.ru> - 1.5.10-1.1
+- Bugfix building without python2 and python3
+- RHEL7 support added
+
* Tue Sep 27 2016 Paul Wouters <pwouters@redhat.com> - 1.5.10-1
- Updated to 1.5.10 (better TCP handling, bugfixes)
- Install pkgconfig file in -devel package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment