From 316552297b9ef8a792bab2416e6d12dd18ddeae0 Mon Sep 17 00:00:00 2001 From: Raphael Groner Date: Mar 05 2018 22:03:35 +0000 Subject: separate build of py2 and py3, experimental support for py3 --- diff --git a/ecryptfs-utils.spec b/ecryptfs-utils.spec index 951bb94..de89bfc 100644 --- a/ecryptfs-utils.spec +++ b/ecryptfs-utils.spec @@ -1,5 +1,15 @@ +# FIXME rhbz#533920, automake does not support python3 %bcond_with python3 +%bcond_without python2 +%bcond_without unittests + +%global confflags %{shrink: \ + --enable-pywrap --enable-tspi --enable-nss \ + --enable-pkcs11-helper --enable-tests \ + --with-pamdir=%{_libdir}/security \ +} + %global pydesc \ The package contains a module that permits\ applications written in the Python programming language to use\ @@ -101,7 +111,7 @@ Requires: pkgconfig %description devel Userspace development files for eCryptfs. - +%if %{with python2} %package -n python2-%{name} Summary: Python bindings for the eCryptfs utils Requires: %{name} = %{version}-%{release} @@ -111,8 +121,10 @@ Obsoletes: %{name}-python < %{version}-%{release} %{?python_provide:%python_provide python2-%{name}} %description -n python2-%{name} %pydesc +%endif +%if %{with python3} %package -n python%{python3_pkgversion}-%{name} Summary: Python bindings for the eCryptfs utils Requires: %{name} = %{version}-%{release} @@ -122,6 +134,7 @@ Obsoletes: %{name}-python < %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} %description -n python%{python3_pkgversion}-%{name} %pydesc +%endif %prep @@ -159,48 +172,52 @@ sed -i -r 's:(snprintf.*"\%)(s/\%)(s"):\1.42\2.23\3:' \ # fix usr-move sed -i -r 's:(rootsbindir=).*:\1"%{_sbindir}":' configure.ac +autoreconf -fiv # don't confuse rpmbuild to find and install everything at right places mv -t.. COPYING AUTHORS NEWS THANKS doc/ README ln -s -t. ../doc ../README popd -mv %{name}-%{version} py2 +%if %{with python2} +cp -a %{name}-%{version} py2 +%endif %if %{with python3} -cp -a py2 py3 +cp -a %{name}-%{version} py3 %endif %build +# openssl 1.1 marks some functions as deprecated +export ERRFLAGS="-Werror -Wtype-limits -Wno-unused -Wno-error=deprecated-declarations" + +%if %{with python2} +pushd py2 +export CFLAGS="$RPM_OPT_FLAGS $ERRFLAGS" # rhbz#1537244, avoid unversioned python executable export PYTHON=%{__python2} -# openssl 1.1 marks some functions as deprecated -export CFLAGS="$RPM_OPT_FLAGS -Werror -Wtype-limits -Wno-unused -Wno-error=deprecated-declarations" - -for folder in $(find . -name py\* -type d |sort -n) ; do - pushd $folder - - #we're modifing Makefile.am - autoreconf -fiv - %configure --enable-pywrap --enable-tspi --enable-nss \ - --enable-pkcs11-helper --enable-tests --with-pamdir=%{_libdir}/security - - popd - %make_build -C $folder - - # some hackery to let next configure know about another python version - %if %{with python3} - export PYTHON_VERSION=3 - export PYTHON=%{__python3} - # bug in configure fails to detect python3 - export PYTHON_NOVERSIONCHECK=1 - export CFLAGS='$(echo \${CFLAGS}) -I '$(find %{_includedir} -name python3\* -type d) - %endif -done +%configure %{confflags} +popd +%make_build -C py2 +%endif + +%if %{with python3} +pushd py3 +export PYTHON_VERSION=3 +export PYTHON=%{__python3} +export PYTHON_NOVERSIONCHECK=1 +export PY3FLAGS='%(pkg-config --cflags --libs python3)' +export CFLAGS="$RPM_OPT_FLAGS $PY3FLAGS $ERRFLAGS" +%configure %{confflags} +popd +%make_build -C py3 +%endif %install +%if %{with python2} %make_install -C py2 +%endif %if %{with python3} %make_install -C py3 %endif @@ -239,10 +256,12 @@ then exit 1 fi +%if %{with unittests} for folder in $(find . -name py\* -type d) ; do export LD_LIBRARY_PATH=${folder}/src/libecryptfs/.libs make check -C $folder done +%endif %pre @@ -329,9 +348,11 @@ fi %{_libdir}/pkgconfig/libecryptfs.pc %{_includedir}/ecryptfs.h +%if %{with python2} %files -n python2-%{name} %{python2_sitearch}/%{name}/ %{python2_sitelib}/%{name}/ +%endif %if %{with python3} %files -n python%{python3_pkgversion}-%{name} @@ -341,10 +362,10 @@ fi %changelog -* Fri Mar 02 2018 Raphael Groner - 111-8 +* Mon Mar 05 2018 Raphael Groner - 111-8 - avoid unversioned python executable -- add python3 subpackage (experimental, disabled due to a bug with gcc) -- optimize a little bit +- add python3 subpackage (experimental, found odd bug in automake) +- optimize generally here and there * Wed Aug 02 2017 Fedora Release Engineering - 111-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild