From a8dc18f628bad59929def22d62000a8ded739aa9 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Mar 20 2018 13:33:57 +0000 Subject: [PATCH 1/2] Use bcond for with python3, allow it on RHEL > 7 --- diff --git a/python-blivet.spec b/python-blivet.spec index 342299c..808051c 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -1,10 +1,11 @@ %define is_rhel 0%{?rhel} != 0 -# python3 is not available on RHEL -%if %{is_rhel} -%define with_python3 0 +# python3 is not available on RHEL <=7 +%if %{is_rhel} && 0%{?rhel} <= 7 +# disable python3 by default +%bcond_with python3 %else -%define with_python3 1 +%bcond_without python3 %endif Summary: A python module for system storage configuration @@ -14,7 +15,7 @@ Version: 3.0.0 %global prerelease .b1 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 0.5%{?prerelease}%{?dist} +Release: 0.6%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ Group: System Environment/Libraries @@ -52,7 +53,7 @@ Conflicts: python3-blivet < 1:2.0.0 The %{realname}-data package provides data files required by the %{realname} python module. -%if %{with_python3} +%if %{with python3} %package -n python3-%{realname} Summary: A python3 package for examining and modifying storage configuration. @@ -134,14 +135,14 @@ configuration. %build make PYTHON=%{__python2} -%if %{with_python3} +%if %{with python3} make PYTHON=%{__python3} %endif %install make PYTHON=%{__python2} DESTDIR=%{buildroot} install -%if %{with_python3} +%if %{with python3} make PYTHON=%{__python3} DESTDIR=%{buildroot} install %endif @@ -158,7 +159,7 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %doc README ChangeLog examples %{python2_sitelib}/* -%if %{with_python3} +%if %{with python3} %files -n python3-%{realname} %license COPYING %doc README ChangeLog examples @@ -166,6 +167,9 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %endif %changelog +* Tue Mar 20 2018 Miro Hrončok - 1:3.0.0-0.6.b1 +- Use bcond for with python3, allow it on RHEL > 7 + * Sat Mar 17 2018 Iryna Shcherbina - 1:3.0.0-0.5.b1 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) From fa8b3e78f29d942d15838b61aec50a01f9e785b3 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Mar 20 2018 13:44:34 +0000 Subject: [PATCH 2/2] Conditionalize the Python 2 subpackage and don't build it on EL > 7 and Fedora > 28 --- diff --git a/python-blivet.spec b/python-blivet.spec index 808051c..1c1723e 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -8,6 +8,14 @@ %bcond_without python3 %endif +# python2 is not available on RHEL > 7 and not needed on Fedora > 28 +%if 0%{?rhel} > 7 || 0%{?fedora} > 28 +# disable python2 by default +%bcond_with python2 +%else +%bcond_without python2 +%endif + Summary: A python module for system storage configuration Name: python-blivet Url: https://www-rhstorage.rhcloud.com/projects/blivet @@ -79,13 +87,20 @@ Requires: systemd-udev Requires: %{realname}-data = %{epoch}:%{version}-%{release} Obsoletes: blivet-data < 1:2.0.0 + +%if %{without python2} +Obsoletes: python2-blivet < 1:3.0.0-0.6 +Obsoletes: python-blivet < 1:3.0.0-0.6 +%else Obsoletes: python-blivet < 1:2.0.0 +%endif %description -n python3-%{realname} The python3-%{realname} is a python3 package for examining and modifying storage configuration. %endif +%if %{with python2} %package -n python2-%{realname} Summary: A python2 package for examining and modifying storage configuration. @@ -128,23 +143,18 @@ Obsoletes: python-blivet < 1:2.0.0 %description -n python2-%{realname} The python2-%{realname} is a python2 package for examining and modifying storage configuration. +%endif %prep %autosetup -n %{realname}-%{realversion} -p1 %build -make PYTHON=%{__python2} - -%if %{with python3} -make PYTHON=%{__python3} -%endif +%{?with_python2:make PYTHON=%{__python2}} +%{?with_python3:make PYTHON=%{__python3}} %install -make PYTHON=%{__python2} DESTDIR=%{buildroot} install - -%if %{with python3} -make PYTHON=%{__python3} DESTDIR=%{buildroot} install -%endif +%{?with_python2:make PYTHON=%{__python2} DESTDIR=%{buildroot} install} +%{?with_python3:make PYTHON=%{__python3} DESTDIR=%{buildroot} install} %find_lang %{realname} @@ -154,10 +164,12 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %{_libexecdir}/* %{_unitdir}/* +%if %{with python2} %files -n python2-%{realname} %license COPYING %doc README ChangeLog examples %{python2_sitelib}/* +%endif %if %{with python3} %files -n python3-%{realname} @@ -169,6 +181,7 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %changelog * Tue Mar 20 2018 Miro Hrončok - 1:3.0.0-0.6.b1 - Use bcond for with python3, allow it on RHEL > 7 +- Conditionalize the Python 2 subpackage and don't build it on EL > 7 and Fedora > 28 * Sat Mar 17 2018 Iryna Shcherbina - 1:3.0.0-0.5.b1 - Update Python 2 dependency declarations to new packaging standards