From 5fe0b21885ae987d45fca1b3eb3f36c8fc8659dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Thu, 15 Feb 2018 23:36:01 +0100 Subject: [PATCH] - Use bcond_with to define optional features instead of %global - Move export libs closer to PKCS11 libs, simplify soversion updates - Remove unnecesary spec parts --- bind.spec | 214 +++++++++++++++++++++++++----------------------------- 1 file changed, 100 insertions(+), 114 deletions(-) diff --git a/bind.spec b/bind.spec index b8c00e6..c76faa1 100644 --- a/bind.spec +++ b/bind.spec @@ -6,29 +6,30 @@ %global PREVER b1 %global BINDVERSION %{version}%{?PREVER}%{?PATCHVER:-%{PATCHVER}} +# bcond_without is built by default, unless --without X is passed +# bcond_with is built only when --with X is passed to build +%bcond_without UNITTEST +%bcond_with SYSTEMTEST +%bcond_without SDB +%bcond_without GSSTSIG +# it is not possible to build the package without PKCS11 sub-package +# due to extensive changes to Makefiles +%bcond_without PKCS11 +%bcond_without DEVEL +%bcond_with LMDB +%bcond_with DLZ +%bcond_without EXPORT_LIBS -%global with_export_libs 1 +%{?!bind_uid: %global bind_uid 25} +%{?!bind_gid: %global bind_gid 25} +%global bind_dir /var/named +%global chroot_prefix %{bind_dir}/chroot +%if %{with SDB} +%global chroot_sdb_prefix %{bind_dir}/chroot_sdb +%endif ## The order of libs is important. See lib/Makefile.in for details %define bind_export_libs isc dns isccfg irs %{!?_export_dir:%global _export_dir /bind9-export/} - -%{?!SDB: %global SDB 1} -%{?!unittest: %global unittest 1} -%{?!systemtest:%global systemtest 0} -%{?!bind_uid: %global bind_uid 25} -%{?!bind_gid: %global bind_gid 25} -%{?!GSSTSIG: %global GSSTSIG 1} -# it is not possible to build the package without PKCS11 sub-package -# due to extensive changes to Makefiles -%{?!PKCS11: %global PKCS11 1} -%{?!DEVEL: %global DEVEL 1} -%{?!LMDB: %global LMDB 0} -%{?!DLZ: %global DLZ 0} -%global bind_dir /var/named -%global chroot_prefix %{bind_dir}/chroot -%if %{SDB} -%global chroot_sdb_prefix %{bind_dir}/chroot_sdb -%endif # libisc-nosym requires to be linked with unresolved symbols # When libisc-nosym linking is fixed, it can be defined to 1 # Visit https://bugzilla.redhat.com/show_bug.cgi?id=1540300 @@ -41,7 +42,6 @@ Version: 9.11.3 Release: 1%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist} Epoch: 32 Url: http://www.isc.org/products/BIND/ -Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Group: System Environment/Daemons # Source: https://ftp.isc.org/isc/bind9/%{BINDVERSION}/bind-%{BINDVERSION}.tar.gz @@ -133,22 +133,22 @@ BuildRequires: systemd BuildRequires: python3-devel BuildRequires: python3-ply BuildRequires: findutils sed -%if %{SDB} +%if %{with SDB} BuildRequires: openldap-devel, postgresql-devel, sqlite-devel, mariadb-connector-c-devel BuildRequires: libdb-devel %endif -%if %{unittest} +%if %{with UNITTEST} # make unit dependencies BuildRequires: libatf-c-devel kyua-cli softhsm %endif -%if %{systemtest} +%if %{with SYSTEMTEST} # bin/tests/system dependencies BuildRequires: net-tools perl(Net::DNS) perl(Net::DNS::Nameserver) %endif -%if %{GSSTSIG} +%if %{with GSSTSIG} BuildRequires: krb5-devel %endif -%if %{LMDB} +%if %{with LMDB} BuildRequires: lmdb-devel %endif # Needed to regenerate dig.1 manpage @@ -161,7 +161,7 @@ which resolves host names to IP addresses; a resolver library (routines for applications to use when interfacing with DNS); and tools for verifying that the DNS server is operating properly. -%if %{PKCS11} +%if %{with PKCS11} %package pkcs11 Summary: Bind with native PKCS#11 functionality for crypto Group: System Environment/Daemons @@ -206,7 +206,7 @@ This a set of development files for BIND libraries (dns, isc) compiled with native PKCS#11 functionality. %endif -%if %{SDB} +%if %{with SDB} %package sdb Summary: BIND server with database backends and DLZ support Group: System Environment/Daemons @@ -270,7 +270,7 @@ network addresses. You should install bind-utils if you need to get information from DNS name servers. -%if %{DEVEL} +%if %{with DEVEL} %package devel Summary: Header files and libraries needed for BIND DNS development Group: Development/Libraries @@ -306,7 +306,7 @@ This package contains a tree of files which can be used as a chroot(2) jail for the named(8) program from the BIND package. Based on the code from Jan "Yenya" Kasprzak -%if %{SDB} +%if %{with SDB} %package sdb-chroot Summary: A chroot runtime environment for the ISC BIND DNS server, named-sdb(8) Group: System Environment/Daemons @@ -322,7 +322,7 @@ Based on the code from Jan "Yenya" Kasprzak %endif -%if %{DLZ} +%if %{with DLZ} %package dlz-bdb Summary: BIND server bdb DLZ module Group: System Environment/Libraries @@ -385,7 +385,7 @@ BuildArch: noarch %description -n python3-bind This package provides a module which allows commands to be sent to rndc directly from Python programs. -%if %{with_export_libs} +%if %{with EXPORT_LIBS} %package export-libs Summary: ISC libs for DHCP application Group: System Environment/Libraries @@ -437,7 +437,7 @@ are used for building ISC DHCP. %patch152 -p1 -b .kyua-unit-oot %patch153 -p1 -b .export_suffix -%if %{PKCS11} +%if %{with PKCS11} cp -r bin/named{,-pkcs11} cp -r bin/dnssec{,-pkcs11} cp -r lib/isc{,-pkcs11} @@ -446,7 +446,7 @@ cp -r lib/dns{,-pkcs11} %patch149 -p1 -b .kyua-pkcs11 %endif -%if %{SDB} +%if %{with SDB} %patch101 -p1 -b .old-api mkdir bin/named-sdb cp -r bin/named/* bin/named-sdb @@ -530,11 +530,11 @@ export LIBDIR_SUFFIX --includedir=%{_includedir}/bind9 \ --with-tuning=large \ --with-geoip \ -%if %{PKCS11} +%if %{with PKCS11} --enable-native-pkcs11 \ --with-pkcs11=%{_libdir}/pkcs11/libsofthsm2.so \ %endif -%if %{SDB} +%if %{with SDB} --with-dlopen=yes \ --with-dlz-ldap=yes \ --with-dlz-postgres=yes \ @@ -542,16 +542,16 @@ export LIBDIR_SUFFIX --with-dlz-filesystem=yes \ --with-dlz-bdb=yes \ %endif -%if %{GSSTSIG} +%if %{with GSSTSIG} --with-gssapi=yes \ --disable-isc-spnego \ %endif -%if %{LMDB} +%if %{with LMDB} --with-lmdb=yes \ %else --with-lmdb=no \ %endif -%if %{unittest} +%if %{with UNITTEST} --with-atf=/usr \ %endif --enable-fixed-rrset \ @@ -575,7 +575,7 @@ pushd bin/python make man popd -%if %{DLZ} +%if %{with DLZ} pushd contrib/dlz pushd bin/dlzbdb make @@ -592,7 +592,7 @@ popd # build %unit_prepare_build build %systemtest_prepare_build build -%if %{with_export_libs} +%if %{with EXPORT_LIBS} ## Create export libs ## mkdir -p export-libs pushd export-libs @@ -610,7 +610,7 @@ export LIBDIR_SUFFIX --with-gssapi=yes \ --disable-isc-spnego \ --enable-fixed-rrset \ -%if %{unittest} +%if %{with UNITTEST} --with-atf=/usr \ %endif --disable-rpz-nsip \ @@ -655,13 +655,13 @@ sed -e '/^\s*include(.*-pkcs11/ d' -e '/^\s*include(.*lwres/ d' \ %endif %check -%if %{PKCS11} +%if %{with PKCS11} # Tests require initialization of pkcs11 token export SOFTHSM2_CONF="`pwd`/softhsm2.conf" sh %{SOURCE48} "${SOFTHSM2_CONF}" "`pwd`/softhsm-tokens" %endif -%if %{unittest} +%if %{with UNITTEST} pushd build make unit e=$? @@ -682,7 +682,7 @@ sed -e '/^\s*include(.*-pkcs11/ d' -e '/^\s*include(.*lwres/ d' \ %endif -%if %{systemtest} +%if %{with SYSTEMTEST} if [ "`whoami`" = 'root' ]; then set -e chmod -R a+rwX . @@ -706,8 +706,6 @@ else : %install -rm -rf ${RPM_BUILD_ROOT} - # Build directory hierarchy mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/bind @@ -736,7 +734,7 @@ touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/etc/named.conf #end chroot #sdb-chroot -%if %{SDB} +%if %{with SDB} mkdir -p ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}/{dev,etc,var,run/named} mkdir -p ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}/var/{log,named,tmp} mkdir -p ${RPM_BUILD_ROOT}/%{chroot_sdb_prefix}/etc/crypto-policies/back-ends @@ -760,7 +758,7 @@ pushd build make DESTDIR=${RPM_BUILD_ROOT} install popd -%if %{with_export_libs} +%if %{with EXPORT_LIBS} pushd export-libs make DESTDIR=${RPM_BUILD_ROOT} install mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/ld.so.conf.d @@ -781,13 +779,13 @@ install -m 644 %{SOURCE38} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE44} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE46} ${RPM_BUILD_ROOT}%{_unitdir} -%if %{SDB} +%if %{with SDB} install -m 644 %{SOURCE39} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE40} ${RPM_BUILD_ROOT}%{_unitdir} install -m 644 %{SOURCE45} ${RPM_BUILD_ROOT}%{_unitdir} %endif -%if %{PKCS11} +%if %{with PKCS11} install -m 644 %{SOURCE47} ${RPM_BUILD_ROOT}%{_unitdir} %endif @@ -795,20 +793,20 @@ mkdir -p ${RPM_BUILD_ROOT}%{_libexecdir} install -m 755 %{SOURCE41} ${RPM_BUILD_ROOT}%{_libexecdir}/setup-named-chroot.sh install -m 755 %{SOURCE42} ${RPM_BUILD_ROOT}%{_libexecdir}/generate-rndc-key.sh -%if %{PKCS11} +%if %{with PKCS11} install -m 755 %{SOURCE48} ${RPM_BUILD_ROOT}%{_libexecdir}/setup-named-softhsm.sh %endif install -m 644 %SOURCE3 ${RPM_BUILD_ROOT}/etc/logrotate.d/named mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig install -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/named -%if %{SDB} +%if %{with SDB} mkdir -p ${RPM_BUILD_ROOT}/etc/openldap/schema install -m 644 %{SOURCE8} ${RPM_BUILD_ROOT}/etc/openldap/schema/dnszone.schema install -m 644 %{SOURCE12} contrib/sdb/pgsql/ %endif -%if %{DLZ} +%if %{with DLZ} pushd contrib/dlz pushd bin/dlzbdb make DESTDIR=${RPM_BUILD_ROOT} install @@ -834,7 +832,7 @@ popd find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';'; # Remove -devel files out of buildroot if not needed -%if !%{DEVEL} +%if !%{with DEVEL} rm -f ${RPM_BUILD_ROOT}/%{_libdir}/bind9/*so rm -rf ${RPM_BUILD_ROOT}/%{_includedir}/bind9 rm -f ${RPM_BUILD_ROOT}/%{_mandir}/man1/isc-config.sh.1* @@ -843,7 +841,7 @@ rm -f ${RPM_BUILD_ROOT}/%{_bindir}/isc-config.sh %endif # SDB manpages -%if %{SDB} +%if %{with SDB} install -m 644 %{SOURCE31} ${RPM_BUILD_ROOT}%{_mandir}/man1/ldap2zone.1 install -m 644 %{SOURCE32} ${RPM_BUILD_ROOT}%{_mandir}/man8/named-sdb.8 install -m 644 %{SOURCE33} ${RPM_BUILD_ROOT}%{_mandir}/man1/zonetodb.1 @@ -851,7 +849,7 @@ install -m 644 %{SOURCE34} ${RPM_BUILD_ROOT}%{_mandir}/man1/zone2sqlite.1 %endif # PKCS11 versions manpages -%if %{PKCS11} +%if %{with PKCS11} pushd ${RPM_BUILD_ROOT}%{_mandir}/man8 ln -s named.8.gz named-pkcs11.8.gz ln -s dnssec-checkds.8.gz dnssec-checkds-pkcs11.8.gz @@ -925,7 +923,7 @@ fi # Package upgrade, not uninstall %systemd_postun_with_restart named.service -%if %{SDB} +%if %{with SDB} %post sdb # Initial installation %systemd_post named-sdb.service @@ -939,7 +937,7 @@ fi %systemd_postun_with_restart named-sdb.service %endif -%if %{PKCS11} +%if %{with PKCS11} %post pkcs11 # Initial installation %systemd_post named-pkcs11.service @@ -967,11 +965,11 @@ fi %ldconfig_scriptlets libs %ldconfig_scriptlets libs-lite -%if %{PKCS11} +%if %{with PKCS11} %ldconfig_scriptlets pkcs11-libs %endif -%if %{with_export_libs} +%if %{with EXPORT_LIBS} %post export-libs -p /sbin/ldconfig %postun export-libs -p /sbin/ldconfig @@ -1008,7 +1006,7 @@ fi %systemd_postun_with_restart named-chroot.service -%if %{SDB} +%if %{with SDB} %post sdb-chroot %systemd_post named-sdb-chroot.service @@ -1047,7 +1045,6 @@ rm -rf ${RPM_BUILD_ROOT} :; %files -%defattr(-,root,root,-) %{_libdir}/bind %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/named %config(noreplace) %attr(0644,root,named) %{_sysconfdir}/named.iscdlv.key @@ -1103,7 +1100,7 @@ rm -rf ${RPM_BUILD_ROOT} %defattr(-,named,named,-) %dir /run/named -%if %{SDB} +%if %{with SDB} %files sdb %defattr(-,root,root,-) %{_unitdir}/named-sdb.service @@ -1129,19 +1126,16 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/liblwres.so.160* %files libs-lite -%defattr(-,root,root,-) %{_libdir}/libdns.so.1100* %{_libdir}/libirs.so.160* %{_libdir}/libisc.so.169* %{_libdir}/libisccfg.so.160* %files license -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license COPYRIGHT %files utils -%defattr(-,root,root,-) %{_bindir}/dig %{_bindir}/delv %{_bindir}/host @@ -1153,13 +1147,13 @@ rm -rf ${RPM_BUILD_ROOT} %{_sbindir}/genrandom %{_sbindir}/nsec3hash %{_sbindir}/dnssec* -%if %{PKCS11} +%if %{with PKCS11} %exclude %{_sbindir}/dnssec*pkcs11 %endif %{_sbindir}/isc-hmac-fixup %{_sbindir}/named-checkzone %{_sbindir}/named-compilezone -%if %{LMDB} +%if %{with LMDB} %{_sbindir}/named-nzd2nzf %endif %{_mandir}/man1/host.1* @@ -1173,20 +1167,19 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man8/genrandom.8* %{_mandir}/man8/nsec3hash.8* %{_mandir}/man8/dnssec*.8* -%if %{PKCS11} +%if %{with PKCS11} %exclude %{_mandir}/man8/dnssec*-pkcs11.8* %endif %{_mandir}/man8/isc-hmac-fixup.8* %{_mandir}/man8/named-checkzone.8* %{_mandir}/man8/named-compilezone.8* -%if %{LMDB} +%if %{with LMDB} %{_mandir}/man8/named-nzd2nzf.8* %endif %{_sysconfdir}/trusted-key.key -%if %{DEVEL} +%if %{with DEVEL} %files devel -%defattr(-,root,root,-) %{_libdir}/libbind9.so %{_libdir}/libisccc.so %{_libdir}/liblwres.so @@ -1202,7 +1195,6 @@ rm -rf ${RPM_BUILD_ROOT} %endif %files lite-devel -%defattr(-,root,root,-) %{_libdir}/libdns.so %{_libdir}/libirs.so %{_libdir}/libisc.so @@ -1248,7 +1240,7 @@ rm -rf ${RPM_BUILD_ROOT} %dir %{chroot_prefix}/run/named %{chroot_prefix}/var/run -%if %{SDB} +%if %{with SDB} %files sdb-chroot %defattr(-,root,root,-) %{_unitdir}/named-sdb-chroot.service @@ -1282,7 +1274,7 @@ rm -rf ${RPM_BUILD_ROOT} %{chroot_sdb_prefix}/var/run %endif -%if %{PKCS11} +%if %{with PKCS11} %files pkcs11 %defattr(-,root,root,-) %{_sbindir}/named-pkcs11 @@ -1291,7 +1283,6 @@ rm -rf ${RPM_BUILD_ROOT} %{_libexecdir}/setup-named-softhsm.sh %files pkcs11-utils -%defattr(-,root,root,-) %{_sbindir}/dnssec*pkcs11 %{_sbindir}/pkcs11-destroy %{_sbindir}/pkcs11-keygen @@ -1301,12 +1292,10 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man8/dnssec*-pkcs11.8* %files pkcs11-libs -%defattr(-,root,root,-) %{_libdir}/libdns-pkcs11.so.1100* %{_libdir}/libisc-pkcs11.so.169* %files pkcs11-devel -%defattr(-,root,root,-) %{_includedir}/bind9/pk11/*.h %exclude %{_includedir}/bind9/pk11/site.h %{_includedir}/bind9/pkcs11 @@ -1314,7 +1303,39 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libisc-pkcs11.so %endif -%if %{DLZ} +%if %{with EXPORT_LIBS} +%files export-libs +%dir %{_libdir}/%{_export_dir} +%{_libdir}/%{_export_dir}/libdns-export.so.1100* +%{_libdir}/%{_export_dir}/libirs-export.so.160* +%{_libdir}/%{_export_dir}/libisc-export.so.169* +%{_libdir}/%{_export_dir}/libisccfg-export.so.160* +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-export-%{_arch}.conf +# This subpackage has to distribute its own license. Do not conflict with +# other subpackages of different version +%license COPYRIGHT + +%files export-devel +%{_libdir}/%{_export_dir}/libdns-export.so +%{_libdir}/%{_export_dir}/libirs-export.so +%{_libdir}/%{_export_dir}/libisc-export.so +%{_libdir}/%{_export_dir}/libisccfg-export.so +%dir %{_includedir}/%{_export_dir} +%{_includedir}/%{_export_dir}/dns +%{_includedir}/%{_export_dir}/dst +%{_includedir}/%{_export_dir}/irs +%{_includedir}/%{_export_dir}/isc +%dir %{_includedir}/%{_export_dir}/pk11 +%{_includedir}/%{_export_dir}/pk11/site.h +%{_includedir}/%{_export_dir}/isccfg +%{_includedir}/%{_export_dir}/config.h +%{_mandir}/man1/isc-export-config.sh.1* +%{_mandir}/man1/bind9-export-config.1* +%attr(0755,root,root) %{_bindir}/isc-export-config.sh +%{_bindir}/bind9-export-config +%endif + +%if %{with DLZ} %files dlz-bdb %{_sbindir}/dlzbdb %{_libdir}/bind/dlz_bdbhpt_dynamic.so @@ -1343,45 +1364,10 @@ rm -rf ${RPM_BUILD_ROOT} %endif %files -n python3-bind -%defattr(-,root,root,-) %{python3_sitelib}/*.egg-info %{python3_sitelib}/isc/ -%if %{with_export_libs} -%files export-libs -%defattr(-,root,root,-) -%dir %{_libdir}/%{_export_dir} -%{_libdir}/%{_export_dir}/libdns-export.so.1100* -%{_libdir}/%{_export_dir}/libirs-export.so.160* -%{_libdir}/%{_export_dir}/libisc-export.so.169* -%{_libdir}/%{_export_dir}/libisccfg-export.so.160* -%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-export-%{_arch}.conf -# This subpackage has to distribute its own license. Do not conflict with -# other subpackages of different version -%license COPYRIGHT - -%files export-devel -%defattr(-,root,root,-) -%{_libdir}/%{_export_dir}/libdns-export.so -%{_libdir}/%{_export_dir}/libirs-export.so -%{_libdir}/%{_export_dir}/libisc-export.so -%{_libdir}/%{_export_dir}/libisccfg-export.so -%dir %{_includedir}/%{_export_dir} -%{_includedir}/%{_export_dir}/dns -%{_includedir}/%{_export_dir}/dst -%{_includedir}/%{_export_dir}/irs -%{_includedir}/%{_export_dir}/isc -%dir %{_includedir}/%{_export_dir}/pk11 -%{_includedir}/%{_export_dir}/pk11/site.h -%{_includedir}/%{_export_dir}/isccfg -%{_includedir}/%{_export_dir}/config.h -%{_mandir}/man1/isc-export-config.sh.1* -%{_mandir}/man1/bind9-export-config.1* -%attr(0755,root,root) %{_bindir}/isc-export-config.sh -%{_bindir}/bind9-export-config -%endif - %changelog * Thu Feb 15 2018 Petr Menšík - 32:9.11.3-1.b1 - Rebase to 9.11.3b1