Conditionalize the python2 subpackage.

Some minor SPEC file modernizations.
This commit is contained in:
Charalampos Stratakis 2018-05-28 14:17:08 +02:00 committed by Chris Leech
parent 54e364e33d
commit 8e38b27eed

View File

@ -3,6 +3,13 @@
%global commit0 4ef926185f300dc34593261ab8f9de39a32f80cb
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
@ -40,10 +47,9 @@ Patch0023: 0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch
Patch0024: 0024-dont-install-scripts.patch
Patch0028: 0028-use-var-lib-iscsi-in-libopeniscsiusr.patch
BuildRequires: flex bison python2-devel python3-devel python2-setuptools doxygen kmod-devel systemd-units
BuildRequires: flex bison doxygen kmod-devel systemd-units
BuildRequires: autoconf automake libtool libmount-devel openssl-devel
BuildRequires: isns-utils-devel
BuildRequires: git
# For dir ownership
Requires: %{name}-iscsiuio >= %{version}-%{release}
Requires(post): systemd
@ -99,25 +105,34 @@ Requires: %{name} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%if %{with python2}
%package -n python2-%{name}
%{?python_provide:%python_provide python2-%{name}}
Summary: Python %{python2_version} bindings to %{name}
Group: Development/Libraries
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%description -n python2-%{name}
The %{name}-python2 package contains Python %{python2_version} bindings to the
libiscsi interface for interacting with %{name}
%endif # with python2
%package -n python3-%{name}
%{?python_provide:%python_provide python3-%{name}}
Summary: Python %{python3_version} bindings to %{name}
Group: Development/Libraries
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%description -n python3-%{name}
The %{name}-python3 package contains Python %{python3_version} bindings to the
libiscsi interface for interacting with %{name}
%prep
%autosetup -p1 -n open-iscsi-%{commit0} -Sgit_am
%autosetup -p1 -n open-iscsi-%{commit0}
# change exec_prefix, there's no easy way to override
%{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile
@ -133,8 +148,10 @@ cd ..
%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod"
pushd libiscsi
%{__python2} setup.py build
%{__python3} setup.py build
%if %{with python2}
%py2_build
%endif # with python2
%py3_build
touch -r libiscsi.doxy html/*
popd
@ -187,11 +204,15 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_includedir}
%{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir}
%if %{with python2}
%{__install} -d $RPM_BUILD_ROOT%{python2_sitearch}
%endif # with python2
%{__install} -d $RPM_BUILD_ROOT%{python3_sitearch}
pushd libiscsi
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
%if %{with python2}
%py2_install
%endif # with python2
%py3_install
popd
@ -316,8 +337,10 @@ fi
%{_libdir}/libiscsi.so
%{_includedir}/libiscsi.h
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/*
%endif # with python2
%files -n python3-%{name}
%{python3_sitearch}/*
@ -326,6 +349,7 @@ fi
* Tue Jun 19 2018 Chris Leech <cleech@redhat.com> - 6.2.0.876-1.git4ef9261
- pull in post 2.0.876 tagged fixes from upstream git
- minimal packaging of libopeniscsiusr (internal use only, no dev package yet)
- Conditionalize the python2 subpackage [Charalampos Stratakis <cstratak@redhat.com>]
* Tue Jun 19 2018 Chris Leech <cleech@redhat.com> - 6.2.0.876-1.git24580ad
- rebase to upstream 2.0.876