Commit ff015aa6 authored by Daniel Salzman's avatar Daniel Salzman

Merge branch 'obs-opensuse' into 'master'

packaging: improvements and openSUSE Tumbleweed/Leap 15 support

See merge request !898
parents 11fe3467 d66b2718
......@@ -13,7 +13,6 @@ arch=('x86_64')
url="https://www.knot-dns.cz/"
license=('GPL3')
depends=('lmdb' 'liburcu' 'protobuf-c' 'fstrm' 'libedit' 'systemd' 'libcap-ng' 'gnutls' 'libidn2')
optdepends=('python: for pykeymgr')
backup=('etc/knot/knot.conf')
source=("${pkgname}_${pkgver}.orig.tar.xz"
......@@ -41,7 +40,8 @@ build() {
--enable-dnstap \
--enable-systemd \
--enable-reuseport \
--disable-silent-rules
--disable-silent-rules \
--disable-static
make
}
......
......@@ -6,13 +6,14 @@ Documentation=man:knotd(8) man:knot.conf(5) man:knotc(8)
[Service]
Type=notify
User=knot
Group=knot
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETPCAP
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SETPCAP
ExecStart=/usr/sbin/knotd
ExecReload=/usr/sbin/knotc reload
Restart=on-abort
ExecStartPre=/usr/sbin/knotc conf-check
# Breaks daemon reload
#CapabilityBoundingSet=cap_net_bind_service cap_setuid cap_setgid
[Install]
WantedBy=multi-user.target
# tmpfiles.d(5) runtime directory for knot
#Type Path Mode UID GID Age Argument
d /run/knot 0755 knot knot - -
#Type Path Mode UID GID Age Argument
d /run/knot 0755 knot knot - -
../../common/knot.tmpfiles
\ No newline at end of file
usr/include/
usr/lib/*/*.a
usr/lib/*/*.so
usr/lib/*/pkgconfig/*
......@@ -47,7 +47,8 @@ override_dh_auto_configure:
--with-module-dnstap=yes \
$(RECVMMSG) \
$(FASTPARSER) \
--disable-silent-rules
--disable-silent-rules \
--disable-static
override_dh_auto_build-indep:
dh_auto_build -- info pdf html
......
%global _hardened_build 1
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
%define GPG_CHECK 0
%define VERSION __VERSION__
Summary: High-performance authoritative DNS server
Name: knot
Version: %{VERSION}
Release: 1%{?dist}
License: GPLv3
Group: System Environment/Daemons
URL: http://www.knot-dns.cz
Source0: %{name}_%{version}.orig.tar.xz
Summary: High-performance authoritative DNS server
Name: knot
Version: %{VERSION}
Release: 1%{?dist}
License: GPLv3
URL: http://www.knot-dns.cz
Source0: %{name}_%{version}.orig.tar.xz
Source2: %{name}.service
Source3: %{name}.conf
Source4: %{name}.tmpfiles
Source2: %{name}.service
Source3: %{name}.conf
Source4: %{name}.tmpfiles
%if 0%{GPG_CHECK}
Source1: http://public.nic.cz/files/knot-dns/%{name}-%{version}.tar.xz.asc
Source1: http://public.nic.cz/files/knot-dns/%{name}-%{version}.tar.xz.asc
# PGP keys used to sign upstream releases
# Export with --armor using command from https://fedoraproject.org/wiki/PackagingDrafts:GPGSignatures
# Don't forget to update %%prep section when adding/removing keys
Source100: gpgkey-742FA4E95829B6C5EAC6B85710BB7AF6FEBBD6AB.gpg.asc
BuildRequires: gnupg2
Source100: gpgkey-742FA4E95829B6C5EAC6B85710BB7AF6FEBBD6AB.gpg.asc
BuildRequires: gnupg2
%endif
# Required dependencies
BuildRequires: pkgconfig(liburcu) pkgconfig(gnutls) >= 3.3 pkgconfig(nettle) lmdb-devel pkgconfig(libedit)
# Optional dependencies
BuildRequires: pkgconfig(libcap-ng) pkgconfig(libidn2) pkgconfig(libsystemd) pkgconfig(libfstrm) pkgconfig(libprotobuf-c)
BuildRequires: systemd
BuildRequires: pkgconfig(liburcu)
BuildRequires: pkgconfig(gnutls) >= 3.3
BuildRequires: pkgconfig(libedit)
Requires: python-lmdb
# Optional dependencies
BuildRequires: pkgconfig(libcap-ng)
BuildRequires: pkgconfig(libidn2)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libfstrm)
BuildRequires: pkgconfig(libprotobuf-c)
BuildRequires: pkgconfig(systemd)
# Distro-dependent dependencies
%if 0%{?suse_version}
BuildRequires: python3-Sphinx
BuildRequires: lmdb-devel
BuildRequires: protobuf-c
Requires(pre): pwdutils
%endif
%if 0%{?rhel}
BuildRequires: python-sphinx
BuildRequires: lmdb-devel
%endif
%if 0%{?fedora}
BuildRequires: python3-sphinx
BuildRequires: pkgconfig(lmdb)
%endif
Requires(post): python-lmdb
Requires(post): systemd %{_sbindir}/runuser
Requires(preun): systemd
Requires(postun): systemd
Requires(post): systemd %{_sbindir}/runuser
Requires(preun): systemd
Requires(postun): systemd
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description
Knot DNS is a high-performance authoritative DNS server implementation.
%package libs
Summary: Libraries used by the Knot DNS server and client applications
Summary: Libraries used by the Knot DNS server and client applications
%description libs
The package contains shared libraries used by the Knot DNS server and
utilities.
%package devel
Summary: Development header files for the Knot DNS libraries
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Summary: Development header files for the Knot DNS libraries
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
The package contains development header files for the Knot DNS libraries
included in knot-libs package.
%package utils
Summary: DNS client utilities shipped with the Knot DNS server
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Summary: DNS client utilities shipped with the Knot DNS server
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description utils
The package contains DNS client utilities shipped with the Knot DNS server.
%package doc
Summary: Documentation for the Knot DNS server
License: GPLv3 and BSD and MIT
BuildArch: noarch
%if 0%{?rhel}
BuildRequires: python-sphinx
%else
BuildRequires: python3-sphinx
%endif
Provides: bundled(jquery) = 3.1.0
Summary: Documentation for the Knot DNS server
License: GPLv3 and BSD and MIT
BuildArch: noarch
Provides: bundled(jquery) = 3.1.0
%description doc
The package contains documentation for the Knot DNS server.
......@@ -90,9 +104,6 @@ gpg2 --verify %{SOURCE1} %{SOURCE0}
%endif
%setup -q
# make sure embedded LMDB library is not used
rm -vr src/contrib/lmdb
%build
# disable debug code (causes unused warnings)
CFLAGS="%{optflags} -DNDEBUG -Wno-unused"
......@@ -103,7 +114,16 @@ CFLAGS="%{optflags} -DNDEBUG -Wno-unused"
%define configure_db_sizes --with-conf-mapsize=64
%endif
%configure %{configure_db_sizes}
%configure \
--sysconfdir=/etc \
--localstatedir=/var/lib \
--libexecdir=/usr/lib/knot \
--with-rundir=/run/knot \
--with-storage=/var/lib/knot \
%{?configure_db_sizes} \
--disable-static \
--enable-dnstap=yes \
--with-module-dnstap=yes
make %{?_smp_mflags}
make html
......@@ -111,7 +131,9 @@ make html
make install DESTDIR=%{buildroot}
# install documentation
mkdir -p %{buildroot}%{_pkgdocdir}
install -d -m 0755 %{buildroot}%{_pkgdocdir}/samples
install -p -m 0644 -t %{buildroot}%{_pkgdocdir}/samples samples/*.conf samples/*.zone*
install -p -m 0644 NEWS README %{buildroot}%{_pkgdocdir}
cp -av doc/_build/html %{buildroot}%{_pkgdocdir}
[ -r %{buildroot}%{_pkgdocdir}/html/index.html ] || exit 1
rm -f %{buildroot}%{_pkgdocdir}/html/.buildinfo
......@@ -120,55 +142,66 @@ rm -f %{buildroot}%{_pkgdocdir}/html/.buildinfo
rm %{buildroot}%{_sysconfdir}/%{name}/*
install -p -m 0644 -D %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
# install service file and create rundir
# install systemd files
install -p -m 0644 -D %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -p -m 0644 -D %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -d -m 0755 %{buildroot}%{_localstatedir}/run/%{name}
# create storage dir and key dir
mkdir -p %{buildroot}%{_sharedstatedir}
install -d -m 0775 %{buildroot}%{_sharedstatedir}/%{name}
install -d -m 0770 %{buildroot}%{_sharedstatedir}/%{name}/keys
# install config samples into docdir
install -d -m 0755 %{buildroot}%{_pkgdocdir}/samples
for sample_file in knot.sample.conf example.com.zone; do
install -p -m 0644 samples/${sample_file} %{buildroot}%{_pkgdocdir}/samples
done
install -d %{buildroot}%{_sharedstatedir}
install -d -m 0775 -D %{buildroot}%{_sharedstatedir}/%{name}
install -d -m 0770 -D %{buildroot}%{_sharedstatedir}/%{name}/keys
# remove static libraries and libarchive files
rm %{buildroot}%{_libdir}/*.a
rm %{buildroot}%{_libdir}/*.la
# remove libarchive files
find %{buildroot} -type f -name "*.la" -delete -print
%check
make check
%pre
getent group knot >/dev/null || groupadd -r knot
getent passwd knot >/dev/null || useradd -r -g knot -d %{_sysconfdir}/knot -s /sbin/nologin -c "Knot DNS server" knot
exit 0
getent passwd knot >/dev/null || \
useradd -r -g knot -d %{_sysconfdir}/knot -s /sbin/nologin \
-c "Knot DNS server" knot
%if 0%{?suse_version}
%service_add_pre knot.service
%endif
%post
systemd-tmpfiles --create %{_tmpfilesdir}/knot.conf &>/dev/null || :
%if 0%{?suse_version}
%service_add_post knot.service
%else
%systemd_post knot.service
%endif
%preun
%if 0%{?suse_version}
%service_del_preun knot.service
%else
%systemd_preun knot.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun knot.service
%else
%systemd_postun_with_restart knot.service
%endif
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%license COPYING
%{_pkgdocdir}/NEWS
%{_pkgdocdir}/README
%{_pkgdocdir}/samples
%dir %attr(750,root,knot) %{_sysconfdir}/%{name}
%config(noreplace) %attr(640,root,knot) %{_sysconfdir}/%{name}/%{name}.conf
%dir %attr(775,root,knot) %{_sharedstatedir}/%{name}
%dir %attr(770,root,knot) %{_sharedstatedir}/%{name}/keys
%dir %attr(-,knot,knot) %{_localstatedir}/run/%{name}
%{_unitdir}/%{name}.service
%{_unitdir}/knot.service
%{_tmpfilesdir}/%{name}.conf
%{_bindir}/kzonecheck
%{_sbindir}/kjournalprint
......@@ -193,7 +226,9 @@ exit 0
%{_mandir}/man1/knsupdate.*
%files libs
%doc COPYING NEWS
%license COPYING
%doc NEWS
%doc README
%{_libdir}/libdnssec.so.*
%{_libdir}/libknot.so.*
%{_libdir}/libzscanner.so.*
......
# Knot DNS runtime directory
d /var/run/knot 0755 knot knot -
../common/knot.tmpfiles
\ No newline at end of file
......@@ -7,8 +7,8 @@ Vagrant.configure(2) do |config|
config.vm.box = "archlinux/archlinux"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "arch" do |arch|
arch.vm.provision "ansible" do |ansible|
config.vm.define "arch_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
......
......@@ -7,8 +7,8 @@ Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "centos7" do |centos7|
centos7.vm.provision "ansible" do |ansible|
config.vm.define "centos7_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
......
......@@ -7,8 +7,8 @@ Vagrant.configure(2) do |config|
config.vm.box = "debian/stretch64"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "debian9" do |debian9|
debian9.vm.provision "ansible" do |ansible|
config.vm.define "debian9_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
......
......@@ -7,8 +7,8 @@ Vagrant.configure(2) do |config|
config.vm.box = "fedora/27-cloud-base"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "fedora27" do |fedora27|
fedora27.vm.provision "ansible" do |ansible|
config.vm.define "fedora27_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
......
......@@ -11,6 +11,8 @@
Ubuntu: dnsutils
Fedora: bind-utils
CentOS: bind-utils
openSUSE Leap: bind-utils
openSUSE Tumbleweed: bind-utils
Archlinux: bind-tools
configure_obs_repo:
Fedora: |
......@@ -28,17 +30,23 @@
wget -nv https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/xUbuntu_16.04/Release.key -O Release.key &&
apt-key add - < Release.key &&
apt-get update
openSUSE Tumbleweed: |
zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/openSUSE_Tumbleweed/home:CZ-NIC:{{ item }}.repo &&
zypper refresh
openSUSE Leap: |
zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/openSUSE_Leap_42.3/home:CZ-NIC:{{ item }}.repo &&
zypper refresh
show_package_version:
Archlinux:
pacman -Qi knot | grep '^Version'
Fedora: |
rpm -qi knot | grep '^Version'
CentOS: |
Fedora: &pkg_version_rpm |
rpm -qi knot | grep '^Version'
Debian:
dpkg -s knot | grep '^Version'
Ubuntu: |
CentOS: *pkg_version_rpm
openSUSE Leap: *pkg_version_rpm
openSUSE Tumbleweed: *pkg_version_rpm
Debian: &pkg_version_dpkg |
dpkg -s knot | grep '^Version'
Ubuntu: *pkg_version_dpkg
vars_files:
- repos.yaml
......@@ -132,6 +140,16 @@
register: res
failed_when: '"192.0.2.1" not in res.stdout'
- name: reload knot.service
service:
name: knot.service
state: reloaded
- name: resolve dns1.example.com
shell: dig @127.0.0.1 dns1.example.com A
register: res
failed_when: '"192.0.2.1" not in res.stdout'
always:
- name: show installed version
debug:
......
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
Vagrant.configure(2) do |config|
config.vm.box = "opensuse/openSUSE-Tumbleweed-x86_64"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "tumbleweed_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
end
......@@ -7,8 +7,8 @@ Vagrant.configure(2) do |config|
config.vm.box = "generic/ubuntu1604"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "ubuntu1604" do |ubuntu1604|
ubuntu1604.vm.provision "ansible" do |ansible|
config.vm.define "ubuntu1604_knot-dns" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-dns-test.yaml"
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment