From 3d4a1ca5c0e42b50df3379c8e70bbce6d9bc4781 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Jul 21 2018 21:28:50 +0000 Subject: SPEC: Do not build python2 bindings on latest distros Merges: https://pagure.io/SSSD/sssd/pull-request/3708 --- diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in index f516a94..81fcee4 100644 --- a/contrib/sssd.spec.in +++ b/contrib/sssd.spec.in @@ -107,6 +107,12 @@ %global with_python3_option --without-python3-bindings %endif +%if (0%{?fedora} > 28 || 0%{?rhel} > 7) + %global with_python2_option --without-python2-bindings +%else + %global with_python2 1 +%endif + %global enable_systemtap 1 %if (0%{?enable_systemtap} == 1) %global enable_systemtap_opt --enable-systemtap @@ -203,7 +209,9 @@ BuildRequires: libxml2 BuildRequires: docbook-style-xsl BuildRequires: krb5-devel BuildRequires: c-ares-devel +%if (0%{?with_python2} == 1) BuildRequires: python2-devel +%endif %if (0%{?with_python3} == 1) BuildRequires: python3-devel %endif @@ -372,6 +380,7 @@ Also provides several other administrative tools: * sss_obfuscate for generating an obfuscated LDAP password * sssctl -- an sssd status and control utility +%if (0%{?with_python2} == 1) %package -n python2-sssdconfig Summary: SSSD and IPA configuration file manipulation classes and functions Group: Applications/System @@ -381,6 +390,7 @@ BuildArch: noarch %description -n python2-sssdconfig Provides python2 files for manipulation SSSD and IPA configuration files. +%endif %if (0%{?with_python3} == 1) %package -n python3-sssdconfig @@ -394,6 +404,7 @@ BuildArch: noarch Provides python3 files for manipulation SSSD and IPA configuration files. %endif +%if (0%{?with_python2} == 1) %package -n python2-sss Summary: Python2 bindings for sssd Group: Development/Libraries @@ -408,6 +419,7 @@ SSSD when using id_provider = local in /etc/sssd/sssd.conf. Also provides several other useful python2 bindings: * function for retrieving list of groups user belongs to. * class for obfuscation of passwords +%endif %if (0%{?with_python3} == 1) %package -n python3-sss @@ -426,6 +438,7 @@ Also provides several other useful python3 bindings: * class for obfuscation of passwords %endif +%if (0%{?with_python2} == 1) %package -n python2-sss-murmur Summary: Python2 bindings for murmur hash function Group: Development/Libraries @@ -434,6 +447,7 @@ License: LGPLv3+ %description -n python2-sss-murmur Provides python2 module for calculating the murmur hash version 3 +%endif %if (0%{?with_python3} == 1) %package -n python3-sss-murmur @@ -570,6 +584,7 @@ Requires: libipa_hbac = %{version}-%{release} %description -n libipa_hbac-devel Utility library to validate FreeIPA HBAC rules for authorization requests +%if (0%{?with_python2} == 1) %package -n python2-libipa_hbac Summary: Python2 bindings for the FreeIPA HBAC Evaluator library Group: Development/Libraries @@ -582,6 +597,7 @@ Obsoletes: libipa_hbac-python < 1.12.90 %description -n python2-libipa_hbac The python2-libipa_hbac contains the bindings so that libipa_hbac can be used by Python applications. +%endif %if (0%{?with_python3} == 1) %package -n python3-libipa_hbac @@ -615,6 +631,7 @@ Requires: libsss_nss_idmap = %{version}-%{release} %description -n libsss_nss_idmap-devel Utility library for SID and certificate based lookups +%if (0%{?with_python2} == 1) %package -n python2-libsss_nss_idmap Summary: Python2 bindings for libsss_nss_idmap Group: Development/Libraries @@ -627,6 +644,7 @@ Obsoletes: libsss_nss_idmap-python < 1.12.90 %description -n python2-libsss_nss_idmap The python2-libsss_nss_idmap contains the bindings so that libsss_nss_idmap can be used by Python applications. +%endif %if (0%{?with_python3} == 1) %package -n python3-libsss_nss_idmap @@ -782,6 +800,7 @@ autoreconf -ivf %{with_initscript} \ %{?with_syslog} \ %{?with_cifs_utils_plugin_option} \ + %{?with_python2_option} \ %{?with_python3_option} \ %{?enable_polkit_rules_option} \ %{?enable_systemtap_opt} \ @@ -832,10 +851,12 @@ rm -Rf ${RPM_BUILD_ROOT}/%{_docdir}/%{name} # Older versions of rpmbuild can only handle one -f option # So we need to append to the sssd*.lang file +%if (0%{?with_python2} == 1) for file in `ls $RPM_BUILD_ROOT/%{python2_sitelib}/*.egg-info 2> /dev/null` do echo %{python2_sitelib}/`basename $file` >> python2_sssdconfig.lang done +%endif %if (0%{?with_python3} == 1) for file in `ls $RPM_BUILD_ROOT/%{python3_sitelib}/*.egg-info 2> /dev/null` @@ -914,8 +935,10 @@ done echo "sssd.lang:" cat sssd.lang +%if (0%{?with_python2} == 1) echo "python2_sssdconfig.lang:" cat python2_sssdconfig.lang +%endif %if (0%{?with_python3} == 1) echo "python3_sssdconfig.lang:" @@ -1192,10 +1215,12 @@ done %{_mandir}/man8/sss_seed.8* %{_mandir}/man8/sssctl.8* +%if (0%{?with_python2} == 1) %files -n python2-sssdconfig -f python2_sssdconfig.lang %defattr(-,root,root,-) %dir %{python2_sitelib}/SSSDConfig %{python2_sitelib}/SSSDConfig/*.py* +%endif %if (0%{?with_python3} == 1) %files -n python3-sssdconfig -f python3_sssdconfig.lang @@ -1206,9 +1231,11 @@ done %{python3_sitelib}/SSSDConfig/__pycache__/*.py* %endif +%if (0%{?with_python2} == 1) %files -n python2-sss %defattr(-,root,root,-) %{python2_sitearch}/pysss.so +%endif %if (0%{?with_python3} == 1) %files -n python3-sss @@ -1216,9 +1243,11 @@ done %{python3_sitearch}/pysss.so %endif +%if (0%{?with_python2} == 1) %files -n python2-sss-murmur %defattr(-,root,root,-) %{python2_sitearch}/pysss_murmur.so +%endif %if (0%{?with_python3} == 1) %files -n python3-sss-murmur @@ -1262,9 +1291,11 @@ done %{_libdir}/libsss_nss_idmap.so %{_libdir}/pkgconfig/sss_nss_idmap.pc +%if (0%{?with_python2} == 1) %files -n python2-libsss_nss_idmap %defattr(-,root,root,-) %{python2_sitearch}/pysss_nss_idmap.so +%endif %if (0%{?with_python3} == 1) %files -n python3-libsss_nss_idmap @@ -1272,9 +1303,11 @@ done %{python3_sitearch}/pysss_nss_idmap.so %endif +%if (0%{?with_python2} == 1) %files -n python2-libipa_hbac %defattr(-,root,root,-) %{python2_sitearch}/pyhbac.so +%endif %if (0%{?with_python3} == 1) %files -n python3-libipa_hbac