Various spec file improvements

- Remove _hardened_build variable as it is no longer needed
- Clean up numbering of sources
- Further %{name} changes to allow different package name
- Move documentation into sub-package
- Move tpmfiles.d configuration into separate file
- Start using %autorelease and %autochangelog
- Remove %license COPYING for devel due to lib dependency
This commit is contained in:
Martin Osvald 2023-08-22 08:52:05 +02:00
parent a8c4eff904
commit e504b73f9d
2 changed files with 42 additions and 29 deletions

5
kea-tmpfiles.d.conf Normal file
View File

@ -0,0 +1,5 @@
# kea needs existing /run/kea/ to create logger_lockfile there
# See tmpfiles.d(5) for details
d /run/kea 0755 root root -

View File

@ -1,5 +1,3 @@
#http://lists.fedoraproject.org/pipermail/devel/2011-August/155358.html
%global _hardened_build 1
%global sysrepo 0
#%%global prever P1
@ -12,15 +10,16 @@ Summary: DHCPv4, DHCPv6 and DDNS server from ISC
License: MPL-2.0 AND BSL-1.0
URL: http://kea.isc.org
Source0: https://downloads.isc.org/isc/kea/%{version}%{?prever:-%{prever}}/kea-%{version}%{?prever:-%{prever}}.tar.gz
Source5: https://downloads.isc.org/isc/kea/%{version}%{?prever:-%{prever}}/kea-%{version}%{?prever:-%{prever}}.tar.gz.asc
Source1: https://downloads.isc.org/isc/kea/%{version}%{?prever:-%{prever}}/kea-%{version}%{?prever:-%{prever}}.tar.gz.asc
# Obtained from https://www.isc.org/pgpkey/
Source6: isc-keyblock.asc
Source1: kea-dhcp4.service
Source2: kea-dhcp6.service
Source3: kea-dhcp-ddns.service
Source4: kea-ctrl-agent.service
Source2: isc-keyblock.asc
Source3: kea-dhcp4.service
Source4: kea-dhcp6.service
Source5: kea-dhcp-ddns.service
Source6: kea-ctrl-agent.service
Source7: kea-tmpfiles.d.conf
Patch3: kea-openssl-version.patch
Patch1: kea-openssl-version.patch
# autoreconf
BuildRequires: autoconf automake libtool
@ -64,7 +63,7 @@ BuildRequires: python3-sphinx_rtd_theme
BuildRequires: make
BuildRequires: gnupg2
Requires: kea-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
@ -78,9 +77,17 @@ rebinding and release. The DHCPv6 server supports prefix delegation. Both
servers support DNS Update mechanism, using stand-alone DDNS daemon.
%package doc
Summary: Documentation for Kea DHCP server
BuildArch: noarch
%description doc
Documentation and example configuration for Kea DHCP server.
%package devel
Summary: Development headers and libraries for Kea DHCP server
Requires: kea-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
# to build hooks (#1335900)
Requires: boost-devel
Requires: openssl-devel
@ -92,7 +99,7 @@ Header files and API documentation.
%package hooks
Summary: Hooks libraries for kea
Requires: kea-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description hooks
Hooking mechanism allow Kea to load one or more dynamically-linked libraries
@ -110,7 +117,7 @@ This package contains shared libraries used by Kea DHCP server.
%prep
%if 0%{?fedora}
%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE5}' --data='%{SOURCE0}'
%{gpgverify} --keyring='%{S:2}' --signature='%{S:1}' --data='%{S:0}'
%endif
rm -rf doc/sphinx/_build
%autosetup -p1 -n kea-%{version}%{?prever:-%{prever}}
@ -154,10 +161,10 @@ autoreconf --verbose --force --install
find %{buildroot} -type f -name "*.la" -delete -print
# Install systemd units
install -Dpm 0644 %{S:1} %{buildroot}%{_unitdir}/kea-dhcp4.service
install -Dpm 0644 %{S:2} %{buildroot}%{_unitdir}/kea-dhcp6.service
install -Dpm 0644 %{S:3} %{buildroot}%{_unitdir}/kea-dhcp-ddns.service
install -Dpm 0644 %{S:4} %{buildroot}%{_unitdir}/kea-ctrl-agent.service
install -Dpm 0644 %{S:3} %{buildroot}%{_unitdir}/kea-dhcp4.service
install -Dpm 0644 %{S:4} %{buildroot}%{_unitdir}/kea-dhcp6.service
install -Dpm 0644 %{S:5} %{buildroot}%{_unitdir}/kea-dhcp-ddns.service
install -Dpm 0644 %{S:6} %{buildroot}%{_unitdir}/kea-ctrl-agent.service
# Start empty lease databases
mkdir -p %{buildroot}%{_sharedstatedir}/kea/
@ -165,19 +172,12 @@ touch %{buildroot}%{_sharedstatedir}/kea/kea-leases4.csv
touch %{buildroot}%{_sharedstatedir}/kea/kea-leases6.csv
rm -f %{buildroot}%{_pkgdocdir}/COPYING
rm -f %{buildroot}%{_pkgdocdir}/html/.buildinfo
mkdir -p %{buildroot}/run
install -d -m 0755 %{buildroot}/run/kea/
install -dm 0755 %{buildroot}/run/kea/
# install /usr/lib/tmpfiles.d/kea.conf
mkdir -p %{buildroot}%{_tmpfilesdir}
cat > %{buildroot}%{_tmpfilesdir}/kea.conf <<EOF
# kea needs existing /run/kea/ to create logger_lockfile there
# See tmpfiles.d(5) for details
d /run/kea 0755 root root -
EOF
install -Dpm 0644 %{S:7} %{buildroot}%{_tmpfilesdir}/kea.conf
%post
@ -195,7 +195,6 @@ EOF
%files
%license COPYING
%doc AUTHORS ChangeLog README CONTRIBUTING.md examples html platforms.rst code_of_conduct.md
%{_bindir}/kea-msg-compiler
%{_sbindir}/kea-admin
%{_sbindir}/kea-ctrl-agent
@ -226,8 +225,17 @@ EOF
%dir /run/kea/
%{_tmpfilesdir}/kea.conf
%files doc
%{_pkgdocdir}/AUTHORS
%{_pkgdocdir}/ChangeLog
%{_pkgdocdir}/README
%{_pkgdocdir}/examples
%{_pkgdocdir}/CONTRIBUTING.md
%{_pkgdocdir}/platforms.rst
%{_pkgdocdir}/code_of_conduct.md
%{_pkgdocdir}/html
%files devel
%license COPYING
%{_includedir}/kea
%{_libdir}/libkea-*.so