From 221ea11f26a81e9a389f4d5238f150235aa2ef3b Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Wed, 25 Apr 2018 15:39:19 +0200 Subject: [PATCH] Add conditions for python sub-packages. --- cryptsetup.spec | 52 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/cryptsetup.spec b/cryptsetup.spec index b75692d..ebfa994 100644 --- a/cryptsetup.spec +++ b/cryptsetup.spec @@ -1,15 +1,38 @@ %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%if 0%{?fedora} +%if 0%{?fedora} >= 29 +%global python2_enable 0 +%global python3_enable 0 +%else +%global python2_enable 1 +%global python3_enable 1 +%endif +%else +%global python3_enable 0 +%if 0%{?rhel} == 7 +%global python2_enable 1 +%else +%global python2_enable 0 +%endif +%endif + Summary: A utility for setting up encrypted disks Name: cryptsetup Version: 2.0.2 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and LGPLv2+ Group: Applications/System URL: https://gitlab.com/cryptsetup/cryptsetup BuildRequires: libgcrypt-devel, popt-devel, device-mapper-devel BuildRequires: libgpg-error-devel, libuuid-devel, libsepol-devel -BuildRequires: libselinux-devel, python2-devel, python3-devel +BuildRequires: libselinux-devel +%if %{python2_enable} +BuildRequires: python2-devel +%endif +%if %{python3_enable} +BuildRequires: python3-devel +%endif BuildRequires: libpwquality-devel, json-c-devel, libargon2-devel Provides: cryptsetup-luks = %{version}-%{release} Obsoletes: cryptsetup-luks < 1.4.0 @@ -74,6 +97,7 @@ Requires: cryptsetup-libs = %{version}-%{release} This package contains cryptsetup-reencrypt utility which can be used for offline reencryption of disk in situ. +%if %{python2_enable} %package -n python2-cryptsetup Group: System Environment/Libraries Summary: Python bindings for libcryptsetup @@ -88,7 +112,9 @@ Obsoletes: python-cryptsetup < 1.4.0 %description -n python2-cryptsetup This package provides Python bindings for libcryptsetup, a library for setting up disk encryption using dm-crypt kernel module. +%endif +%if %{python3_enable} %package python3 Group: System Environment/Libraries Summary: Python3 bindings for libcryptsetup @@ -98,6 +124,7 @@ Provides: python3-cryptsetup = %{version}-%{release} %description python3 This package provides Python bindings for libcryptsetup, a library for setting up disk encryption using dm-crypt kernel module. +%endif %prep %setup -q -n cryptsetup-%{upstream_version} @@ -105,28 +132,38 @@ chmod -x python/pycryptsetup-test.py chmod -x misc/dracut_90reencrypt/* # copy the whole directory for the python3 build +%if %{python3_enable} cp -a . %{py3dir} +%endif %build -%configure --enable-python --enable-fips --enable-pwquality --enable-libargon2 %{?configure_pbkdf2} +%if %{python2_enable} || %{python3_enable} +%configure --enable-python --enable-fips --enable-pwquality --enable-libargon2 +%else +%configure --enable-fips --enable-pwquality --enable-libargon2 +%endif # remove rpath sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool make %{?_smp_mflags} +%if %{python3_enable} pushd %{py3dir} -%configure --enable-python --with-python_version=3 --enable-fips --enable-pwquality --enable-libargon2 %{?configure_pbkdf2} +%configure --enable-python --with-python_version=3 --enable-fips --enable-pwquality --enable-libargon2 make %{?_smp_mflags} popd +%endif %install make install DESTDIR=%{buildroot} rm -rf %{buildroot}/%{_libdir}/*.la +%if %{python3_enable} pushd %{py3dir} make install DESTDIR=%{buildroot} rm -rf %{buildroot}/%{_libdir}/*.la popd +%endif %find_lang cryptsetup %post -n cryptsetup-libs -p /sbin/ldconfig @@ -172,23 +209,30 @@ popd %{_tmpfilesdir}/cryptsetup.conf %ghost %dir /run/cryptsetup +%if %{python2_enable} %files -n python2-cryptsetup %{!?_licensedir:%global license %%doc} %license COPYING.LGPL %doc python/pycryptsetup-test.py %exclude %{python_sitearch}/pycryptsetup.la %{python_sitearch}/pycryptsetup.so +%endif +%if %{python3_enable} %files python3 %{!?_licensedir:%global license %%doc} %license COPYING.LGPL %doc python/pycryptsetup-test.py %exclude %{python3_sitearch}/pycryptsetup.la %{python3_sitearch}/pycryptsetup.so +%endif %clean %changelog +* Wed Apr 25 2018 Ondrej Kozina - 2.0.2-3 +- Add conditions for python sub-packages + * Tue Mar 27 2018 Björn Esser - 2.0.2-2 - Rebuilt for libjson-c.so.4 (json-c v0.13.1) on fc28