From 459fddd27d53d713a0b18a3a4dd87cf442dccf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 16 Mar 2018 15:38:27 +0100 Subject: [PATCH] Conditionalize the Python 2 subpackage, don't build it on EL > 7 --- createrepo_c.spec | 59 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/createrepo_c.spec b/createrepo_c.spec index 93d461a..de45627 100644 --- a/createrepo_c.spec +++ b/createrepo_c.spec @@ -17,10 +17,16 @@ %bcond_without drpm %endif +%if 0%{?rhel} > 7 +%bcond_with python2 +%else +%bcond_without python2 +%endif + Summary: Creates a common metadata repository Name: createrepo_c Version: 0.10.0 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv2+ URL: https://github.com/rpm-software-management/createrepo_c Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz @@ -75,6 +81,7 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} This package contains the createrepo_c C library and header files. These development files are for easy manipulation with a repodata. +%if %{with python2} %package -n python2-%{name} Summary: Python bindings for the createrepo_c library %{?python_provide:%python_provide python2-%{name}} @@ -85,6 +92,7 @@ Requires: %{name}-libs = %{version}-%{release} %description -n python2-%{name} Python bindings for the createrepo_c library. +%endif %if %{with python3} %package -n python3-%{name} @@ -101,57 +109,72 @@ Python 3 bindings for the createrepo_c library. %prep %autosetup -p1 -mkdir build +%if %{with python2} +mkdir build-py2 +%endif + %if %{with python3} mkdir build-py3 %endif %build # Build createrepo_c with Python 2 -pushd build +%if %{with python2} +pushd build-py2 %cmake ../ make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}" + %if %{without python3} + # Build C documentation + make doc-c + %endif popd +%endif # Build createrepo_c with Pyhon 3 %if %{with python3} pushd build-py3 %cmake ../ -DPYTHON_DESIRED:str=3 make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}" + # Build C documentation + make doc-c popd %endif -# Build C documentation -pushd build - make doc-c -popd - %check -pushd build +%if %{with python2} +pushd build-py2 + %if %{without python3} # Compile C tests make tests + %endif # Run Python 2 tests make ARGS="-V" test popd +%endif # Run Python 3 tests %if %{with python3} pushd build-py3 + # Compile C tests + make tests + + # Run Python 3 tests make ARGS="-V" test popd %endif %install - -pushd build +%if %{with python2} +pushd build-py2 # Install createrepo_c with Python 2 make install DESTDIR=%{buildroot} popd +%endif -# Install createrepo_c with Python 3 %if %{with python3} pushd build-py3 + # Install createrepo_c with Python 3 make install DESTDIR=%{buildroot} popd %endif @@ -175,13 +198,19 @@ popd %{_libdir}/lib%{name}.so.* %files devel -%doc build/doc/html +%if %{with python3} +%doc build-py3/doc/html +%else +%doc build-py2/doc/html +%endif %{_libdir}/lib%{name}.so %{_libdir}/pkgconfig/%{name}.pc %{_includedir}/%{name}/ +%if %{with python2} %files -n python2-%{name} %{python2_sitearch}/%{name}/ +%endif %if %{with python3} %files -n python3-%{name} @@ -189,6 +218,10 @@ popd %endif %changelog +* Fri Mar 16 2018 Miro HronĨok - 0.10.0-19 +- Conditionalize the Python 2 subpackage +- Don't build the Python 2 subpackage on EL > 7 + * Wed Feb 07 2018 Iryna Shcherbina - 0.10.0-18 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)