URL: https://github.com/freeipa/freeipa/pull/5279 Author: abbra Title: #5279: freeipa.spec.in: unify spec files across upstream RHEL, and Fedora Action: opened
PR body: """ In order to reduce maintenance burden and to be able to use automatic build tools, bring up the differences between RPM spec files in upstream, RHEL, and Fedora to a minimum. This gives us an opportunity to: - start using proper conditional macros (%bcond_with/%bcond_without) - remove old cruft where Fedora 31+ and RHEL8+ are already the same - remove Group lines which already deprecated in Fedora packaging policy - remove buildroot cleanup - support release candidate designations: mostly affects downstreams but it is better to have macro support in the common spec file Signed-off-by: Alexander Bokovoy <aboko...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/5279/head:pr5279 git checkout pr5279
From 394ca0e4bc6dd3d30987600d5605e132ddf9bc05 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <aboko...@redhat.com> Date: Wed, 18 Nov 2020 16:14:52 +0200 Subject: [PATCH] freeipa.spec.in: unify spec files across upstream RHEL, and Fedora In order to reduce maintenance burden and to be able to use automatic build tools, bring up the differences between RPM spec files in upstream, RHEL, and Fedora to a minimum. This gives us an opportunity to: - start using proper conditional macros (%bcond_with/%bcond_without) - remove old cruft where Fedora 31+ and RHEL8+ are already the same - remove Group lines which already deprecated in Fedora packaging policy - remove buildroot cleanup - support release candidate designations: mostly affects downstreams but it is better to have macro support in the common spec file Signed-off-by: Alexander Bokovoy <aboko...@redhat.com> --- freeipa.spec.in | 195 ++++++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 90 deletions(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index 13b569abb6b..e34d55a81f3 100755 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -1,3 +1,18 @@ +# ipatests enabled by default, can be disabled with --without ipatests +%bcond_without ipatests +# default to not use XML-RPC in Rawhide, can be turned around with --with ipa_join_xml +# On RHEL 8 we should use --with ipa_join_xml +%bcond_with ipa_join_xml + +# Linting is disabled by default, needed for upstream testing +%bcond_with lint + +# Build documentation with sphinx +%bcond_with doc + +# Build Python wheels +%bcond_with wheels + # 389-ds-base 1.4 no longer supports i686 platform, build only client # packages, https://bugzilla.redhat.com/show_bug.cgi?id=1544386 %if 0%{?fedora} >= 28 || 0%{?rhel} > 7 @@ -15,29 +30,19 @@ %global enable_server_option --enable-server %endif -# Build ipatests -%if 0%{?rhel} +%if %{ONLY_CLIENT} %global with_ipatests 0 %endif -%if ! %{ONLY_CLIENT} - %{!?with_ipatests:%global with_ipatests 1} -%endif -%if 0%{?with_ipatests} - %global with_ipatests_option --with-ipatests -%else - %global with_ipatests_option --without-ipatests -%endif -# Use XML-RPC with ipa-join -%if 0%{?with_ipa_join_xml} - %global with_ipa_join_xml_option --with-ipa-join-xml -%else - %global with_ipa_join_xml_option --without-ipa-join-xml -%endif +# Whether to build ipatests +%global with_ipatests_option %{?_with_ipatests} + +# Whether to use XML-RPC with ipa-join +%global with_ipa_join_xml_option %{?_with_ipa_join_xml} # lint is not executed during rpmbuild # %%global with_lint 1 -%if 0%{?with_lint} +%if %{with lint} %global linter_options --enable-pylint --with-jslint %else %global linter_options --disable-pylint --without-jslint @@ -53,46 +58,43 @@ %if 0%{?rhel} %global package_name ipa %global alt_name freeipa -%global krb5_version 1.18 +%global krb5_version 1.18.2 %global krb5_kdb_version 8.0 # 0.7.16: https://github.com/drkjam/netaddr/issues/71 -%global python_netaddr_version 0.7.16 +%global python_netaddr_version 0.7.19 # Require 4.7.0 which brings Python 3 bindings -%global samba_version 4.7.0 -%global selinux_policy_version 3.14.3-21 -%global slapi_nis_version 0.56.1-4 +%global samba_version 4.12.3-12 +%global selinux_policy_version 3.14.3-52 +%global slapi_nis_version 0.56.4 %global python_ldap_version 3.1.0-1 -# 1.4.3 moved nsslapd-db-locks to cn=bdb sub-entry -# https://pagure.io/freeipa/issue/8515 -%global ds_version 1.4.3 +# python3-lib389 +# Fix for "Installation fails: Replica Busy" +# https://pagure.io/389-ds-base/issue/49818 +%global ds_version 1.4.2.4-6 # Fix for TLS 1.3 PHA, RHBZ#1775158 %global httpd_version 2.4.37-21 -%global systemd_version 239 %else # Fedora %global package_name freeipa %global alt_name ipa # Fix for CVE-2018-20217 -%global krb5_version 1.16.1-24 +%global krb5_version 1.18 # 0.7.16: https://github.com/drkjam/netaddr/issues/71 %global python_netaddr_version 0.7.16 # Require 4.7.0 which brings Python 3 bindings -%global samba_version 2:4.7.0 +# Require 4.12 which has DsRGetForestTrustInformation access rights fixes +%global samba_version 2:4.12 + # SELinux context for dirsrv unit file, BZ 1820298 %if 0%{?fedora} >= 32 %global selinux_policy_version 3.14.5-39 %else %global selinux_policy_version 3.14.4-52 %endif -%global slapi_nis_version 0.56.1 +%global slapi_nis_version 0.56.5 -# krb5 can only provide one KDB at a time -%if 0%{?fedora} >= 32 %global krb5_kdb_version 8.0 -%else -%global krb5_kdb_version 7.0 -%endif # fix for segfault in python3-ldap, https://pagure.io/freeipa/issue/7324 %global python_ldap_version 3.1.0-1 @@ -108,7 +110,8 @@ %endif # BIND employs 'pkcs11' OpenSSL engine instead of native PKCS11 -%if 0%{?fedora} >= 31 +# Fedora 31+ uses OpenSSL engine, as well as Fedora ELN (RHEL9) +%if 0%{?fedora} || 0%{?rhel} > 8 %global with_bind_pkcs11 0 %global openssl_pkcs11_version 0.4.10-6 %global softhsm_version 2.5.0-4 @@ -131,13 +134,7 @@ # https://pagure.io/certmonger/issue/90 %global certmonger_version 0.79.7-1 -# NSS release with fix for p11-kit-proxy issue, affects F28 -# https://pagure.io/freeipa/issue/7810 -%if 0%{?fedora} == 28 -%global nss_version 3.41.0-3 -%else %global nss_version 3.41.0-1 -%endif # One-Way Trust authenticated by trust secret # https://bugzilla.redhat.com/show_bug.cgi?id=1345975#c20 @@ -162,6 +159,8 @@ # Work-around fact that RPM SPEC parser does not accept # "Version: @VERSION@" in freeipa.spec.in used for Autoconf string replacement %define IPA_VERSION @VERSION@ +# Release candidate version -- set to %%nil (one percent sign) for a release +%global rc_version %nil %define AT_SIGN @ # redefine IPA_VERSION only if its value matches the Autoconf placeholder %if "%{IPA_VERSION}" == "%{AT_SIGN}VERSION%{AT_SIGN}" @@ -170,23 +169,26 @@ Name: %{package_name} Version: %{IPA_VERSION} -Release: 0%{?dist} +Release: 0%{?rc_version:.%rc_version}%{?dist} Summary: The Identity, Policy and Audit system -Group: System Environment/Base License: GPLv3+ URL: http://www.freeipa.org/ -Source0: freeipa-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source0: https://releases.pagure.org/freeipa/freeipa-%{version}%{?rc_version}.tar.gz +Source1: https://releases.pagure.org/freeipa/freeipa-%{version}%{?rc_version}.tar.gz.asc + +# For the timestamp trick in patch application +BuildRequires: diffstat BuildRequires: openldap-devel # For KDB DAL version, make explicit dependency so that increase of version # will cause the build to fail due to unsatisfied dependencies. # DAL version change may cause code crash or memory leaks, it is better to fail early. BuildRequires: krb5-kdb-version = %{krb5_kdb_version} +BuildRequires: krb5-kdb-devel-version = %{krb5_kdb_version} BuildRequires: krb5-devel >= %{krb5_version} BuildRequires: pkgconfig(krb5) -%if 0%{?with_ipa_join_xml} +%if %{with ipa_join_xml} # 1.27.4: xmlrpc_curl_xportparms.gssapi_delegation BuildRequires: xmlrpc-c-devel >= 1.27.4 %else @@ -196,6 +198,7 @@ BuildRequires: jansson-devel BuildRequires: popt-devel BuildRequires: gcc BuildRequires: make +BuildRequires: pkgconfig BuildRequires: pkgconf BuildRequires: autoconf BuildRequires: automake @@ -223,10 +226,10 @@ BuildRequires: libsss_certmap-devel BuildRequires: libsss_nss_idmap-devel >= %{sssd_version} BuildRequires: nodejs(abi) # use old dependency on RHEL 8 for now -%if 0%{?rhel} -BuildRequires: uglify-js -%else +%if 0%{?fedora} >= 31 || 0%{?rhel} > 8 BuildRequires: python3-rjsmin +%else +BuildRequires: uglify-js %endif BuildRequires: libverto-devel BuildRequires: libunistring-devel @@ -254,7 +257,7 @@ BuildRequires: python3-psutil # # Build dependencies for wheel packaging and PyPI upload # -%if 0%{?with_wheels} +%if %{with wheels} BuildRequires: dbus-glib-devel BuildRequires: libffi-devel BuildRequires: python3-tox @@ -267,7 +270,7 @@ BuildRequires: python3-wheel # with_wheels %endif -%if 0%{?with_doc} +%if %{with doc} BuildRequires: python3-sphinx BuildRequires: python3-m2r %endif @@ -275,7 +278,7 @@ BuildRequires: python3-m2r # # Build dependencies for lint and fastcheck # -%if 0%{?with_lint} +%if 0%{with lint} BuildRequires: git BuildRequires: jsl BuildRequires: nss-tools @@ -307,7 +310,7 @@ BuildRequires: python3-polib BuildRequires: python3-pyasn1 BuildRequires: python3-pyasn1-modules BuildRequires: python3-pycodestyle -%if 0%{?fedora} >= 29 +%if 0%{?fedora} || %{?rhel} > 8 # https://bugzilla.redhat.com/show_bug.cgi?id=1648299 BuildRequires: python3-pylint >= 2.1.1-2 %else @@ -339,9 +342,9 @@ BuildRequires: krb5-server >= %{krb5_version} # # Build dependencies for SELinux policy -# +# 3.14.6-9 includes fix for https://github.com/fedora-selinux/selinux-policy/pull/333 %if 0%{?with_selinux} -BuildRequires: selinux-policy-devel +BuildRequires: selinux-policy-devel >= 3.14.6-9 %endif %description @@ -356,7 +359,6 @@ and integration with Active Directory based infrastructures (Trusts). %package server Summary: The IPA authentication server -Group: System Environment/Base Requires: %{name}-server-common = %{version}-%{release} Requires: %{name}-client = %{version}-%{release} Requires: %{name}-common = %{version}-%{release} @@ -367,6 +369,8 @@ Requires: openldap-clients > 2.4.35-4 Requires: nss-tools >= %{nss_version} Requires(post): krb5-server >= %{krb5_version} Requires(post): krb5-server >= %{krb5_base_version} +Requires: krb5-kdb-version = %{krb5_kdb_version} + Requires: krb5-pkinit-openssl >= %{krb5_version} Requires: cyrus-sasl-gssapi%{?_isa} Requires: chrony @@ -439,7 +443,6 @@ If you are installing an IPA server, you need to install this package. %package -n python3-ipaserver Summary: Python libraries used by IPA server -Group: System Environment/Libraries BuildArch: noarch %{?python_provide:%python_provide python3-ipaserver} Requires: %{name}-server-common = %{version}-%{release} @@ -452,7 +455,7 @@ Requires: python3-dbus Requires: python3-dns >= 1.15 Requires: python3-gssapi >= 1.2.0 Requires: python3-ipaclient = %{version}-%{release} -Requires: python3-kdcproxy >= 0.3 +Requires: python3-kdcproxy >= 0.4.1 Requires: python3-lxml Requires: python3-pki >= %{pki_version} Requires: python3-pyasn1 >= 0.3.2-2 @@ -478,7 +481,6 @@ If you are installing an IPA server, you need to install this package. %package server-common Summary: Common files used by IPA server -Group: System Environment/Base BuildArch: noarch Requires: %{name}-client-common = %{version}-%{release} Requires: httpd >= %{httpd_version} @@ -499,20 +501,19 @@ If you are installing an IPA server, you need to install this package. %package server-dns Summary: IPA integrated DNS server with support for automatic DNSSEC signing -Group: System Environment/Base BuildArch: noarch Requires: %{name}-server = %{version}-%{release} Requires: bind-dyndb-ldap >= 11.0-2 Requires: bind >= 9.11.0-6.P2 Requires: bind-utils >= 9.11.0-6.P2 -%if 0%{?with_bind_pkcs11} +%if %{with bind_pkcs11} Requires: bind-pkcs11 >= 9.11.0-6.P2 Requires: bind-pkcs11-utils >= 9.11.0-6.P2 %else Requires: softhsm >= %{softhsm_version} Requires: openssl-pkcs11 >= %{openssl_pkcs11_version} %endif -%if 0%{?fedora} >= 32 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 # See https://bugzilla.redhat.com/show_bug.cgi?id=1825812 Requires: opendnssec >= 2.1.6-5 %else @@ -534,7 +535,6 @@ Integrated DNS server is BIND 9. OpenDNSSEC provides key management. %package server-trust-ad Summary: Virtual package to install packages required for Active Directory trusts -Group: System Environment/Base Requires: %{name}-server = %{version}-%{release} Requires: %{name}-common = %{version}-%{release} @@ -570,7 +570,6 @@ dependencies at once. %package client Summary: IPA authentication for use on clients -Group: System Environment/Base Requires: %{name}-client-common = %{version}-%{release} Requires: %{name}-common = %{version}-%{release} Requires: python3-gssapi >= 1.2.0-5 @@ -583,13 +582,10 @@ Requires: krb5-workstation >= %{krb5_version} Requires: authselect >= 0.4-2 Requires: curl # NIS domain name config: /usr/lib/systemd/system/*-domainname.service -%if 0%{?fedora} >= 29 +# All Fedora 28+ and RHEL8+ contain the service in hostname package Requires: hostname -%else -Requires: initscripts -%endif Requires: libcurl >= 7.21.7-2 -%if 0%{?with_ipa_join_xml} +%if %{with ipa_join_xml} Requires: xmlrpc-c >= 1.27.4 %else Requires: jansson @@ -659,7 +655,6 @@ notifications via email (SMTP). %package -n python3-ipaclient Summary: Python libraries used by IPA client -Group: System Environment/Libraries BuildArch: noarch %{?python_provide:%python_provide python3-ipaclient} Requires: %{name}-client-common = %{version}-%{release} @@ -681,7 +676,6 @@ installed on every client machine. %package client-common Summary: Common files used by IPA client -Group: System Environment/Base BuildArch: noarch Provides: %{alt_name}-client-common = %{version} @@ -706,7 +700,6 @@ installed on every client machine. %package python-compat Summary: Compatiblity package for Python libraries used by IPA -Group: System Environment/Libraries BuildArch: noarch Obsoletes: %{name}-python < 4.2.91 Provides: %{name}-python = %{version}-%{release} @@ -734,7 +727,6 @@ python3-ipalib and %{name}-common. Packages still depending on %package -n python3-ipalib Summary: Python3 libraries used by IPA -Group: System Environment/Libraries BuildArch: noarch %{?python_provide:%python_provide python3-ipalib} Provides: python3-ipapython = %{version}-%{release} @@ -777,7 +769,6 @@ If you are using IPA with Python 3, you need to install this package. %package common Summary: Common files used by IPA -Group: System Environment/Libraries BuildArch: noarch Conflicts: %{name}-python < 4.2.91 @@ -787,7 +778,7 @@ Obsoletes: %{alt_name}-common < %{version} Conflicts: %{alt_name}-python < %{version} -%if 0%{?with_selinux} +%if %{with selinux} # This ensures that the *-selinux package and all it’s dependencies are not # pulled into containers and other systems that do not use SELinux. The # policy defines types and file contexts for client and server. @@ -803,13 +794,12 @@ and integration with Active Directory based infrastructures (Trusts). If you are using IPA, you need to install this package. -%if 0%{?with_ipatests} +%if %{with ipatests} %package -n python3-ipatests Summary: IPA tests and test tools BuildArch: noarch %{?python_provide:%python_provide python3-ipatests} -Requires: ldns-utils Requires: python3-ipaclient = %{version}-%{release} Requires: python3-ipaserver = %{version}-%{release} Requires: iptables @@ -837,7 +827,7 @@ This package contains tests that verify IPA functionality under Python 3. # with_ipatests %endif -%if 0%{?with_selinux} +%if %{with selinux} # SELinux subpackage %package selinux Summary: FreeIPA SELinux policy @@ -848,18 +838,46 @@ Requires(post): selinux-policy-%{selinuxtype} %{?selinux_requires} %description selinux -Custom SELinux policy module +Custom SELinux policy module for FreeIPA # with_selinux %endif + %prep -%setup -n freeipa-%{version} -q +# Update timestamps on the files touched by a patch, to avoid non-equal +# .pyc/.pyo files across the multilib peers within a build, where "Level" +# is the patch prefix option (e.g. -p1) +# Taken from specfile for sssd and python-simplejson +UpdateTimestamps() { + Level=$1 + PatchFile=$2 + + # Locate the affected files: + for f in $(diffstat $Level -l $PatchFile); do + # Set the files to have the same timestamp as that of the patch: + touch -c -r $PatchFile $f + done +} + +%setup -n freeipa-%{version}%{?rc_version} -q + +# To allow proper application patches to the stripped po files, strip originals +pushd po +for i in *.po ; do + msgattrib --translated --no-fuzzy --no-location -s $i > $i.tmp || exit 1 + mv $i.tmp $i || exit 1 +done +popd + +for p in %patches ; do + %__patch -p1 -i $p + UpdateTimestamps -p1 $p +done %build # PATH is workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1005235 export PATH=/usr/bin:/usr/sbin:$PATH - export PYTHON=%{__python3} autoreconf -ivf %configure --with-vendor-suffix=-%{release} \ @@ -892,7 +910,7 @@ make %{?_smp_mflags} check VERBOSE=yes LIBDIR=%{_libdir} # don't package ipasphinx for now rm -rf %{buildroot}%{python3_sitelib}/ipasphinx* -%if 0%{?with_ipatests} +%if %{with ipatests} mv %{buildroot}%{_bindir}/ipa-run-tests %{buildroot}%{_bindir}/ipa-run-tests-%{python3_version} mv %{buildroot}%{_bindir}/ipa-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python3_version} mv %{buildroot}%{_bindir}/ipa-test-task %{buildroot}%{_bindir}/ipa-test-task-%{python3_version} @@ -957,10 +975,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/cron.d # ONLY_CLIENT %endif -%clean -rm -rf %{buildroot} - - %if ! %{ONLY_CLIENT} %post server @@ -1118,7 +1132,7 @@ if [ $1 -gt 1 ] ; then fi -%if 0%{?with_selinux} +%if %{with selinux} # SELinux contexts are saved so that only affected files can be # relabeled after the policy module installation %pre selinux @@ -1239,6 +1253,7 @@ fi %{_sbindir}/ipa-acme-manage %{_libexecdir}/certmonger/dogtag-ipa-ca-renew-agent-submit %{_libexecdir}/certmonger/ipa-server-guard +%dir %{_libexecdir}/ipa %{_libexecdir}/ipa/ipa-custodia %{_libexecdir}/ipa/ipa-custodia-check %{_libexecdir}/ipa/ipa-httpd-kdcproxy @@ -1426,7 +1441,7 @@ fi %ghost %{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so %{_sysconfdir}/dbus-1/system.d/oddjob-ipa-trust.conf %{_sysconfdir}/oddjobd.conf.d/oddjobd-ipa-trust.conf -%%attr(755,root,root) %{_libexecdir}/ipa/oddjob/com.redhat.idm.trust-fetch-domains +%attr(755,root,root) %{_libexecdir}/ipa/oddjob/com.redhat.idm.trust-fetch-domains # ONLY_CLIENT %endif @@ -1550,7 +1565,7 @@ fi %{python3_sitelib}/ipaplatform-*.egg-info -%if 0%{?with_ipatests} +%if %{with ipatests} %files -n python3-ipatests %doc README.md Contributors.txt @@ -1573,7 +1588,7 @@ fi # with_ipatests %endif -%if 0%{?with_selinux} +%if %{with selinux} %files selinux %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.* %ghost %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org